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

mgerhardy martin.gerhardy at gmail.com
Fri Mar 19 08:27:01 UTC 2021


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

Summary:
47ad13ad02 TWINE: added debug command to toggle auto attack
7a3df83cf7 TWINE: fixed crash when actors are falling
923ff9e68d TWINE: removed unused functions
cf8a37d52d TWINE: moved BodyFlags out of Model struct
a068977e93 TWINE: converted Matrix to IVec3
dabaa4189f TWINE: renamed Matrix to IMatrix3x3
f7ef985dff TWINE: renamed methods
bbde05aaa0 TWINE: cleanup in renderPolygonsCopper
d9806f61e7 TWINE: cleanup render methods
92e7cd57bb TWINE: const
9b0b0b3e9e TWINE: use uint16
fab695355b TWINE: constexpr for IVec3
7447927034 TWINE: const
5953d84d1a TWINE: todo comment about potential bug in rendering methods
066b164892 TWINE: unified method names
8b23ed3225 TWINE: doxygen
0da5fc1d24 TWINE: fix rotating in auto aggressive mode
b41a90a1d5 TWINE: fixed regression in shape rendering


Commit: 47ad13ad023cc255cee95765efd7936ad8ad44fb
    https://github.com/scummvm/scummvm/commit/47ad13ad023cc255cee95765efd7936ad8ad44fb
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-03-19T09:16:47+01:00

Commit Message:
TWINE: added debug command to toggle auto attack

Changed paths:
    engines/twine/debugger/console.cpp
    engines/twine/debugger/console.h


diff --git a/engines/twine/debugger/console.cpp b/engines/twine/debugger/console.cpp
index c767ffcf73..36a95de5c5 100644
--- a/engines/twine/debugger/console.cpp
+++ b/engines/twine/debugger/console.cpp
@@ -50,6 +50,7 @@ TwinEConsole::TwinEConsole(TwinEEngine *engine) : _engine(engine), GUI::Debugger
 	registerCmd("toggle_debug", WRAP_METHOD(TwinEConsole, doToggleDebug));
 	registerCmd("toggle_zones", WRAP_METHOD(TwinEConsole, doToggleZoneRendering));
 	registerCmd("toggle_tracks", WRAP_METHOD(TwinEConsole, doToggleTrackRendering));
+	registerCmd("toggle_autoagressive", WRAP_METHOD(TwinEConsole, doToggleAutoAggressive));
 	registerCmd("toggle_actors", WRAP_METHOD(TwinEConsole, doToggleActorRendering));
 	registerCmd("toggle_clips", WRAP_METHOD(TwinEConsole, doToggleClipRendering));
 	registerCmd("toggle_freecamera", WRAP_METHOD(TwinEConsole, doToggleFreeCamera));
@@ -112,6 +113,11 @@ bool TwinEConsole::doToggleSceneryView(int argc, const char **argv) {
 	return true;
 }
 
+bool TwinEConsole::doToggleAutoAggressive(int argc, const char **argv) {
+	TOGGLE_DEBUG(_engine->_actor->autoAggressive, "auto aggressive\n")
+	return true;
+}
+
 bool TwinEConsole::doAddMagicPoints(int argc, const char **argv) {
 	if (argc < 2) {
 		debugPrintf("Usage: specify the magic points\n");
diff --git a/engines/twine/debugger/console.h b/engines/twine/debugger/console.h
index a72aa1760f..6da6016ff7 100644
--- a/engines/twine/debugger/console.h
+++ b/engines/twine/debugger/console.h
@@ -46,6 +46,7 @@ private:
 	bool doChangeScene(int argc, const char **argv);
 	bool doListMenuText(int argc, const char **argv);
 	bool doToggleDebug(int argc, const char **argv);
+	bool doToggleAutoAggressive(int argc, const char **argv);
 	bool doGiveKey(int argc, const char **argv);
 	bool doGiveGas(int argc, const char **argv);
 	bool doGiveKashes(int argc, const char **argv);


Commit: 7a3df83cf738b6d8cc68982904f5d31aa208f7dd
    https://github.com/scummvm/scummvm/commit/7a3df83cf738b6d8cc68982904f5d31aa208f7dd
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-03-19T09:16:47+01:00

Commit Message:
TWINE: fixed crash when actors are falling

... and the animation is changed

Changed paths:
    engines/twine/scene/animations.cpp


diff --git a/engines/twine/scene/animations.cpp b/engines/twine/scene/animations.cpp
index 9f4cbb1b7b..f5be03d4e7 100644
--- a/engines/twine/scene/animations.cpp
+++ b/engines/twine/scene/animations.cpp
@@ -141,13 +141,12 @@ bool Animations::setModelAnimation(int32 keyframeIdx, const AnimData &animData,
 
 	processLastRotationAngle = (processLastRotationAngle * deltaTime) / keyFrameLength;
 
-
 	if (numOfBonesInAnim <= 1) {
 		return false;
 	}
 
 	int16 boneIdx = 1;
-	int16 tmpNumOfPoints = numOfBonesInAnim - 1;
+	int16 tmpNumOfPoints = MIN<int16>(lastKeyFramePtr->boneframes.size() - 1, numOfBonesInAnim - 1);
 	do {
 		BoneFrame *modelStateBoneFrame = (BoneFrame *)Model::getBonesStateData(bodyPtr, boneIdx);
 		const BoneFrame &boneFrame = keyFrame->boneframes[boneIdx];


Commit: 923ff9e68d76f7075e675b2a6cc3438183cbacca
    https://github.com/scummvm/scummvm/commit/923ff9e68d76f7075e675b2a6cc3438183cbacca
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-03-19T09:16:47+01:00

Commit Message:
TWINE: removed unused functions

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


diff --git a/engines/twine/renderer/renderer.h b/engines/twine/renderer/renderer.h
index efa9138319..7e7626bc79 100644
--- a/engines/twine/renderer/renderer.h
+++ b/engines/twine/renderer/renderer.h
@@ -114,10 +114,6 @@ struct Model {
 		return (bodyHeader & 2) != 0;
 	}
 
-	static inline bool isAnimated(const BodyData &bodyPtr) {
-		return bodyPtr.isAnimated();
-	}
-
 	static uint8 *getData(uint8 *bodyPtr) {
 		return bodyPtr + 0x1A;
 	}
@@ -130,10 +126,6 @@ struct Model {
 		return getData(bodyPtr) + 2;
 	}
 
-	static const Common::Array<BodyVertex> &getVerticesBaseData(const BodyData &bodyPtr) {
-		return bodyPtr.getVertices();
-	}
-
 	static uint8 *getBonesData(uint8 *bodyPtr) {
 		uint8 *verticesBase = getData(bodyPtr);
 		const int16 numVertices = READ_LE_INT16(verticesBase);
@@ -154,14 +146,6 @@ struct Model {
 		return (BoneFrame*)(getBonesBaseData(bodyPtr) + 8 + (boneIdx * 38));
 	}
 
-	static BoneFrame *getBonesStateData(BodyData &bodyPtr, int boneIdx) {
-		return bodyPtr.getBoneState(boneIdx);
-	}
-
-	static const BoneFrame *getBonesStateData(const BodyData &bodyPtr, int boneIdx) {
-		return bodyPtr.getBoneState(boneIdx);
-	}
-
 	static uint8 *getBonesBaseData(uint8 *bodyPtr) {
 		return getBonesData(bodyPtr) + 2;
 	}
@@ -170,10 +154,6 @@ struct Model {
 		return getBonesData(bodyPtr) + 2 + (boneIdx * 38);
 	}
 
-	static const BoneFrame *getBonesBaseData(const BodyData &bodyPtr, int boneIdx = 0) {
-		return bodyPtr.getBoneState(boneIdx);
-	}
-
 	static int16 getNumBones(const uint8 *bodyPtr) {
 		const uint8 *verticesBase = getData(bodyPtr);
 		const int16 numVertices = READ_LE_INT16(verticesBase);
@@ -181,19 +161,11 @@ struct Model {
 		return READ_LE_INT16(bonesBase);
 	}
 
-	static int16 getNumBones(const BodyData &bodyPtr) {
-		return bodyPtr.getNumBones();
-	}
-
 	static int16 getNumVertices(const uint8 *bodyPtr) {
 		const uint8 *verticesBase = getData(bodyPtr);
 		return READ_LE_INT16(verticesBase);
 	}
 
-	static int16 getNumVertices(const BodyData &bodyPtr) {
-		return bodyPtr.getNumVertices();
-	}
-
 	static uint8 *getShadesData(uint8 *bodyPtr) {
 		uint8 *bonesBase = getBonesBaseData(bodyPtr);
 		const int16 numBones = getNumBones(bodyPtr);
@@ -204,10 +176,6 @@ struct Model {
 		return getShadesData(bodyPtr) + 2 + (shadeIdx * 8);
 	}
 
-	static const BodyShade *getShadesBaseData(const BodyData &bodyPtr, int16 shadeIdx = 0) {
-		return bodyPtr.getShade(shadeIdx);
-	}
-
 	static const uint8 *getShadesData(const uint8 *bodyPtr) {
 		const uint8 *bonesBase = getBonesBaseData(bodyPtr);
 		const int16 numBones = getNumBones(bodyPtr);
@@ -219,19 +187,11 @@ struct Model {
 		return READ_LE_INT16(shadesBase);
 	}
 
-	static int16 getNumShades(const BodyData &bodyPtr) {
-		return bodyPtr.getShades().size();
-	}
-
 	static int16 getNumShadesBone(const uint8 *bodyPtr, int boneIdx) {
 		const uint8 *bonesBase = getBonesBaseData(bodyPtr);
 		return READ_LE_INT16(bonesBase + (boneIdx * 38) + 18);
 	}
 
-	static int16 getNumShadesBone(const BodyData &bodyPtr, int boneIdx) {
-		return bodyPtr.getBone(boneIdx)->numOfShades;
-	}
-
 	static const uint8 *getPolygonData(const uint8 *bodyPtr) {
 		const uint8 *shades = getShadesBaseData(bodyPtr);
 		const int16 numShades = getNumShades(bodyPtr);


Commit: cf8a37d52d6f1069dced868e888c25d801fffb3d
    https://github.com/scummvm/scummvm/commit/cf8a37d52d6f1069dced868e888c25d801fffb3d
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-03-19T09:16:47+01:00

Commit Message:
TWINE: moved BodyFlags out of Model struct

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 4752641bad..7a1859e3fb 100644
--- a/engines/twine/renderer/renderer.cpp
+++ b/engines/twine/renderer/renderer.cpp
@@ -1486,14 +1486,14 @@ bool Renderer::renderAnimatedModel(ModelData *modelData, const uint8 *bodyPtr, R
 }
 
 void Renderer::prepareIsoModel(uint8 *bodyPtr) { // loadGfxSub
-	Model *bodyHeader = (Model *)bodyPtr;
+	BodyFlags *bodyHeader = (BodyFlags *)bodyPtr;
 
 	// This function should only be called ONCE, otherwise it corrupts the model data.
 	// The following code implements an unused flag to indicate that a model was already processed.
-	if (bodyHeader->bodyFlag.alreadyPrepared) {
+	if (bodyHeader->alreadyPrepared) {
 		return;
 	}
-	bodyHeader->bodyFlag.alreadyPrepared = 1;
+	bodyHeader->alreadyPrepared = 1;
 
 	// no animation applicable
 	if (!Model::isAnimated(bodyPtr)) {
diff --git a/engines/twine/renderer/renderer.h b/engines/twine/renderer/renderer.h
index 7e7626bc79..ad0bc5459a 100644
--- a/engines/twine/renderer/renderer.h
+++ b/engines/twine/renderer/renderer.h
@@ -82,33 +82,26 @@ inline Matrix operator*(const Matrix &matrix, const IVec3 &vec) {
 	return out;
 }
 
-struct Model {
-	struct BodyFlags {
-		uint16 unk1 : 1;            // 1 << 0
-		uint16 animated : 1;        // 1 << 1
-		uint16 unk3 : 1;            // 1 << 2
-		uint16 unk4 : 1;            // 1 << 3
-		uint16 unk5 : 1;            // 1 << 4
-		uint16 unk6 : 1;            // 1 << 5
-		uint16 unk7 : 1;            // 1 << 6
-		uint16 alreadyPrepared : 1; // 1 << 7
-		uint16 unk9 : 1;            // 1 << 8
-		uint16 unk10 : 1;           // 1 << 9
-		uint16 unk11 : 1;           // 1 << 10
-		uint16 unk12 : 1;           // 1 << 11
-		uint16 unk13 : 1;           // 1 << 12
-		uint16 unk14 : 1;           // 1 << 13
-		uint16 unk15 : 1;           // 1 << 14
-		uint16 unk16 : 1;           // 1 << 15
-	} bodyFlag;
-	int16 minsx = 0;
-	int16 maxsx = 0;
-	int16 minsy = 0;
-	int16 maxsy = 0;
-	int16 minsz = 0;
-	int16 maxsz = 0;
-	int16 offsetToData = 0;
+struct BodyFlags {
+	uint16 unk1 : 1;            // 1 << 0
+	uint16 animated : 1;        // 1 << 1
+	uint16 unk3 : 1;            // 1 << 2
+	uint16 unk4 : 1;            // 1 << 3
+	uint16 unk5 : 1;            // 1 << 4
+	uint16 unk6 : 1;            // 1 << 5
+	uint16 unk7 : 1;            // 1 << 6
+	uint16 alreadyPrepared : 1; // 1 << 7
+	uint16 unk9 : 1;            // 1 << 8
+	uint16 unk10 : 1;           // 1 << 9
+	uint16 unk11 : 1;           // 1 << 10
+	uint16 unk12 : 1;           // 1 << 11
+	uint16 unk13 : 1;           // 1 << 12
+	uint16 unk14 : 1;           // 1 << 13
+	uint16 unk15 : 1;           // 1 << 14
+	uint16 unk16 : 1;           // 1 << 15
+};
 
+struct Model {
 	static inline bool isAnimated(const uint8 *bodyPtr) {
 		const int16 bodyHeader = READ_LE_INT16(bodyPtr);
 		return (bodyHeader & 2) != 0;


Commit: a068977e931ec3b535a7eb39c8a6e4e4b4f6b05b
    https://github.com/scummvm/scummvm/commit/a068977e931ec3b535a7eb39c8a6e4e4b4f6b05b
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-03-19T09:16:47+01:00

Commit Message:
TWINE: converted Matrix to IVec3

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


diff --git a/engines/twine/renderer/renderer.h b/engines/twine/renderer/renderer.h
index ad0bc5459a..11b6e412e8 100644
--- a/engines/twine/renderer/renderer.h
+++ b/engines/twine/renderer/renderer.h
@@ -61,9 +61,9 @@ struct CmdRenderPolygon {
 };
 
 struct Matrix {
-	int32 row1[3]{0, 0, 0};
-	int32 row2[3]{0, 0, 0};
-	int32 row3[3]{0, 0, 0};
+	IVec3 row1;
+	IVec3 row2;
+	IVec3 row3;
 };
 
 inline Matrix operator*(const Matrix &matrix, const IVec3 &vec) {
diff --git a/engines/twine/shared.h b/engines/twine/shared.h
index e25101740a..ef8a9fa2fa 100644
--- a/engines/twine/shared.h
+++ b/engines/twine/shared.h
@@ -94,6 +94,30 @@ struct IVec3 {
 		z -= other.z;
 		return *this;
 	}
+
+	inline int32 &operator[](size_t idx) {
+		switch (idx) {
+		default:
+		case 0:
+			return x;
+		case 1:
+			return y;
+		case 2:
+			return z;
+		}
+	}
+
+	inline int32 operator[](size_t idx) const {
+		switch (idx) {
+		default:
+		case 0:
+			return x;
+		case 1:
+			return y;
+		case 2:
+			return z;
+		}
+	}
 };
 
 inline IVec3 operator+(const IVec3 &lhs, const IVec3 &rhs) {


Commit: dabaa4189f569e09ad3184045789458b653c0637
    https://github.com/scummvm/scummvm/commit/dabaa4189f569e09ad3184045789458b653c0637
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-03-19T09:16:47+01:00

Commit Message:
TWINE: renamed Matrix to IMatrix3x3

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 7a1859e3fb..b760d14cbd 100644
--- a/engines/twine/renderer/renderer.cpp
+++ b/engines/twine/renderer/renderer.cpp
@@ -245,9 +245,9 @@ IVec3 Renderer::getHolomapRotation(const int32 angleX, const int32 angleY, const
 	return vec;
 }
 
-void Renderer::applyRotation(Matrix *targetMatrix, const Matrix *currentMatrix) {
-	Matrix matrix1;
-	Matrix matrix2;
+void Renderer::applyRotation(IMatrix3x3 *targetMatrix, const IMatrix3x3 *currentMatrix) {
+	IMatrix3x3 matrix1;
+	IMatrix3x3 matrix2;
 
 	if (renderAngleX) {
 		int32 angle = renderAngleX;
@@ -311,7 +311,7 @@ void Renderer::applyRotation(Matrix *targetMatrix, const Matrix *currentMatrix)
 	}
 }
 
-void Renderer::applyPointsRotation(const pointTab *pointsPtr, int32 numPoints, pointTab *destPoints, const Matrix *rotationMatrix) {
+void Renderer::applyPointsRotation(const pointTab *pointsPtr, int32 numPoints, pointTab *destPoints, const IMatrix3x3 *rotationMatrix) {
 	int32 numOfPoints2 = numPoints;
 
 	do {
@@ -328,7 +328,7 @@ void Renderer::applyPointsRotation(const pointTab *pointsPtr, int32 numPoints, p
 	} while (--numOfPoints2);
 }
 
-void Renderer::processRotatedElement(Matrix *targetMatrix, const pointTab *pointsPtr, int32 rotZ, int32 rotY, int32 rotX, const elementEntry *elemPtr, ModelData *modelData) {
+void Renderer::processRotatedElement(IMatrix3x3 *targetMatrix, const pointTab *pointsPtr, int32 rotZ, int32 rotY, int32 rotX, const elementEntry *elemPtr, ModelData *modelData) {
 	int32 firstPoint = elemPtr->firstPoint / sizeof(pointTab);
 	int32 numOfPoints2 = elemPtr->numOfPoints;
 
@@ -336,7 +336,7 @@ void Renderer::processRotatedElement(Matrix *targetMatrix, const pointTab *point
 	renderAngleY = rotY;
 	renderAngleZ = rotZ;
 
-	const Matrix *currentMatrix;
+	const IMatrix3x3 *currentMatrix;
 	// if its the first point
 	if (elemPtr->baseElement == -1) {
 		currentMatrix = &baseMatrix;
@@ -364,7 +364,7 @@ void Renderer::processRotatedElement(Matrix *targetMatrix, const pointTab *point
 	applyPointsRotation(&pointsPtr[firstPoint], numOfPoints2, &modelData->computedPoints[firstPoint], targetMatrix);
 }
 
-void Renderer::applyPointsTranslation(const pointTab *pointsPtr, int32 numPoints, pointTab *destPoints, const Matrix *translationMatrix) {
+void Renderer::applyPointsTranslation(const pointTab *pointsPtr, int32 numPoints, pointTab *destPoints, const IMatrix3x3 *translationMatrix) {
 	int32 numOfPoints2 = numPoints;
 
 	do {
@@ -381,7 +381,7 @@ void Renderer::applyPointsTranslation(const pointTab *pointsPtr, int32 numPoints
 	} while (--numOfPoints2);
 }
 
-void Renderer::processTranslatedElement(Matrix *targetMatrix, const pointTab *pointsPtr, int32 rotX, int32 rotY, int32 rotZ, const elementEntry *elemPtr, ModelData *modelData) {
+void Renderer::processTranslatedElement(IMatrix3x3 *targetMatrix, const pointTab *pointsPtr, int32 rotX, int32 rotY, int32 rotZ, const elementEntry *elemPtr, ModelData *modelData) {
 	renderAngleX = rotX;
 	renderAngleY = rotY;
 	renderAngleZ = rotZ;
@@ -1310,7 +1310,7 @@ bool Renderer::renderAnimatedModel(ModelData *modelData, const uint8 *bodyPtr, R
 
 	const pointTab *pointsPtr = (const pointTab *)Model::getVerticesBaseData(bodyPtr);
 
-	Matrix *modelMatrix = &matricesTable[0];
+	IMatrix3x3 *modelMatrix = &matricesTable[0];
 
 	const elementEntry *bonesPtr0 = (const elementEntry *)Model::getBonesBaseData(bodyPtr, 0);
 	processRotatedElement(modelMatrix, pointsPtr, renderAngleX, renderAngleY, renderAngleZ, bonesPtr0, modelData);
@@ -1435,7 +1435,7 @@ bool Renderer::renderAnimatedModel(ModelData *modelData, const uint8 *bodyPtr, R
 
 	if (numOfShades) { // process normal data
 		uint16 *currentShadeDestination = (uint16 *)modelData->shadeTable;
-		Matrix *lightMatrix = &matricesTable[0];
+		IMatrix3x3 *lightMatrix = &matricesTable[0];
 
 		numOfPrimitives = numBones;
 
diff --git a/engines/twine/renderer/renderer.h b/engines/twine/renderer/renderer.h
index 11b6e412e8..623e311e00 100644
--- a/engines/twine/renderer/renderer.h
+++ b/engines/twine/renderer/renderer.h
@@ -60,14 +60,14 @@ struct CmdRenderPolygon {
 	// followed by Vertex array
 };
 
-struct Matrix {
+struct IMatrix3x3 {
 	IVec3 row1;
 	IVec3 row2;
 	IVec3 row3;
 };
 
-inline Matrix operator*(const Matrix &matrix, const IVec3 &vec) {
-	Matrix out;
+inline IMatrix3x3 operator*(const IMatrix3x3 &matrix, const IVec3 &vec) {
+	IMatrix3x3 out;
 	out.row1[0] = matrix.row1[0] * vec.x;
 	out.row1[1] = matrix.row1[1] * vec.x;
 	out.row1[2] = matrix.row1[2] * vec.x;
@@ -274,11 +274,11 @@ private:
 	void circleFill(int32 x, int32 y, int32 radius, uint8 color);
 	bool renderModelElements(int32 numOfPrimitives, const uint8 *polygonPtr, RenderCommand **renderCmds, ModelData *modelData);
 	void getCameraAnglePositions(int32 x, int32 y, int32 z);
-	void applyRotation(Matrix *targetMatrix, const Matrix *currentMatrix);
-	void applyPointsRotation(const pointTab *pointsPtr, int32 numPoints, pointTab *destPoints, const Matrix *rotationMatrix);
-	void processRotatedElement(Matrix *targetMatrix, const pointTab *pointsPtr, int32 rotZ, int32 rotY, int32 rotX, const elementEntry *elemPtr, ModelData *modelData);
-	void applyPointsTranslation(const pointTab *pointsPtr, int32 numPoints, pointTab *destPoints, const Matrix *translationMatrix);
-	void processTranslatedElement(Matrix *targetMatrix, const pointTab *pointsPtr, int32 rotX, int32 rotY, int32 rotZ, const elementEntry *elemPtr, ModelData *modelData);
+	void applyRotation(IMatrix3x3 *targetMatrix, const IMatrix3x3 *currentMatrix);
+	void applyPointsRotation(const pointTab *pointsPtr, int32 numPoints, pointTab *destPoints, const IMatrix3x3 *rotationMatrix);
+	void processRotatedElement(IMatrix3x3 *targetMatrix, const pointTab *pointsPtr, int32 rotZ, int32 rotY, int32 rotX, const elementEntry *elemPtr, ModelData *modelData);
+	void applyPointsTranslation(const pointTab *pointsPtr, int32 numPoints, pointTab *destPoints, const IMatrix3x3 *translationMatrix);
+	void processTranslatedElement(IMatrix3x3 *targetMatrix, const pointTab *pointsPtr, int32 rotX, int32 rotY, int32 rotZ, const elementEntry *elemPtr, ModelData *modelData);
 	void translateGroup(int32 x, int32 y, int32 z);
 
 	// ---- variables ----
@@ -299,9 +299,9 @@ private:
 
 	// ---
 
-	Matrix baseMatrix;
-	Matrix matricesTable[30 + 1];
-	Matrix shadeMatrix;
+	IMatrix3x3 baseMatrix;
+	IMatrix3x3 matricesTable[30 + 1];
+	IMatrix3x3 shadeMatrix;
 	IVec3 lightPos;
 
 	RenderCommand _renderCmds[1000];


Commit: f7ef985dffd360949d897960abca51b675ca719e
    https://github.com/scummvm/scummvm/commit/f7ef985dffd360949d897960abca51b675ca719e
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-03-19T09:16:47+01:00

Commit Message:
TWINE: renamed methods

Changed paths:
    engines/twine/scene/movements.cpp
    engines/twine/scene/movements.h


diff --git a/engines/twine/scene/movements.cpp b/engines/twine/scene/movements.cpp
index 90afd9feb0..20a4fef70c 100644
--- a/engines/twine/scene/movements.cpp
+++ b/engines/twine/scene/movements.cpp
@@ -298,7 +298,7 @@ bool Movements::processAttackExecution(int actorIdx) {
 	return false;
 }
 
-void Movements::processMovementExecution(int actorIdx) {
+void Movements::processManualMovementExecution(int actorIdx) {
 	ActorStruct *actor = _engine->_scene->getActor(actorIdx);
 	if (_engine->_actor->autoAggressive && actor->isAttackAnimationActive()) {
 		return;
@@ -351,7 +351,7 @@ void Movements::processMovementExecution(int actorIdx) {
 	}
 }
 
-void Movements::processRotationExecution(int actorIdx) {
+void Movements::processManualRotationExecution(int actorIdx) {
 	ActorStruct *actor = _engine->_scene->getActor(actorIdx);
 	if (!_engine->_actor->autoAggressive && _engine->_actor->autoAggressive && actor->isAttackAnimationActive()) {
 		// it is allowed to rotate in auto aggressive mode - but not in manual mode.
@@ -386,8 +386,8 @@ void Movements::processManualAction(int actorIdx) {
 		}
 	}
 
-	processMovementExecution(actorIdx);
-	processRotationExecution(actorIdx);
+	processManualMovementExecution(actorIdx);
+	processManualRotationExecution(actorIdx);
 }
 
 void Movements::processFollowAction(int actorIdx) {
diff --git a/engines/twine/scene/movements.h b/engines/twine/scene/movements.h
index 3abdf234b6..0f6c6d7c40 100644
--- a/engines/twine/scene/movements.h
+++ b/engines/twine/scene/movements.h
@@ -109,8 +109,8 @@ private:
 	 */
 	bool processBehaviourExecution(int actorIdx);
 	bool processAttackExecution(int actorIdx);
-	void processMovementExecution(int actorIdx);
-	void processRotationExecution(int actorIdx);
+	void processManualMovementExecution(int actorIdx);
+	void processManualRotationExecution(int actorIdx);
 
 	bool heroAction = false;
 


Commit: bbde05aaa00fe9b131c498b4965a07428a15ce76
    https://github.com/scummvm/scummvm/commit/bbde05aaa00fe9b131c498b4965a07428a15ce76
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-03-19T09:16:47+01:00

Commit Message:
TWINE: cleanup in renderPolygonsCopper

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


diff --git a/engines/twine/renderer/renderer.cpp b/engines/twine/renderer/renderer.cpp
index b760d14cbd..0fa193ef34 100644
--- a/engines/twine/renderer/renderer.cpp
+++ b/engines/twine/renderer/renderer.cpp
@@ -542,16 +542,13 @@ void Renderer::renderPolygonsCopper(uint8 *out, int vtop, int32 vsize, int32 col
 		if (hsize >= 0) {
 			uint16 mask = 0x43DB;
 
-			uint16 dx = (uint8)color;
-			dx |= 0x300;
-
 			hsize++;
 			const int32 startCopy = start;
 
 			for (int32 j = startCopy; j < hsize + startCopy; j++) {
 				start += mask;
-				start = (start & 0xFF00) | ((start & 0xFF) & (uint8)(dx / 256));
-				start = (start & 0xFF00) | ((start & 0xFF) + (dx & 0xFF));
+				start = (start & 0xFF00) | ((start & 0xFF) & 3U);
+				start = (start & 0xFF00) | ((start & 0xFF) + color);
 				if (j >= 0 && j < screenWidth) {
 					out[j] = start & 0xFF;
 				}


Commit: d9806f61e74d67b966276e5a58ee56cb3a67c201
    https://github.com/scummvm/scummvm/commit/d9806f61e74d67b966276e5a58ee56cb3a67c201
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-03-19T09:16:47+01:00

Commit Message:
TWINE: cleanup render methods

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 0fa193ef34..c5e8899440 100644
--- a/engines/twine/renderer/renderer.cpp
+++ b/engines/twine/renderer/renderer.cpp
@@ -519,7 +519,7 @@ void Renderer::computePolygons(int16 polyRenderType, const Vertex *vertices, int
 	}
 }
 
-void Renderer::renderPolygonsCopper(uint8 *out, int vtop, int32 vsize, int32 color) const {
+void Renderer::renderPolygonsCopper(uint8 *out, int vtop, int32 vsize, uint8 color) const {
 	const int16 *ptr1 = &_polyTab[vtop];
 	const int screenWidth = _engine->width();
 	const int screenHeight = _engine->height();
@@ -560,7 +560,7 @@ void Renderer::renderPolygonsCopper(uint8 *out, int vtop, int32 vsize, int32 col
 	}
 }
 
-void Renderer::renderPolygonsBopper(uint8 *out, int vtop, int32 vsize, int32 color) const {
+void Renderer::renderPolygonsBopper(uint8 *out, int vtop, int32 vsize, uint8 color) const {
 	const int16 *ptr1 = &_polyTab[vtop];
 	const int screenWidth = _engine->width();
 	const int screenHeight = _engine->height();
@@ -592,7 +592,7 @@ void Renderer::renderPolygonsBopper(uint8 *out, int vtop, int32 vsize, int32 col
 	}
 }
 
-void Renderer::renderPolygonsFlat(uint8 *out, int vtop, int32 vsize, int32 color) const {
+void Renderer::renderPolygonsFlat(uint8 *out, int vtop, int32 vsize, uint8 color) const {
 	const int16 *ptr1 = &_polyTab[vtop];
 	const int screenWidth = _engine->width();
 	const int screenHeight = _engine->height();
@@ -622,7 +622,7 @@ void Renderer::renderPolygonsFlat(uint8 *out, int vtop, int32 vsize, int32 color
 	}
 }
 
-void Renderer::renderPolygonsTele(uint8 *out, int vtop, int32 vsize, int32 color) const {
+void Renderer::renderPolygonsTele(uint8 *out, int vtop, int32 vsize, uint8 color) const {
 	const int16 *ptr1 = &_polyTab[vtop];
 	int bx = (uint16)color << 16;
 	const int screenWidth = _engine->width();
@@ -699,7 +699,7 @@ void Renderer::renderPolygonsTele(uint8 *out, int vtop, int32 vsize, int32 color
 }
 
 // FIXME: buggy
-void Renderer::renderPolygonsTras(uint8 *out, int vtop, int32 vsize, int32 color) const {
+void Renderer::renderPolygonsTras(uint8 *out, int vtop, int32 vsize, uint8 color) const {
 	const int16 *ptr1 = &_polyTab[vtop];
 	const int screenWidth = _engine->width();
 	const int screenHeight = _engine->height();
@@ -718,9 +718,9 @@ void Renderer::renderPolygonsTras(uint8 *out, int vtop, int32 vsize, int32 color
 			uint8 *out2 = start + out;
 
 			if (hsize / 2 < 0) {
-				bx = color & 0xFF;
+				bx = color;
 				bx = bx * 256;
-				bx += color & 0xFF;
+				bx += color;
 				for (int32 j = 0; j < hsize; j++) {
 					*(out2) = (*(out2)&0x0F0F) | bx;
 				}
@@ -734,7 +734,7 @@ void Renderer::renderPolygonsTras(uint8 *out, int vtop, int32 vsize, int32 color
 }
 
 // FIXME: buggy
-void Renderer::renderPolygonTrame(uint8 *out, int vtop, int32 vsize, int32 color) const {
+void Renderer::renderPolygonTrame(uint8 *out, int vtop, int32 vsize, uint8 color) const {
 	const int16 *ptr1 = &_polyTab[vtop];
 	unsigned char bh = 0;
 	const int screenWidth = _engine->width();
@@ -769,7 +769,7 @@ void Renderer::renderPolygonTrame(uint8 *out, int vtop, int32 vsize, int32 color
 				}
 
 				for (int32 j = 0; j < hsize; j++) {
-					*(out2) = (uint8)color;
+					*out2 = color;
 					out2 += 2;
 				}
 			}
@@ -778,7 +778,7 @@ void Renderer::renderPolygonTrame(uint8 *out, int vtop, int32 vsize, int32 color
 	}
 }
 
-void Renderer::renderPolygonsGouraud(uint8 *out, int vtop, int32 vsize, int32 color) const {
+void Renderer::renderPolygonsGouraud(uint8 *out, int vtop, int32 vsize) const {
 	const int16 *ptr1 = &_polyTab[vtop];
 	const int16 *ptr2 = &_polyTab2[vtop];
 	const int screenWidth = _engine->width();
@@ -846,7 +846,7 @@ void Renderer::renderPolygonsGouraud(uint8 *out, int vtop, int32 vsize, int32 co
 				if (hsize % 2) {
 					hsize /= 2;
 					if (currentXPos >= 0 && currentXPos < screenWidth) {
-						*(out2) = startColorByte;
+						*out2 = startColorByte;
 					}
 					out2++;
 					currentXPos++;
@@ -857,7 +857,7 @@ void Renderer::renderPolygonsGouraud(uint8 *out, int vtop, int32 vsize, int32 co
 
 				do {
 					if (currentXPos >= 0 && currentXPos < screenWidth) {
-						*(out2) = startColorByte;
+						*out2 = startColorByte;
 					}
 
 					currentXPos++;
@@ -877,7 +877,7 @@ void Renderer::renderPolygonsGouraud(uint8 *out, int vtop, int32 vsize, int32 co
 	}
 }
 
-void Renderer::renderPolygonsDither(uint8 *out, int vtop, int32 vsize, int32 color) const {
+void Renderer::renderPolygonsDither(uint8 *out, int vtop, int32 vsize) const {
 	const int16 *ptr1 = &_polyTab[vtop];
 	const int16 *ptr2 = &_polyTab2[vtop];
 	const int screenWidth = _engine->width();
@@ -909,7 +909,7 @@ void Renderer::renderPolygonsDither(uint8 *out, int vtop, int32 vsize, int32 col
 
 		if (hsize == 0) {
 			if (currentXPos >= 0 && currentXPos < screenWidth) {
-				*(out2) = (uint8)(((startColor + stopColor) / 2) / 256);
+				*out2 = (uint8)(((startColor + stopColor) / 2) / 256);
 			}
 		} else {
 			int16 colorSize = stopColor - startColor;
@@ -943,7 +943,7 @@ void Renderer::renderPolygonsDither(uint8 *out, int vtop, int32 vsize, int32 col
 				currentColor = ((currentColor & (0xFF00)) | ((((currentColor & 0xFF) << (hsize & 0xFF))) & 0xFF));
 				currentColor += startColor;
 				if (currentXPos >= 0 && currentXPos < screenWidth) {
-					*(out2) = currentColor / 256;
+					*out2 = currentColor / 256;
 				}
 
 				out2++;
@@ -954,7 +954,7 @@ void Renderer::renderPolygonsDither(uint8 *out, int vtop, int32 vsize, int32 col
 				currentColor += startColor;
 
 				if (currentXPos >= 0 && currentXPos < screenWidth) {
-					*(out2) = currentColor / 256;
+					*out2 = currentColor / 256;
 				}
 
 				currentColor &= 0xFF;
@@ -977,7 +977,7 @@ void Renderer::renderPolygonsDither(uint8 *out, int vtop, int32 vsize, int32 col
 					currentColor = ((currentColor & (0xFF00)) | ((((currentColor & 0xFF) << (hsize & 0xFF))) & 0xFF));
 					currentColor += startColor;
 					if (currentXPos >= 0 && currentXPos < screenWidth) {
-						*(out2) = currentColor / 256;
+						*out2 = currentColor / 256;
 					}
 					out2++;
 					currentXPos++;
@@ -989,7 +989,7 @@ void Renderer::renderPolygonsDither(uint8 *out, int vtop, int32 vsize, int32 col
 					currentColor &= 0xFF;
 					currentColor += startColor;
 					if (currentXPos >= 0 && currentXPos < screenWidth) {
-						*(out2) = currentColor / 256;
+						*out2 = currentColor / 256;
 					}
 					currentXPos++;
 					currentColor &= 0xFF;
@@ -1009,7 +1009,7 @@ void Renderer::renderPolygonsDither(uint8 *out, int vtop, int32 vsize, int32 col
 	}
 }
 
-void Renderer::renderPolygonsMarble(uint8 *out, int vtop, int32 vsize, int32 color) const {
+void Renderer::renderPolygonsMarble(uint8 *out, int vtop, int32 vsize, uint8 color) const {
 }
 
 void Renderer::renderPolygons(const CmdRenderPolygon &polygon, Vertex *vertices) {
@@ -1046,10 +1046,10 @@ void Renderer::renderPolygons(const CmdRenderPolygon &polygon, Vertex *vertices)
 		renderPolygonTrame(out, vtop, vsize, polygon.colorIndex);
 		break;
 	case POLYGONTYPE_GOURAUD:
-		renderPolygonsGouraud(out, vtop, vsize, polygon.colorIndex);
+		renderPolygonsGouraud(out, vtop, vsize);
 		break;
 	case POLYGONTYPE_DITHER:
-		renderPolygonsDither(out, vtop, vsize, polygon.colorIndex);
+		renderPolygonsDither(out, vtop, vsize);
 		break;
 	case POLYGONTYPE_MARBLE:
 		renderPolygonsMarble(out, vtop, vsize, polygon.colorIndex);
diff --git a/engines/twine/renderer/renderer.h b/engines/twine/renderer/renderer.h
index 623e311e00..59455beed9 100644
--- a/engines/twine/renderer/renderer.h
+++ b/engines/twine/renderer/renderer.h
@@ -321,15 +321,15 @@ private:
 
 	bool isUsingOrthoProjection = false;
 
-	void renderPolygonsCopper(uint8 *out, int vtop, int32 vsize, int32 color) const;
-	void renderPolygonsBopper(uint8 *out, int vtop, int32 vsize, int32 color) const;
-	void renderPolygonsFlat(uint8 *out, int vtop, int32 vsize, int32 color) const;
-	void renderPolygonsTele(uint8 *out, int vtop, int32 vsize, int32 color) const;
-	void renderPolygonsTras(uint8 *out, int vtop, int32 vsize, int32 color) const;
-	void renderPolygonTrame(uint8 *out, int vtop, int32 vsize, int32 color) const;
-	void renderPolygonsGouraud(uint8 *out, int vtop, int32 vsize, int32 color) const;
-	void renderPolygonsDither(uint8 *out, int vtop, int32 vsize, int32 color) const;
-	void renderPolygonsMarble(uint8 *out, int vtop, int32 vsize, int32 color) const;
+	void renderPolygonsCopper(uint8 *out, int vtop, int32 vsize, uint8 color) const;
+	void renderPolygonsBopper(uint8 *out, int vtop, int32 vsize, uint8 color) const;
+	void renderPolygonsFlat(uint8 *out, int vtop, int32 vsize, uint8 color) const;
+	void renderPolygonsTele(uint8 *out, int vtop, int32 vsize, uint8 color) const;
+	void renderPolygonsTras(uint8 *out, int vtop, int32 vsize, uint8 color) const;
+	void renderPolygonTrame(uint8 *out, int vtop, int32 vsize, uint8 color) const;
+	void renderPolygonsGouraud(uint8 *out, int vtop, int32 vsize) const;
+	void renderPolygonsDither(uint8 *out, int vtop, int32 vsize) const;
+	void renderPolygonsMarble(uint8 *out, int vtop, int32 vsize, uint8 color) const;
 
 	void computeBoundingBox(Vertex *vertices, int32 numVertices, int &vleft, int &vright, int &vtop, int &vbottom) const;
 	void computePolygons(int16 polyRenderType, const Vertex *vertices, int32 numVertices);


Commit: 92e7cd57bbd03ade03fe5e7d0827ea04a79dde63
    https://github.com/scummvm/scummvm/commit/92e7cd57bbd03ade03fe5e7d0827ea04a79dde63
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-03-19T09:16:48+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 c5e8899440..00753b172c 100644
--- a/engines/twine/renderer/renderer.cpp
+++ b/engines/twine/renderer/renderer.cpp
@@ -576,12 +576,11 @@ void Renderer::renderPolygonsBopper(uint8 *out, int vtop, int32 vsize, uint8 col
 		int16 start = ptr1[0];
 		int16 stop = ptr1[screenHeight];
 		ptr1++;
-		int32 hsize = stop - start;
+		const int32 hsize = stop - start;
 
 		if (start & 1) {
 			if (hsize >= 0) {
-				hsize++;
-				for (int32 j = start; j < hsize + start; j++) {
+				for (int32 j = start; j <= hsize + start; j++) {
 					if (j >= 0 && j < screenWidth) {
 						out[j] = color;
 					}


Commit: 9b0b0b3e9ed623e5bf275fb8f2d0aaa7b2dfba55
    https://github.com/scummvm/scummvm/commit/9b0b0b3e9ed623e5bf275fb8f2d0aaa7b2dfba55
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-03-19T09:16:48+01:00

Commit Message:
TWINE: use uint16

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


diff --git a/engines/twine/renderer/renderer.cpp b/engines/twine/renderer/renderer.cpp
index 00753b172c..df86bb66d9 100644
--- a/engines/twine/renderer/renderer.cpp
+++ b/engines/twine/renderer/renderer.cpp
@@ -643,7 +643,7 @@ void Renderer::renderPolygonsTele(uint8 *out, int vtop, int32 vsize, uint8 color
 			}
 
 			uint8 *out2 = start + out;
-			*out2 = ((unsigned short)(bx / 24)) & 0x0F;
+			*out2 = ((uint16)(bx / 24)) & 0x0F;
 
 			color = *(out2 + 1);
 
@@ -657,7 +657,7 @@ void Renderer::renderPolygonsTele(uint8 *out, int vtop, int32 vsize, uint8 color
 
 		if (stop >= start) {
 			hsize++;
-			bx = (unsigned short)(color / 16);
+			bx = (uint16)(color / 16);
 			uint8 *out2 = start + out;
 
 			int ax = (bx & 0xF0) * 256;


Commit: fab695355b5974387344f9b7f8f2c341480c342c
    https://github.com/scummvm/scummvm/commit/fab695355b5974387344f9b7f8f2c341480c342c
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-03-19T09:16:48+01:00

Commit Message:
TWINE: constexpr for IVec3

Changed paths:
    engines/twine/shared.h


diff --git a/engines/twine/shared.h b/engines/twine/shared.h
index ef8a9fa2fa..c69597a01c 100644
--- a/engines/twine/shared.h
+++ b/engines/twine/shared.h
@@ -75,8 +75,8 @@
 namespace TwinE {
 
 struct IVec3 {
-	IVec3() : x(0), y(0), z(0) {}
-	IVec3(int32 _x, int32 _y, int32 _z) : x(_x), y(_y), z(_z) {}
+	constexpr IVec3() : x(0), y(0), z(0) {}
+	constexpr IVec3(int32 _x, int32 _y, int32 _z) : x(_x), y(_y), z(_z) {}
 	int32 x;
 	int32 y;
 	int32 z;


Commit: 7447927034b914a20ff137b170df20c5a618d6d3
    https://github.com/scummvm/scummvm/commit/7447927034b914a20ff137b170df20c5a618d6d3
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-03-19T09:16:48+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 df86bb66d9..3b6cc34480 100644
--- a/engines/twine/renderer/renderer.cpp
+++ b/engines/twine/renderer/renderer.cpp
@@ -604,14 +604,13 @@ void Renderer::renderPolygonsFlat(uint8 *out, int vtop, int32 vsize, uint8 color
 		renderLoop = screenHeight;
 	}
 	for (int32 currentLine = 0; currentLine < renderLoop; ++currentLine) {
-		int16 start = ptr1[0];
-		int16 stop = ptr1[screenHeight];
+		const int16 start = ptr1[0];
+		const int16 stop = ptr1[screenHeight];
 		ptr1++;
-		int32 hsize = stop - start;
+		const int32 hsize = stop - start;
 
 		if (hsize >= 0) {
-			hsize++;
-			for (int32 j = start; j < hsize + start; j++) {
+			for (int32 j = start; j <= hsize + start; j++) {
 				if (j >= 0 && j < screenWidth) {
 					out[j] = color;
 				}
@@ -724,7 +723,7 @@ void Renderer::renderPolygonsTras(uint8 *out, int vtop, int32 vsize, uint8 color
 					*(out2) = (*(out2)&0x0F0F) | bx;
 				}
 			} else {
-				*(out2) = (*(out2)&0x0F) | color;
+				*out2 = (*(out2)&0x0F) | color;
 				out2++;
 			}
 		}


Commit: 5953d84d1a06b9a93a97edbbb970b31d9d80842e
    https://github.com/scummvm/scummvm/commit/5953d84d1a06b9a93a97edbbb970b31d9d80842e
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-03-19T09:16:48+01:00

Commit Message:
TWINE: todo comment about potential bug in rendering methods

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


diff --git a/engines/twine/renderer/renderer.cpp b/engines/twine/renderer/renderer.cpp
index 3b6cc34480..5dae897dbe 100644
--- a/engines/twine/renderer/renderer.cpp
+++ b/engines/twine/renderer/renderer.cpp
@@ -721,6 +721,7 @@ void Renderer::renderPolygonsTras(uint8 *out, int vtop, int32 vsize, uint8 color
 				bx += color;
 				for (int32 j = 0; j < hsize; j++) {
 					*(out2) = (*(out2)&0x0F0F) | bx;
+					// TODO: check for potential out2++ here
 				}
 			} else {
 				*out2 = (*(out2)&0x0F) | color;


Commit: 066b1648926041df47590d6a800f853ad72eec90
    https://github.com/scummvm/scummvm/commit/066b1648926041df47590d6a800f853ad72eec90
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-03-19T09:16:48+01:00

Commit Message:
TWINE: unified method names

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 5dae897dbe..cfb7453461 100644
--- a/engines/twine/renderer/renderer.cpp
+++ b/engines/twine/renderer/renderer.cpp
@@ -733,7 +733,7 @@ void Renderer::renderPolygonsTras(uint8 *out, int vtop, int32 vsize, uint8 color
 }
 
 // FIXME: buggy
-void Renderer::renderPolygonTrame(uint8 *out, int vtop, int32 vsize, uint8 color) const {
+void Renderer::renderPolygonsTrame(uint8 *out, int vtop, int32 vsize, uint8 color) const {
 	const int16 *ptr1 = &_polyTab[vtop];
 	unsigned char bh = 0;
 	const int screenWidth = _engine->width();
@@ -920,7 +920,7 @@ void Renderer::renderPolygonsDither(uint8 *out, int vtop, int32 vsize) const {
 				currentColor &= 0xFF;
 				currentColor += startColor;
 				if (currentXPos >= 0 && currentXPos < screenWidth) {
-					*(out2) = currentColor / 256;
+					*out2 = currentColor / 256;
 				}
 
 				currentColor &= 0xFF;
@@ -1042,7 +1042,7 @@ void Renderer::renderPolygons(const CmdRenderPolygon &polygon, Vertex *vertices)
 		renderPolygonsTras(out, vtop, vsize, polygon.colorIndex);
 		break;
 	case POLYGONTYPE_TRAME:
-		renderPolygonTrame(out, vtop, vsize, polygon.colorIndex);
+		renderPolygonsTrame(out, vtop, vsize, polygon.colorIndex);
 		break;
 	case POLYGONTYPE_GOURAUD:
 		renderPolygonsGouraud(out, vtop, vsize);
diff --git a/engines/twine/renderer/renderer.h b/engines/twine/renderer/renderer.h
index 59455beed9..fa87c28e1a 100644
--- a/engines/twine/renderer/renderer.h
+++ b/engines/twine/renderer/renderer.h
@@ -326,7 +326,7 @@ private:
 	void renderPolygonsFlat(uint8 *out, int vtop, int32 vsize, uint8 color) const;
 	void renderPolygonsTele(uint8 *out, int vtop, int32 vsize, uint8 color) const;
 	void renderPolygonsTras(uint8 *out, int vtop, int32 vsize, uint8 color) const;
-	void renderPolygonTrame(uint8 *out, int vtop, int32 vsize, uint8 color) const;
+	void renderPolygonsTrame(uint8 *out, int vtop, int32 vsize, uint8 color) const;
 	void renderPolygonsGouraud(uint8 *out, int vtop, int32 vsize) const;
 	void renderPolygonsDither(uint8 *out, int vtop, int32 vsize) const;
 	void renderPolygonsMarble(uint8 *out, int vtop, int32 vsize, uint8 color) const;


Commit: 8b23ed32252131a80089f8e3fbf887bd9de8c0e4
    https://github.com/scummvm/scummvm/commit/8b23ed32252131a80089f8e3fbf887bd9de8c0e4
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-03-19T09:16:48+01:00

Commit Message:
TWINE: doxygen

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


diff --git a/engines/twine/renderer/renderer.h b/engines/twine/renderer/renderer.h
index fa87c28e1a..f5d7fd4bb7 100644
--- a/engines/twine/renderer/renderer.h
+++ b/engines/twine/renderer/renderer.h
@@ -227,9 +227,18 @@ private:
 	struct RenderCommand {
 		int16 depth = 0;
 		int16 renderType = 0;
+		/**
+		 * Pointer to the command data
+		 * @sa renderCoordinatesBuffer
+		 */
 		uint8 *dataPtr = nullptr;
 	};
 
+	/**
+	 * @brief A render command payload for drawing a line
+	 *
+	 * @sa RenderCommand
+	 */
 	struct CmdRenderLine {
 		uint8 colorIndex = 0;
 		uint8 unk1 = 0;
@@ -241,6 +250,11 @@ private:
 		int16 y2 = 0;
 	};
 
+	/**
+	 * @brief A render command payload for drawing a sphere
+	 *
+	 * @sa RenderCommand
+	 */
 	struct CmdRenderSphere {
 		int8 colorIndex = 0;
 		int16 x = 0;
@@ -305,6 +319,10 @@ private:
 	IVec3 lightPos;
 
 	RenderCommand _renderCmds[1000];
+	/**
+	 * @brief Raw buffer for holding the render commands. This is a type followed by the command data
+	 * that is needed to render the primitive.
+	 */
 	uint8 renderCoordinatesBuffer[10000]{0};
 
 	int32 _polyTabSize = 0;


Commit: 0da5fc1d24c3b65bd86483dd41ddf8b7e51aad98
    https://github.com/scummvm/scummvm/commit/0da5fc1d24c3b65bd86483dd41ddf8b7e51aad98
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-03-19T09:16:48+01:00

Commit Message:
TWINE: fix rotating in auto aggressive mode

fixed manual aggressive mode kick

see https://bugs.scummvm.org/ticket/11981

Changed paths:
    engines/twine/scene/movements.cpp


diff --git a/engines/twine/scene/movements.cpp b/engines/twine/scene/movements.cpp
index 20a4fef70c..b790e15c0b 100644
--- a/engines/twine/scene/movements.cpp
+++ b/engines/twine/scene/movements.cpp
@@ -257,10 +257,13 @@ bool Movements::processBehaviourExecution(int actorIdx) {
 		} else {
 			if (_engine->_input->isActionActive(TwinEActionType::TurnLeft)) {
 				_engine->_animations->initAnim(AnimationTypes::kLeftPunch, kAnimationType_1, AnimationTypes::kStanding, actorIdx);
+				heroMoved = true;
 			} else if (_engine->_input->isActionActive(TwinEActionType::TurnRight)) {
 				_engine->_animations->initAnim(AnimationTypes::kRightPunch, kAnimationType_1, AnimationTypes::kStanding, actorIdx);
+				heroMoved = true;
 			} else if (_engine->_input->isActionActive(TwinEActionType::MoveForward)) {
 				_engine->_animations->initAnim(AnimationTypes::kKick, kAnimationType_1, AnimationTypes::kStanding, actorIdx);
+				heroMoved = true;
 			}
 		}
 		break;
@@ -300,7 +303,7 @@ bool Movements::processAttackExecution(int actorIdx) {
 
 void Movements::processManualMovementExecution(int actorIdx) {
 	ActorStruct *actor = _engine->_scene->getActor(actorIdx);
-	if (_engine->_actor->autoAggressive && actor->isAttackAnimationActive()) {
+	if (actor->isAttackAnimationActive()) {
 		return;
 	}
 	if (actor->isJumpAnimationActive()) {
@@ -353,7 +356,7 @@ void Movements::processManualMovementExecution(int actorIdx) {
 
 void Movements::processManualRotationExecution(int actorIdx) {
 	ActorStruct *actor = _engine->_scene->getActor(actorIdx);
-	if (!_engine->_actor->autoAggressive && _engine->_actor->autoAggressive && actor->isAttackAnimationActive()) {
+	if (!_engine->_actor->autoAggressive && actor->isAttackAnimationActive()) {
 		// it is allowed to rotate in auto aggressive mode - but not in manual mode.
 		return;
 	}


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

Commit Message:
TWINE: fixed regression in shape rendering

introduced in abae3e440a8ea7b78d6b1ea6f7cf3fb6201cbd58

Changed paths:
    engines/twine/scene/extra.cpp


diff --git a/engines/twine/scene/extra.cpp b/engines/twine/scene/extra.cpp
index fd8ab477ce..c6147ccf59 100644
--- a/engines/twine/scene/extra.cpp
+++ b/engines/twine/scene/extra.cpp
@@ -405,7 +405,7 @@ void Extra::addExtraThrowMagicball(int32 x, int32 y, int32 z, int32 xAngle, int3
 void Extra::drawSpecialShape(const ExtraShape &shapeTable, int32 x, int32 y, int32 color, int32 angle, int32 size) {
 	int shapeDataIndex = 0;
 	int16 var_x = shapeTable.data[shapeDataIndex].x * size / 16;
-	int16 var_z = shapeTable.data[shapeDataIndex].x * size / 16;
+	int16 var_z = shapeTable.data[shapeDataIndex].z * size / 16;
 
 	++shapeDataIndex;
 
@@ -440,7 +440,7 @@ void Extra::drawSpecialShape(const ExtraShape &shapeTable, int32 x, int32 y, int
 
 	for (int32 numEntries = 1; numEntries < shapeTable.n; ++numEntries) {
 		var_x = shapeTable.data[shapeDataIndex].x * size / 16;
-		var_z = shapeTable.data[shapeDataIndex].x * size / 16;
+		var_z = shapeTable.data[shapeDataIndex].z * size / 16;
 		++shapeDataIndex;
 
 		const int32 oldComputedX = currentX;




More information about the Scummvm-git-logs mailing list