[Scummvm-git-logs] scummvm master -> 81011c936c1629c69d148c58cf1a0375d255e0f2

mgerhardy noreply at scummvm.org
Sun Jan 15 10:29:14 UTC 2023


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

Summary:
8315498dfb TWINE: renamed stuff to match more of the original sources
215440ee83 TWINE: renamed members and use isPolygonVisible in preparePolygons
5059a77b43 TWINE: renamed and removed members
9163381d4b TWINE: renamed methods to match original sources
1ab3df79a8 TWINE: renamed methods and members to match the original sources
38ce97cb9c TWINE: debug command to switch the game chapter
decbede936 TWINE: renamed members and methods
b936aee7dc TWINE: set the frame to 1 as found in the original sources
c32a1d6b2e TWINE: renamed members
3cdd458428 TWINE: simplified checkValidObjPos
b5eb958d8d TWINE: renamed methods to match original sources
81011c936c TWINE: fixed parsing lba2 scene


Commit: 8315498dfbfbc3474ed5114fa5e53656f5fe56ea
    https://github.com/scummvm/scummvm/commit/8315498dfbfbc3474ed5114fa5e53656f5fe56ea
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2023-01-15T11:28:57+01:00

Commit Message:
TWINE: renamed stuff to match more of the original sources

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


diff --git a/engines/twine/holomap.cpp b/engines/twine/holomap.cpp
index dcbf48459cf..a43420dc652 100644
--- a/engines/twine/holomap.cpp
+++ b/engines/twine/holomap.cpp
@@ -92,8 +92,8 @@ bool Holomap::loadLocations() {
 
 	_engine->_text->initTextBank(TextBankId::Inventory_Intro_and_Holomap);
 	for (int32 i = 0; i < _numLocations; i++) {
-		_locations[i].angleX = ClampAngle(stream.readSint16LE());
-		_locations[i].angleY = ClampAngle(stream.readSint16LE());
+		_locations[i].angleX = (int16)ClampAngle(stream.readSint16LE());
+		_locations[i].angleY = (int16)ClampAngle(stream.readSint16LE());
 		_locations[i].size = stream.readSint16LE();
 		_locations[i].textIndex = (TextId)stream.readUint16LE();
 
@@ -120,7 +120,7 @@ void Holomap::clearHolomapPosition(int32 locationIdx) {
 	_engine->_gameState->_holomapFlags[locationIdx] |= HOLOMAP_UNK7;
 }
 
-void Holomap::loadHolomapGFX() {
+void Holomap::initHoloDatas() {
 	constexpr TwineResource resource(Resources::HQR_RESS_FILE, RESSHQR_HOLOPAL);
 	_engine->_screens->loadCustomPalette(resource);
 
@@ -139,20 +139,20 @@ void Holomap::loadHolomapGFX() {
 		_paletteHolomap[i + 2] = _engine->_screens->_palette[j + 2];
 	}
 
-	prepareHolomapProjectedPositions();
+	computeCoorMapping();
 
 	Common::SeekableReadStream *surfaceStream = HQR::makeReadStream(TwineResource(Resources::HQR_RESS_FILE, RESSHQR_HOLOSURFACE));
 	if (surfaceStream == nullptr) {
 		error("Failed to load holomap surface");
 	}
-	prepareHolomapSurface(surfaceStream);
+	computeCoorGlobe(surfaceStream);
 	delete surfaceStream;
 	_holomapPaletteIndex = 0;
 }
 
-void Holomap::prepareHolomapSurface(Common::SeekableReadStream *holomapSurfaceStream) {
+void Holomap::computeCoorGlobe(Common::SeekableReadStream *holomapSurfaceStream) {
 	int holomapSurfaceArrayIdx = 0;
-	_engine->_renderer->setBaseRotation(0, 0, 0);
+	_engine->_renderer->setAngleCamera(0, 0, 0);
 	for (int alpha = -ANGLE_90; alpha <= ANGLE_90; alpha += ANGLE_11_25) {
 		const int32 rot = holomapSurfaceStream->readByte();
 		holomapSurfaceStream->seek(-1, SEEK_CUR);
@@ -173,21 +173,21 @@ void Holomap::prepareHolomapSurface(Common::SeekableReadStream *holomapSurfaceSt
 	assert(holomapSurfaceStream->eos());
 }
 
-void Holomap::prepareHolomapProjectedPositions() {
+void Holomap::computeCoorMapping() {
 	int projectedIndex = 0;
 	for (int32 alpha = -ANGLE_90; alpha <= ANGLE_90; alpha += ANGLE_11_25) {
 		for (int32 beta = 0; beta < ANGLE_360; beta += ANGLE_11_25) {
-			_projectedSurfacePositions[projectedIndex].x2 = _engine->_screens->lerp(0, 0xffff, ANGLE_360 - 1, beta);
+			_projectedSurfacePositions[projectedIndex].x2 = _engine->_screens->lerp(0, 255 * ANGLE_90 + 255, ANGLE_360 - 1, beta);
 			if (alpha == ANGLE_90) {
-				_projectedSurfacePositions[projectedIndex].y2 = -1;
+				_projectedSurfacePositions[projectedIndex].y2 = 255 * ANGLE_90 + 255;
 			} else {
 				_projectedSurfacePositions[projectedIndex].y2 = ((alpha + ANGLE_90) * ANGLE_90) / 2;
 			}
 			++projectedIndex;
 		}
-		_projectedSurfacePositions[projectedIndex].x2 = -1;
+		_projectedSurfacePositions[projectedIndex].x2 = 255 * ANGLE_90 + 255;
 		if (alpha == ANGLE_90) {
-			_projectedSurfacePositions[projectedIndex].y2 = -1;
+			_projectedSurfacePositions[projectedIndex].y2 = 255 * ANGLE_90 + 255;
 		} else {
 			_projectedSurfacePositions[projectedIndex].y2 = ((alpha + ANGLE_90) * ANGLE_90) / 2;
 		}
@@ -195,7 +195,7 @@ void Holomap::prepareHolomapProjectedPositions() {
 	}
 }
 
-void Holomap::prepareHolomapPolygons() {
+void Holomap::computeGlobeProj() {
 	int holomapSortArrayIdx = 0;
 	int holomapSurfaceArrayIdx = 0;
 	_projectedSurfaceIndex = 0;
@@ -204,7 +204,7 @@ void Holomap::prepareHolomapPolygons() {
 			IVec3 *vec = &_holomapSurface[holomapSurfaceArrayIdx++];
 			const IVec3 &destPos = _engine->_renderer->getBaseRotationPosition(vec->x, vec->y, vec->z);
 			if (alpha != ANGLE_90) {
-				_holomapSort[holomapSortArrayIdx].z = destPos.z;
+				_holomapSort[holomapSortArrayIdx].z = (int16)destPos.z;
 				_holomapSort[holomapSortArrayIdx].projectedPosIdx = _projectedSurfaceIndex;
 				++holomapSortArrayIdx;
 			}
@@ -226,7 +226,7 @@ void Holomap::prepareHolomapPolygons() {
 	Common::sort(_holomapSort, _holomapSort + ARRAYSIZE(_holomapSort), [](const HolomapSort &a, const HolomapSort &b) { return a.z < b.z; });
 }
 
-bool Holomap::isTriangleVisible(const Vertex *vertices) const {
+bool Holomap::isPolygonVisible(const Vertex *vertices) const { // TestVuePoly
 	const int32 iVar2 = ((int32)vertices[1].x - (int32)vertices[0].x) *
 						((int32)vertices[0].y - (int32)vertices[2].y);
 	const int32 iVar1 = ((int32)vertices[1].y - (int32)vertices[0].y) *
@@ -236,46 +236,46 @@ bool Holomap::isTriangleVisible(const Vertex *vertices) const {
 
 #define SURFACE_POS_OFFSET ((ANGLE_360 / ANGLE_11_25) + 1)
 void Holomap::renderHolomapSurfacePolygons(uint8 *holomapImage, uint32 holomapImageSize) {
-	prepareHolomapPolygons();
+	computeGlobeProj();
 	for (int32 i = 0; i < ARRAYSIZE(_holomapSort); ++i) {
 		assert(_holomapSort[i].projectedPosIdx + 34 < _projectedSurfaceIndex);
 		const HolomapProjectedPos &pos1 = _projectedSurfacePositions[_holomapSort[i].projectedPosIdx + 0];
 		const HolomapProjectedPos &pos2 = _projectedSurfacePositions[_holomapSort[i].projectedPosIdx + 0 + SURFACE_POS_OFFSET];
 		const HolomapProjectedPos &pos3 = _projectedSurfacePositions[_holomapSort[i].projectedPosIdx + 1];
 		Vertex vertexCoordinates[3];
-		vertexCoordinates[0].x = pos1.x1;
-		vertexCoordinates[0].y = pos1.y1;
-		vertexCoordinates[1].x = pos2.x1;
-		vertexCoordinates[1].y = pos2.y1;
-		vertexCoordinates[2].x = pos3.x1;
-		vertexCoordinates[2].y = pos3.y1;
-		if (isTriangleVisible(vertexCoordinates)) {
+		vertexCoordinates[0].x = (int16)pos1.x1;
+		vertexCoordinates[0].y = (int16)pos1.y1;
+		vertexCoordinates[1].x = (int16)pos2.x1;
+		vertexCoordinates[1].y = (int16)pos2.y1;
+		vertexCoordinates[2].x = (int16)pos3.x1;
+		vertexCoordinates[2].y = (int16)pos3.y1;
+		if (isPolygonVisible(vertexCoordinates)) {
 			Vertex textureCoordinates[3];
-			textureCoordinates[0].x = pos1.x2;
-			textureCoordinates[0].y = pos1.y2;
-			textureCoordinates[1].x = pos2.x2;
-			textureCoordinates[1].y = pos2.y2;
-			textureCoordinates[2].x = pos3.x2;
-			textureCoordinates[2].y = pos3.y2;
+			textureCoordinates[0].x = (int16)pos1.x2;
+			textureCoordinates[0].y = (int16)pos1.y2;
+			textureCoordinates[1].x = (int16)pos2.x2;
+			textureCoordinates[1].y = (int16)pos2.y2;
+			textureCoordinates[2].x = (int16)pos3.x2;
+			textureCoordinates[2].y = (int16)pos3.y2;
 			_engine->_renderer->renderHolomapVertices(vertexCoordinates, textureCoordinates, holomapImage, holomapImageSize);
 		}
 		const HolomapProjectedPos &pos4 = _projectedSurfacePositions[_holomapSort[i].projectedPosIdx + 0 + SURFACE_POS_OFFSET];
 		const HolomapProjectedPos &pos5 = _projectedSurfacePositions[_holomapSort[i].projectedPosIdx + 1 + SURFACE_POS_OFFSET];
 		const HolomapProjectedPos &pos6 = _projectedSurfacePositions[_holomapSort[i].projectedPosIdx + 1];
-		vertexCoordinates[0].x = pos4.x1;
-		vertexCoordinates[0].y = pos4.y1;
-		vertexCoordinates[1].x = pos5.x1;
-		vertexCoordinates[1].y = pos5.y1;
-		vertexCoordinates[2].x = pos6.x1;
-		vertexCoordinates[2].y = pos6.y1;
-		if (isTriangleVisible(vertexCoordinates)) {
+		vertexCoordinates[0].x = (int16)pos4.x1;
+		vertexCoordinates[0].y = (int16)pos4.y1;
+		vertexCoordinates[1].x = (int16)pos5.x1;
+		vertexCoordinates[1].y = (int16)pos5.y1;
+		vertexCoordinates[2].x = (int16)pos6.x1;
+		vertexCoordinates[2].y = (int16)pos6.y1;
+		if (isPolygonVisible(vertexCoordinates)) {
 			Vertex textureCoordinates[3];
-			textureCoordinates[0].x = pos4.x2;
-			textureCoordinates[0].y = pos4.y2;
-			textureCoordinates[1].x = pos5.x2;
-			textureCoordinates[1].y = pos5.y2;
-			textureCoordinates[2].x = pos6.x2;
-			textureCoordinates[2].y = pos6.y2;
+			textureCoordinates[0].x = (int16)pos4.x2;
+			textureCoordinates[0].y = (int16)pos4.y2;
+			textureCoordinates[1].x = (int16)pos5.x2;
+			textureCoordinates[1].y = (int16)pos5.y2;
+			textureCoordinates[2].x = (int16)pos6.x2;
+			textureCoordinates[2].y = (int16)pos6.y2;
 			_engine->_renderer->renderHolomapVertices(vertexCoordinates, textureCoordinates, holomapImage, holomapImageSize);
 		}
 	}
@@ -290,7 +290,7 @@ void Holomap::drawHolomapText(int32 centerx, int32 top, const char *title) {
 }
 
 void Holomap::renderHolomapPointModel(const IVec3 &angle, int32 x, int32 y) {
-	_engine->_renderer->setBaseRotation(x, y, 0);
+	_engine->_renderer->setAngleCamera(x, y, 0);
 	const IVec3 &destPos = _engine->_renderer->getBaseRotationPosition(0, 0, 1000);
 	_engine->_renderer->setBaseTranslation(0, 0, 0);
 	_engine->_renderer->setBaseRotation(angle);
@@ -340,7 +340,7 @@ void Holomap::drawHolomapTrajectory(int32 trajectoryIndex) {
 	_engine->_interface->resetClip();
 	_engine->_screens->clearScreen();
 
-	loadHolomapGFX();
+	initHoloDatas();
 	_engine->setPalette(_engine->_screens->_paletteRGBACustom);
 
 	ScopedEngineFreeze timeFreeze(_engine);
@@ -455,10 +455,10 @@ void Holomap::renderLocations(int xRot, int yRot, int zRot, bool lower) {
 	for (int locationIdx = 0; locationIdx < NUM_LOCATIONS; ++locationIdx) {
 		if ((_engine->_gameState->_holomapFlags[locationIdx] & HOLOMAP_CAN_FOCUS) || locationIdx == _engine->_scene->_currentSceneIdx) {
 			const Location &loc = _locations[locationIdx];
-			_engine->_renderer->setBaseRotation(loc.angleX, loc.angleY, 0);
+			_engine->_renderer->setAngleCamera(loc.angleX, loc.angleY, 0);
 			const IVec3 &destPos = _engine->_renderer->getBaseRotationPosition(0, 0, loc.size + 1000);
 			const IVec3 &destPos2 = _engine->_renderer->getBaseRotationPosition(0, 0, 1500);
-			_engine->_renderer->setBaseRotation(xRot, yRot, zRot, true);
+			_engine->_renderer->setAngleCamera(xRot, yRot, zRot, true);
 			_engine->_renderer->setBaseRotationPos(0, 0, distance(zDistanceHolomap));
 			const IVec3 &destPos3 = _engine->_renderer->getBaseRotationPosition(destPos);
 			const IVec3 &destPos4 = _engine->_renderer->getBaseRotationPosition(destPos2);
@@ -522,7 +522,7 @@ void Holomap::processHolomap() {
 	_engine->_screens->clearScreen();
 	_engine->_screens->fadeToBlack(_engine->_screens->_paletteRGBA);
 
-	loadHolomapGFX();
+	initHoloDatas();
 
 	_engine->_text->initTextBank(TextBankId::Inventory_Intro_and_Holomap);
 	_engine->_text->setFontCrossColor(COLOR_9);
@@ -614,10 +614,10 @@ void Holomap::processHolomap() {
 			redraw = false;
 			const Common::Rect &rect = _engine->centerOnScreenX(scale(300), 0, scale(330));
 			_engine->_interface->drawFilledRect(rect, COLOR_BLACK);
-			_engine->_renderer->setBaseRotation(xRot, yRot, 0, true);
+			_engine->_renderer->setAngleCamera(xRot, yRot, 0, true);
 			_engine->_renderer->setLightVector(xRot, yRot, 0);
 			renderLocations(xRot, yRot, 0, false);
-			_engine->_renderer->setBaseRotation(xRot, yRot, 0, true);
+			_engine->_renderer->setAngleCamera(xRot, yRot, 0, true);
 			_engine->_renderer->setBaseRotationPos(0, 0, distance(zDistanceHolomap));
 			renderHolomapSurfacePolygons(holomapImagePtr, holomapImageSize);
 			renderLocations(xRot, yRot, 0, true);
diff --git a/engines/twine/holomap.h b/engines/twine/holomap.h
index ccab040bd33..41c41b0fd88 100644
--- a/engines/twine/holomap.h
+++ b/engines/twine/holomap.h
@@ -50,7 +50,7 @@ class Holomap {
 private:
 	TwinEEngine *_engine;
 
-	bool isTriangleVisible(const Vertex *vertices) const;
+	bool isPolygonVisible(const Vertex *vertices) const;
 
 	struct Location {
 		int16 angleX;
@@ -67,13 +67,13 @@ private:
 		int16 z = 0;
 		uint16 projectedPosIdx = 0;
 	};
-	HolomapSort _holomapSort[512];
+	HolomapSort _holomapSort[16 * 32];
 
 	struct HolomapProjectedPos {
-		int16 x1 = 0;
-		int16 y1 = 0;
-		int16 x2 = 0;
-		int16 y2 = 0;
+		uint16 x1 = 0;
+		uint16 y1 = 0;
+		uint16 x2 = 0;
+		uint16 y2 = 0;
 	};
 	HolomapProjectedPos _projectedSurfacePositions[561];
 	int _projectedSurfaceIndex = 0;
@@ -94,9 +94,9 @@ private:
 	 * Renders a holomap path with single path points appearing slowly one after another
 	 */
 	void renderHolomapPointModel(const IVec3 &angle, int32 x, int32 y);
-	void prepareHolomapSurface(Common::SeekableReadStream *holomapSurfaceStream);
-	void prepareHolomapProjectedPositions();
-	void prepareHolomapPolygons();
+	void computeCoorGlobe(Common::SeekableReadStream *holomapSurfaceStream);
+	void computeCoorMapping();
+	void computeGlobeProj();
 	void renderHolomapSurfacePolygons(uint8 *holomapImage, uint32 holomapImageSize);
 	void renderHolomapVehicle(uint &frameNumber, ActorMoveStruct &move, AnimTimerDataStruct &animTimerData, BodyData &bodyData, AnimData &animData);
 
@@ -128,7 +128,7 @@ public:
 	void drawHolomapTrajectory(int32 trajectoryIndex);
 
 	/** Load Holomap content */
-	void loadHolomapGFX();
+	void initHoloDatas();
 
 	/** Main holomap process loop */
 	void processHolomap();
diff --git a/engines/twine/renderer/renderer.cpp b/engines/twine/renderer/renderer.cpp
index aa5f1202e4f..87da96e33bd 100644
--- a/engines/twine/renderer/renderer.cpp
+++ b/engines/twine/renderer/renderer.cpp
@@ -20,6 +20,7 @@
  */
 
 #include "twine/renderer/renderer.h"
+#include "common/util.h"
 #include "twine/menu/interface.h"
 #include "twine/renderer/redraw.h"
 #include "twine/renderer/shadeangletab.h"
@@ -48,12 +49,12 @@ void Renderer::init(int32 w, int32 h) {
 	_polyTabSize = _engine->height() * 6;
 	_polyTab = (int16 *)malloc(_polyTabSize * sizeof(int16));
 	_colorProgressionBuffer = (int16 *)malloc(_polyTabSize * sizeof(int16));
-	_holomap_polytab_1_1 = &_polyTab[_engine->height() * 0];
-	_holomap_polytab_2_1 = &_polyTab[_engine->height() * 1];
-	_holomap_polytab_1_2 = &_polyTab[_engine->height() * 2];
-	_holomap_polytab_2_2 = &_polyTab[_engine->height() * 3];
-	_holomap_polytab_1_3 = &_polyTab[_engine->height() * 4];
-	_holomap_polytab_2_3 = &_polyTab[_engine->height() * 5];
+	_tabVerticG = &_polyTab[_engine->height() * 0];
+	_tabVerticD = &_polyTab[_engine->height() * 1];
+	_tabx0 = &_polyTab[_engine->height() * 2];
+	_tabx1 = &_polyTab[_engine->height() * 3];
+	_taby0 = &_polyTab[_engine->height() * 4];
+	_taby1 = &_polyTab[_engine->height() * 5];
 }
 
 IVec3 &Renderer::projectPositionOnScreen(int32 cX, int32 cY, int32 cZ) { // ProjettePoint
@@ -117,7 +118,7 @@ void Renderer::baseMatrixTranspose() {
 	SWAP(_baseMatrix.row2.z, _baseMatrix.row3.y);
 }
 
-IVec3 Renderer::setBaseRotation(int32 x, int32 y, int32 z, bool transpose) {
+IVec3 Renderer::setAngleCamera(int32 x, int32 y, int32 z, bool transpose) {
 	const double Xradians = (double)((ANGLE_90 - x) % ANGLE_360) * 2 * M_PI / ANGLE_360;
 	const double Yradians = (double)((ANGLE_90 - y) % ANGLE_360) * 2 * M_PI / ANGLE_360;
 	const double Zradians = (double)((ANGLE_90 - z) % ANGLE_360) * 2 * M_PI / ANGLE_360;
@@ -174,7 +175,7 @@ void Renderer::setCameraAngle(int32 transPosX, int32 transPosY, int32 transPosZ,
 	_baseTransPos.y = transPosY;
 	_baseTransPos.z = transPosZ;
 
-	setBaseRotation(rotPosX, rotPosY, rotPosZ);
+	setAngleCamera(rotPosX, rotPosY, rotPosZ);
 
 	_baseRotPos.z += param6;
 
@@ -1917,121 +1918,117 @@ void Renderer::renderInventoryItem(int32 x, int32 y, const BodyData &bodyData, i
 	renderIsoModel(0, 0, 0, ANGLE_0, angle, ANGLE_0, bodyData, dummy);
 }
 
-void Renderer::computeHolomapPolygon(int32 top, int32 x1, int32 bottom, int32 x2, int16 *polygonTabPtr) {
-	int32 minY = bottom;
-	int32 minX = x1;
-	if (top < bottom) {
-		minY = top;
-		top = bottom;
-		minX = x2;
-		x2 = x1;
-	}
-	const uint32 deltaY = top - minY;
-	int16 *currentPolygonTabEntry = &polygonTabPtr[minY];
-	if (minX < x2) {
-		const uint32 deltaX = (x2 - minX) * 0x10000;
-		const uint32 deltaRatio = deltaX / deltaY;
-		uint32 iVar01 = (deltaRatio % deltaY >> 1) + 0x7fffU;
-		for (uint32 y = 0; y <= deltaY; ++y) {
-			if (currentPolygonTabEntry < _polyTab || currentPolygonTabEntry >= _polyTab + _polyTabSize) {
-				currentPolygonTabEntry++;
-				continue;
-			}
-			*currentPolygonTabEntry++ = (int16)x2;
-			x2 -= (deltaRatio >> 0x10);
-			if ((iVar01 & 0xffff0000U) != 0) {
-				x2 += (iVar01 >> 0x10);
-				iVar01 = iVar01 & 0xffffU;
+void Renderer::fillHolomapTriangle(int16 *pDest, int32 x0, int32 y0, int32 x1, int32 y1) {
+	uint32 dx, step, reminder;
+	if (y0 > y1) {
+		SWAP(x0, x1);
+		SWAP(y0, y1);
+	}
+
+	y1 -= y0;
+	pDest += y0;
+
+	if (x0 <= x1) {
+		dx = (x1 - x0) << 16;
+
+		step = dx / y1;
+		reminder = ((dx % y1) >> 1) + 0x7FFF;
+
+		x1 = step >> 16;
+		step &= 0xFFFF;
+
+		for (; y1 >= 0; --y1) {
+			*pDest++ = (int16)x0;
+			x0 += x1;
+			if (reminder & 0xFFFF0000) {
+				x0 += reminder >> 16;
+				reminder &= 0xFFFF;
 			}
-			iVar01 -= (deltaRatio & 0xffffU);
+			reminder += step;
 		}
 	} else {
-		const uint32 deltaX = (minX - x2) * 0x10000;
-		const uint32 deltaRatio = deltaX / deltaY;
-		uint32 iVar01 = (deltaX % deltaY >> 1) + 0x7fffU;
-		for (uint32 y = 0; y <= deltaY; ++y) {
-			if (currentPolygonTabEntry < _polyTab || currentPolygonTabEntry >= _polyTab + _polyTabSize) {
-				currentPolygonTabEntry++;
-				continue;
-			}
-			*currentPolygonTabEntry++ = (int16)x2;
-			x2 += (deltaRatio >> 0x10);
-			if ((iVar01 & 0xffff0000U) != 0) {
-				x2 += (iVar01 >> 0x10);
-				iVar01 = iVar01 & 0xffffU;
+		dx = (x0 - x1) << 16;
+
+		step = dx / y1;
+		reminder = ((dx % y1) >> 1) + 0x7FFF;
+
+		x1 = step >> 16;
+		step &= 0xFFFF;
+
+		for (; y1 >= 0; --y1) {
+			*pDest++ = (int16)x0;
+			x0 -= x1;
+			if (reminder & 0xFFFF0000) {
+				x0 += reminder >> 16;
+				reminder &= 0xFFFF;
 			}
-			iVar01 += (deltaRatio & 0xffffU);
+			reminder -= step;
 		}
 	}
 }
 
-void Renderer::fillHolomapPolygons(const Vertex &vertex1, const Vertex &vertex2, const Vertex &texCoord1, const Vertex &texCoord2, int32 &top, int32 &bottom) {
-	const int32 yBottom = vertex1.y;
-	const int32 yTop = vertex2.y;
-	if (yBottom == yTop) {
-		return;
-	}
+void Renderer::fillHolomapTriangles(const Vertex &vertex0, const Vertex &vertex1, const Vertex &texCoord0, const Vertex &texCoord1, int32 &lymin, int32 &lymax) {
+	const int32 y0 = vertex0.y;
+	const int32 y1 = vertex1.y;
 
-	int16 *polygonTabPtr;
-	if (yBottom < yTop) {
-		if (yBottom < top) {
-			top = yBottom;
+	if (y0 < y1) {
+		if (y0 < lymin) {
+			lymin = y0;
 		}
-		if (bottom < yTop) {
-			bottom = yTop;
+		if (y1 > lymax) {
+			lymax = y1;
 		}
-		computeHolomapPolygon(yTop, vertex2.x, yBottom, vertex1.x, _holomap_polytab_1_1);
-		computeHolomapPolygon(yTop, (uint32)(uint16)texCoord2.x, yBottom, (uint32)(uint16)texCoord1.x, _holomap_polytab_1_2);
-		polygonTabPtr = _holomap_polytab_1_3;
-	} else {
-		if (bottom < yBottom) {
-			bottom = yBottom;
+		fillHolomapTriangle(_tabVerticG, vertex0.x, y0, vertex1.x, y1);
+		fillHolomapTriangle(_tabx0, (int32)(uint16)texCoord0.x, y0, (int32)(uint16)texCoord1.x, y1);
+		fillHolomapTriangle(_taby0, (int32)(uint16)texCoord0.y, y0, (int32)(uint16)texCoord1.y, y1);
+	} else if (y0 > y1) {
+		if (y0 > lymax) {
+			lymax = y0;
 		}
-		if (yTop < top) {
-			top = yTop;
+		if (y1 < lymin) {
+			lymin = y1;
 		}
-		computeHolomapPolygon(yTop, vertex2.x, yBottom, vertex1.x, _holomap_polytab_2_1);
-		computeHolomapPolygon(yTop, (uint32)(uint16)texCoord2.x, yBottom, (uint32)(uint16)texCoord1.x, _holomap_polytab_2_2);
-		polygonTabPtr = _holomap_polytab_2_3;
+		fillHolomapTriangle(_tabVerticD, vertex0.x, y0, vertex1.x, y1);
+		fillHolomapTriangle(_tabx1, (int32)(uint16)texCoord0.x, y0, (int32)(uint16)texCoord1.x, y1);
+		fillHolomapTriangle(_taby1, (int32)(uint16)texCoord0.y, y0, (int32)(uint16)texCoord1.y, y1);
 	}
-	computeHolomapPolygon(yTop, (uint32)(uint16)texCoord2.y, yBottom, (uint32)(uint16)texCoord1.y, polygonTabPtr);
 }
 
 void Renderer::renderHolomapVertices(const Vertex vertexCoordinates[3], const Vertex textureCoordinates[3], uint8 *holomapImage, uint32 holomapImageSize) {
-	int32 top = SCENE_SIZE_MAX;
-	int32 bottom = SCENE_SIZE_MIN;
-	fillHolomapPolygons(vertexCoordinates[0], vertexCoordinates[1], textureCoordinates[0], textureCoordinates[1], top, bottom);
-	fillHolomapPolygons(vertexCoordinates[1], vertexCoordinates[2], textureCoordinates[1], textureCoordinates[2], top, bottom);
-	fillHolomapPolygons(vertexCoordinates[2], vertexCoordinates[0], textureCoordinates[2], textureCoordinates[0], top, bottom);
-	renderHolomapPolygons(top, bottom, holomapImage, holomapImageSize);
+	int32 lymin = SCENE_SIZE_MAX;
+	int32 lymax = SCENE_SIZE_MIN;
+	fillHolomapTriangles(vertexCoordinates[0], vertexCoordinates[1], textureCoordinates[0], textureCoordinates[1], lymin, lymax);
+	fillHolomapTriangles(vertexCoordinates[1], vertexCoordinates[2], textureCoordinates[1], textureCoordinates[2], lymin, lymax);
+	fillHolomapTriangles(vertexCoordinates[2], vertexCoordinates[0], textureCoordinates[2], textureCoordinates[0], lymin, lymax);
+	renderHolomapPolygons(lymin, lymax, holomapImage, holomapImageSize);
 }
 
-void Renderer::renderHolomapPolygons(int32 top, int32 bottom, uint8 *holomapImage, uint32 holomapImageSize) {
-	if (top < 0 || top >= _engine->_frontVideoBuffer.h) {
+void Renderer::renderHolomapPolygons(int32 ymin, int32 ymax, uint8 *holomapImage, uint32 holomapImageSize) {
+	if (ymin < 0 || ymin >= _engine->_frontVideoBuffer.h) {
 		return;
 	}
-	uint8 *screenBufPtr = (uint8 *)_engine->_frontVideoBuffer.getBasePtr(0, top);
+	uint8 *pDestLine = (uint8 *)_engine->_frontVideoBuffer.getBasePtr(0, ymin);
 
-	const int16 *lholomap_polytab_1_1 = _holomap_polytab_1_1 + top;
-	const int16 *lholomap_polytab_2_1 = _holomap_polytab_2_1 + top;
-	const uint16 *lholomap_polytab_1_2 = (const uint16 *)(_holomap_polytab_1_2 + top);
-	const uint16 *lholomap_polytab_1_3 = (const uint16 *)(_holomap_polytab_1_3 + top);
-	const uint16 *lholomap_polytab_2_2 = (const uint16 *)(_holomap_polytab_2_2 + top);
-	const uint16 *lholomap_polytab_2_3 = (const uint16 *)(_holomap_polytab_2_3 + top);
+	const int16 *pVerticG = _tabVerticG + ymin;
+	const int16 *pVerticD = _tabVerticD + ymin;
+	const uint16 *pu0 = (const uint16 *)(_tabx0 + ymin);
+	const uint16 *pv0 = (const uint16 *)(_taby0 + ymin);
+	const uint16 *pu1 = (const uint16 *)(_tabx1 + ymin);
+	const uint16 *pv1 = (const uint16 *)(_taby1 + ymin);
 
-	int32 yHeight = bottom - top;
+	int32 yHeight = ymax - ymin;
 	while (yHeight > -1) {
 		int32 u;
 		int32 v;
-		const int16 left = *lholomap_polytab_1_1++;
-		const int16 right = *lholomap_polytab_2_1++;
-		const uint32 u0 = u = *lholomap_polytab_1_2++;
-		const uint32 v0 = v = *lholomap_polytab_1_3++;
-		const uint32 u1 = *lholomap_polytab_2_2++;
-		const uint32 v1 = *lholomap_polytab_2_3++;
-		const int16 width = right - left;
+		const int16 xmin = *pVerticG++;
+		const int16 xmax = *pVerticD++;
+		const uint32 u0 = u = *pu0++;
+		const uint32 v0 = v = *pv0++;
+		const uint32 u1 = *pu1++;
+		const uint32 v1 = *pv1++;
+		const int16 width = xmax - xmin;
 		if (width > 0) {
-			uint8 *pixelBufPtr = screenBufPtr + left;
+			uint8 *pixelBufPtr = pDestLine + xmin;
 
 			int32 ustep = ((int32)u1 - (int32)u0 + 1) / width;
 			int32 vstep = ((int32)v1 - (int32)v0 + 1) / width;
@@ -2046,7 +2043,7 @@ void Renderer::renderHolomapPolygons(int32 top, int32 bottom, uint8 *holomapImag
 				v += vstep;
 			}
 		}
-		screenBufPtr += _engine->_frontVideoBuffer.pitch;
+		pDestLine += _engine->_frontVideoBuffer.pitch;
 		--yHeight;
 	}
 }
diff --git a/engines/twine/renderer/renderer.h b/engines/twine/renderer/renderer.h
index 97f218b40b3..7849067db70 100644
--- a/engines/twine/renderer/renderer.h
+++ b/engines/twine/renderer/renderer.h
@@ -186,14 +186,14 @@ private:
 	Vertex _clippedPolygonVertices2[128];
 
 	int32 _polyTabSize = 0;
-	int16 *_polyTab = nullptr;
+	int16 *_polyTab = nullptr; // also _tabVerticG
 	int16 *_colorProgressionBuffer = nullptr;
-	int16* _holomap_polytab_1_1 = nullptr;
-	int16* _holomap_polytab_1_2 = nullptr;
-	int16* _holomap_polytab_1_3 = nullptr;
-	int16* _holomap_polytab_2_3 = nullptr;
-	int16* _holomap_polytab_2_2 = nullptr;
-	int16* _holomap_polytab_2_1 = nullptr;
+	int16* _tabVerticG = nullptr;
+	int16* _tabx0 = nullptr; // also TabCoulG
+	int16* _taby0 = nullptr; // also TabCoulD
+	int16* _taby1 = nullptr;
+	int16* _tabx1 = nullptr;
+	int16* _tabVerticD = nullptr;
 
 	bool _isUsingOrthoProjection = false;
 
@@ -217,8 +217,8 @@ private:
 	void baseMatrixTranspose();
 
 	void renderHolomapPolygons(int32 top, int32 bottom, uint8 *holomapImage, uint32 holomapImageSize);
-	void computeHolomapPolygon(int32 y1, int32 x1, int32 y2, int32 x2, int16 *polygonTabPtr);
-	void fillHolomapPolygons(const Vertex &vertex1, const Vertex &vertex2, const Vertex &texCoord1, const Vertex &texCoord2, int32 &top, int32 &bottom);
+	void fillHolomapTriangle(int16 *pDest, int32 x1, int32 y1, int32 x2, int32 y2);
+	void fillHolomapTriangles(const Vertex &vertex1, const Vertex &vertex2, const Vertex &texCoord1, const Vertex &texCoord2, int32 &top, int32 &bottom);
 
 	int16 leftClip(int16 polyRenderType, Vertex** offTabPoly, int32 numVertices);
 	int16 rightClip(int16 polyRenderType, Vertex** offTabPoly, int32 numVertices);
@@ -256,10 +256,10 @@ public:
 	void setCameraAngle(int32 transPosX, int32 transPosY, int32 transPosZ, int32 rotPosX, int32 rotPosY, int32 rotPosZ, int32 param6);
 	IVec3 updateCameraAnglePositions(int zShift = 0);
 	void setBaseTranslation(int32 x, int32 y, int32 z);
-	IVec3 setBaseRotation(int32 x, int32 y, int32 z, bool transpose = false);
+	IVec3 setAngleCamera(int32 x, int32 y, int32 z, bool transpose = false);
 
 	inline IVec3 setBaseRotation(const IVec3 &rot, bool transpose = false) {
-		return setBaseRotation(rot.x, rot.y, rot.z, transpose);
+		return setAngleCamera(rot.x, rot.y, rot.z, transpose);
 	}
 
 	void setOrthoProjection(int32 x, int32 y, int32 z);
diff --git a/engines/twine/scene/gamestate.cpp b/engines/twine/scene/gamestate.cpp
index cf27ec151d8..d38a0515457 100644
--- a/engines/twine/scene/gamestate.cpp
+++ b/engines/twine/scene/gamestate.cpp
@@ -58,7 +58,7 @@ GameState::GameState(TwinEEngine *engine) : _engine(engine) {
 void GameState::initEngineProjections() {
 	_engine->_renderer->setOrthoProjection(_engine->width() / 2 - 9, _engine->height() / 2, 512);
 	_engine->_renderer->setBaseTranslation(0, 0, 0);
-	_engine->_renderer->setBaseRotation(ANGLE_0, ANGLE_0, ANGLE_0);
+	_engine->_renderer->setAngleCamera(ANGLE_0, ANGLE_0, ANGLE_0);
 	_engine->_renderer->setLightVector(_engine->_scene->_alphaLight, _engine->_scene->_betaLight, ANGLE_0);
 }
 


Commit: 215440ee832a891864967938b03c5565164138e7
    https://github.com/scummvm/scummvm/commit/215440ee832a891864967938b03c5565164138e7
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2023-01-15T11:28:57+01:00

Commit Message:
TWINE: renamed members and use isPolygonVisible in preparePolygons

.. as found in the original

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


diff --git a/engines/twine/holomap.cpp b/engines/twine/holomap.cpp
index a43420dc652..859e1fb8802 100644
--- a/engines/twine/holomap.cpp
+++ b/engines/twine/holomap.cpp
@@ -226,23 +226,15 @@ void Holomap::computeGlobeProj() {
 	Common::sort(_holomapSort, _holomapSort + ARRAYSIZE(_holomapSort), [](const HolomapSort &a, const HolomapSort &b) { return a.z < b.z; });
 }
 
-bool Holomap::isPolygonVisible(const Vertex *vertices) const { // TestVuePoly
-	const int32 iVar2 = ((int32)vertices[1].x - (int32)vertices[0].x) *
-						((int32)vertices[0].y - (int32)vertices[2].y);
-	const int32 iVar1 = ((int32)vertices[1].y - (int32)vertices[0].y) *
-						((int32)vertices[0].x - (int32)vertices[2].x);
-	return iVar2 - iVar1 != 0 && iVar1 <= iVar2;
-}
-
 #define SURFACE_POS_OFFSET ((ANGLE_360 / ANGLE_11_25) + 1)
-void Holomap::renderHolomapSurfacePolygons(uint8 *holomapImage, uint32 holomapImageSize) {
+void Holomap::drawHoloMap(uint8 *holomapImage, uint32 holomapImageSize) {
 	computeGlobeProj();
 	for (int32 i = 0; i < ARRAYSIZE(_holomapSort); ++i) {
 		assert(_holomapSort[i].projectedPosIdx + 34 < _projectedSurfaceIndex);
 		const HolomapProjectedPos &pos1 = _projectedSurfacePositions[_holomapSort[i].projectedPosIdx + 0];
 		const HolomapProjectedPos &pos2 = _projectedSurfacePositions[_holomapSort[i].projectedPosIdx + 0 + SURFACE_POS_OFFSET];
 		const HolomapProjectedPos &pos3 = _projectedSurfacePositions[_holomapSort[i].projectedPosIdx + 1];
-		Vertex vertexCoordinates[3];
+		ComputedVertex vertexCoordinates[3];
 		vertexCoordinates[0].x = (int16)pos1.x1;
 		vertexCoordinates[0].y = (int16)pos1.y1;
 		vertexCoordinates[1].x = (int16)pos2.x1;
@@ -250,7 +242,7 @@ void Holomap::renderHolomapSurfacePolygons(uint8 *holomapImage, uint32 holomapIm
 		vertexCoordinates[2].x = (int16)pos3.x1;
 		vertexCoordinates[2].y = (int16)pos3.y1;
 		if (isPolygonVisible(vertexCoordinates)) {
-			Vertex textureCoordinates[3];
+			ComputedVertex textureCoordinates[3];
 			textureCoordinates[0].x = (int16)pos1.x2;
 			textureCoordinates[0].y = (int16)pos1.y2;
 			textureCoordinates[1].x = (int16)pos2.x2;
@@ -269,7 +261,7 @@ void Holomap::renderHolomapSurfacePolygons(uint8 *holomapImage, uint32 holomapIm
 		vertexCoordinates[2].x = (int16)pos6.x1;
 		vertexCoordinates[2].y = (int16)pos6.y1;
 		if (isPolygonVisible(vertexCoordinates)) {
-			Vertex textureCoordinates[3];
+			ComputedVertex textureCoordinates[3];
 			textureCoordinates[0].x = (int16)pos4.x2;
 			textureCoordinates[0].y = (int16)pos4.y2;
 			textureCoordinates[1].x = (int16)pos5.x2;
@@ -289,7 +281,7 @@ void Holomap::drawHolomapText(int32 centerx, int32 top, const char *title) {
 	_engine->_text->drawText(x, y, title);
 }
 
-void Holomap::renderHolomapPointModel(const IVec3 &angle, int32 x, int32 y) {
+void Holomap::drawHoloObj(const IVec3 &angle, int32 x, int32 y) {
 	_engine->_renderer->setAngleCamera(x, y, 0);
 	const IVec3 &destPos = _engine->_renderer->getBaseRotationPosition(0, 0, 1000);
 	_engine->_renderer->setBaseTranslation(0, 0, 0);
@@ -355,10 +347,10 @@ void Holomap::drawHolomapTrajectory(int32 trajectoryIndex) {
 	if (holomapImageSize == 0) {
 		error("Failed to load holomap image");
 	}
-	renderHolomapSurfacePolygons(holomapImagePtr, holomapImageSize);
+	drawHoloMap(holomapImagePtr, holomapImageSize);
 
 	const Location &loc = _locations[data->locationIdx];
-	renderHolomapPointModel(data->pos, loc.angleX, loc.angleY);
+	drawHoloObj(data->pos, loc.angleX, loc.angleY);
 
 	ActorMoveStruct move;
 	AnimTimerDataStruct animTimerData;
@@ -412,7 +404,7 @@ void Holomap::drawHolomapTrajectory(int32 trajectoryIndex) {
 				modelX = loc.angleX;
 				modelY = loc.angleY;
 			}
-			renderHolomapPointModel(data->pos, modelX, modelY);
+			drawHoloObj(data->pos, modelX, modelY);
 			++trajAnimFrameIdx;
 		}
 
@@ -619,7 +611,7 @@ void Holomap::processHolomap() {
 			renderLocations(xRot, yRot, 0, false);
 			_engine->_renderer->setAngleCamera(xRot, yRot, 0, true);
 			_engine->_renderer->setBaseRotationPos(0, 0, distance(zDistanceHolomap));
-			renderHolomapSurfacePolygons(holomapImagePtr, holomapImageSize);
+			drawHoloMap(holomapImagePtr, holomapImageSize);
 			renderLocations(xRot, yRot, 0, true);
 			drawHolomapText(_engine->width() / 2, 25, "HoloMap");
 			if (automove) {
diff --git a/engines/twine/holomap.h b/engines/twine/holomap.h
index 41c41b0fd88..1038f89f59a 100644
--- a/engines/twine/holomap.h
+++ b/engines/twine/holomap.h
@@ -50,8 +50,6 @@ class Holomap {
 private:
 	TwinEEngine *_engine;
 
-	bool isPolygonVisible(const Vertex *vertices) const;
-
 	struct Location {
 		int16 angleX;
 		int16 angleY;
@@ -93,11 +91,11 @@ private:
 	/**
 	 * Renders a holomap path with single path points appearing slowly one after another
 	 */
-	void renderHolomapPointModel(const IVec3 &angle, int32 x, int32 y);
+	void drawHoloObj(const IVec3 &angle, int32 x, int32 y);
 	void computeCoorGlobe(Common::SeekableReadStream *holomapSurfaceStream);
 	void computeCoorMapping();
 	void computeGlobeProj();
-	void renderHolomapSurfacePolygons(uint8 *holomapImage, uint32 holomapImageSize);
+	void drawHoloMap(uint8 *holomapImage, uint32 holomapImageSize);
 	void renderHolomapVehicle(uint &frameNumber, ActorMoveStruct &move, AnimTimerDataStruct &animTimerData, BodyData &bodyData, AnimData &animData);
 
 	/**
diff --git a/engines/twine/renderer/renderer.cpp b/engines/twine/renderer/renderer.cpp
index 87da96e33bd..c05b9711ff2 100644
--- a/engines/twine/renderer/renderer.cpp
+++ b/engines/twine/renderer/renderer.cpp
@@ -287,12 +287,21 @@ void Renderer::applyRotation(IMatrix3x3 *targetMatrix, const IMatrix3x3 *current
 	}
 }
 
+bool isPolygonVisible(const ComputedVertex *vertices) { // TestVuePoly
+	const int32 a = ((int32)vertices[0].y - (int32)vertices[2].y) * ((int32)vertices[1].x - (int32)vertices[0].x);
+	const int32 b = ((int32)vertices[1].y - (int32)vertices[0].y) * ((int32)vertices[0].x - (int32)vertices[2].x);
+	if (a <= b) {
+		return false;
+	}
+	return true;
+}
+
 void Renderer::applyPointsRotation(const Common::Array<BodyVertex> &vertices, int32 firstPoint, int32 numPoints, I16Vec3 *destPoints, const IMatrix3x3 *rotationMatrix, const IVec3 &destPos) {
 	for (int32 i = 0; i < numPoints; ++i) {
 		const BodyVertex &vertex = vertices[i + firstPoint];
-		destPoints->x = ((rotationMatrix->row1.x * vertex.x + rotationMatrix->row1.y * vertex.y + rotationMatrix->row1.z * vertex.z) / SCENE_SIZE_HALF) + destPos.x;
-		destPoints->y = ((rotationMatrix->row2.x * vertex.x + rotationMatrix->row2.y * vertex.y + rotationMatrix->row2.z * vertex.z) / SCENE_SIZE_HALF) + destPos.y;
-		destPoints->z = ((rotationMatrix->row3.x * vertex.x + rotationMatrix->row3.y * vertex.y + rotationMatrix->row3.z * vertex.z) / SCENE_SIZE_HALF) + destPos.z;
+		destPoints->x = (int16)((rotationMatrix->row1.x * vertex.x + rotationMatrix->row1.y * vertex.y + rotationMatrix->row1.z * vertex.z) / SCENE_SIZE_HALF) + destPos.x;
+		destPoints->y = (int16)((rotationMatrix->row2.x * vertex.x + rotationMatrix->row2.y * vertex.y + rotationMatrix->row2.z * vertex.z) / SCENE_SIZE_HALF) + destPos.y;
+		destPoints->z = (int16)((rotationMatrix->row3.x * vertex.x + rotationMatrix->row3.y * vertex.y + rotationMatrix->row3.z * vertex.z) / SCENE_SIZE_HALF) + destPos.z;
 
 		destPoints++;
 	}
@@ -378,10 +387,10 @@ static FORCEINLINE int16 clamp(int16 x, int16 a, int16 b) {
 	return x < a ? a : (x > b ? b : x);
 }
 
-int16 Renderer::leftClip(int16 polyRenderType, Vertex** offTabPoly, int32 numVertices) {
+int16 Renderer::leftClip(int16 polyRenderType, ComputedVertex** offTabPoly, int32 numVertices) {
 	const Common::Rect &clip = _engine->_interface->_clip;
-	Vertex *pTabPolyClip = offTabPoly[1];
-	Vertex *pTabPoly = offTabPoly[0];
+	ComputedVertex *pTabPolyClip = offTabPoly[1];
+	ComputedVertex *pTabPoly = offTabPoly[0];
 	int16 newNbPoints = 0;
 
 	// invert the pointers to continue on the clipped vertices in the next method
@@ -389,8 +398,8 @@ int16 Renderer::leftClip(int16 polyRenderType, Vertex** offTabPoly, int32 numVer
 	offTabPoly[1] = pTabPoly;
 
 	for (; numVertices > 0; --numVertices, pTabPoly++) {
-		const Vertex *p0 = pTabPoly;
-		const Vertex *p1 = p0 + 1;
+		const ComputedVertex *p0 = pTabPoly;
+		const ComputedVertex *p1 = p0 + 1;
 
 		// clipFlag :
 		// 0x00 : none clipped
@@ -425,7 +434,7 @@ int16 Renderer::leftClip(int16 polyRenderType, Vertex** offTabPoly, int32 numVer
 			pTabPolyClip->x = (int16)clip.left;
 
 			if (polyRenderType >= POLYGONTYPE_GOURAUD) {
-				pTabPolyClip->colorIndex = (int16)(p0->colorIndex + (((p1->colorIndex - p0->colorIndex) * dxClip) / dx));
+				pTabPolyClip->intensity = (int16)(p0->intensity + (((p1->intensity - p0->intensity) * dxClip) / dx));
 			}
 
 			++pTabPolyClip;
@@ -438,10 +447,10 @@ int16 Renderer::leftClip(int16 polyRenderType, Vertex** offTabPoly, int32 numVer
 	return newNbPoints;
 }
 
-int16 Renderer::rightClip(int16 polyRenderType, Vertex** offTabPoly, int32 numVertices) {
+int16 Renderer::rightClip(int16 polyRenderType, ComputedVertex** offTabPoly, int32 numVertices) {
 	const Common::Rect &clip = _engine->_interface->_clip;
-	Vertex *pTabPolyClip = offTabPoly[1];
-	Vertex *pTabPoly = offTabPoly[0];
+	ComputedVertex *pTabPolyClip = offTabPoly[1];
+	ComputedVertex *pTabPoly = offTabPoly[0];
 	int16 newNbPoints = 0;
 
 	// invert the pointers to continue on the clipped vertices in the next method
@@ -449,8 +458,8 @@ int16 Renderer::rightClip(int16 polyRenderType, Vertex** offTabPoly, int32 numVe
 	offTabPoly[1] = pTabPoly;
 
 	for (; numVertices > 0; --numVertices, pTabPoly++) {
-		const Vertex *p0 = pTabPoly;
-		const Vertex *p1 = p0 + 1;
+		const ComputedVertex *p0 = pTabPoly;
+		const ComputedVertex *p1 = p0 + 1;
 
 		// clipFlag :
 		// 0x00 : none clipped
@@ -485,7 +494,7 @@ int16 Renderer::rightClip(int16 polyRenderType, Vertex** offTabPoly, int32 numVe
 			pTabPolyClip->x = (int16)clip.right;
 
 			if (polyRenderType >= POLYGONTYPE_GOURAUD) {
-				pTabPolyClip->colorIndex = (int16)(p0->colorIndex + (((p1->colorIndex - p0->colorIndex) * dxClip) / dx));
+				pTabPolyClip->intensity = (int16)(p0->intensity + (((p1->intensity - p0->intensity) * dxClip) / dx));
 			}
 
 			++pTabPolyClip;
@@ -498,10 +507,10 @@ int16 Renderer::rightClip(int16 polyRenderType, Vertex** offTabPoly, int32 numVe
 	return newNbPoints;
 }
 
-int16 Renderer::topClip(int16 polyRenderType, Vertex** offTabPoly, int32 numVertices) {
+int16 Renderer::topClip(int16 polyRenderType, ComputedVertex** offTabPoly, int32 numVertices) {
 	const Common::Rect &clip = _engine->_interface->_clip;
-	Vertex *pTabPolyClip = offTabPoly[1];
-	Vertex *pTabPoly = offTabPoly[0];
+	ComputedVertex *pTabPolyClip = offTabPoly[1];
+	ComputedVertex *pTabPoly = offTabPoly[0];
 	int16 newNbPoints = 0;
 
 	// invert the pointers to continue on the clipped vertices in the next method
@@ -509,8 +518,8 @@ int16 Renderer::topClip(int16 polyRenderType, Vertex** offTabPoly, int32 numVert
 	offTabPoly[1] = pTabPoly;
 
 	for (; numVertices > 0; --numVertices, pTabPoly++) {
-		const Vertex *p0 = pTabPoly;
-		const Vertex *p1 = p0 + 1;
+		const ComputedVertex *p0 = pTabPoly;
+		const ComputedVertex *p1 = p0 + 1;
 
 		// clipFlag :
 		// 0x00 : none clipped
@@ -545,7 +554,7 @@ int16 Renderer::topClip(int16 polyRenderType, Vertex** offTabPoly, int32 numVert
 			pTabPolyClip->y = (int16)clip.top;
 
 			if (polyRenderType >= POLYGONTYPE_GOURAUD) {
-				pTabPolyClip->colorIndex = (int16)(p0->colorIndex + (((p1->colorIndex - p0->colorIndex) * dyClip) / dy));
+				pTabPolyClip->intensity = (int16)(p0->intensity + (((p1->intensity - p0->intensity) * dyClip) / dy));
 			}
 
 			++pTabPolyClip;
@@ -558,10 +567,10 @@ int16 Renderer::topClip(int16 polyRenderType, Vertex** offTabPoly, int32 numVert
 	return newNbPoints;
 }
 
-int16 Renderer::bottomClip(int16 polyRenderType, Vertex** offTabPoly, int32 numVertices) {
+int16 Renderer::bottomClip(int16 polyRenderType, ComputedVertex** offTabPoly, int32 numVertices) {
 	const Common::Rect &clip = _engine->_interface->_clip;
-	Vertex *pTabPolyClip = offTabPoly[1];
-	Vertex *pTabPoly = offTabPoly[0];
+	ComputedVertex *pTabPolyClip = offTabPoly[1];
+	ComputedVertex *pTabPoly = offTabPoly[0];
 	int16 newNbPoints = 0;
 
 	// invert the pointers to continue on the clipped vertices in the next method
@@ -569,8 +578,8 @@ int16 Renderer::bottomClip(int16 polyRenderType, Vertex** offTabPoly, int32 numV
 	offTabPoly[1] = pTabPoly;
 
 	for (; numVertices > 0; --numVertices, pTabPoly++) {
-		const Vertex *p0 = pTabPoly;
-		const Vertex *p1 = p0 + 1;
+		const ComputedVertex *p0 = pTabPoly;
+		const ComputedVertex *p1 = p0 + 1;
 
 		// clipFlag :
 		// 0x00 : none clipped
@@ -605,7 +614,7 @@ int16 Renderer::bottomClip(int16 polyRenderType, Vertex** offTabPoly, int32 numV
 			pTabPolyClip->y = (int16)clip.bottom;
 
 			if (polyRenderType >= POLYGONTYPE_GOURAUD) {
-				pTabPolyClip->colorIndex = (int16)(p0->colorIndex + (((p1->colorIndex - p0->colorIndex) * dyClip) / dy));
+				pTabPolyClip->intensity = (int16)(p0->intensity + (((p1->intensity - p0->intensity) * dyClip) / dy));
 			}
 
 			++pTabPolyClip;
@@ -618,7 +627,7 @@ int16 Renderer::bottomClip(int16 polyRenderType, Vertex** offTabPoly, int32 numV
 	return newNbPoints;
 }
 
-int32 Renderer::computePolyMinMax(int16 polyRenderType, Vertex **offTabPoly, int32 numVertices) {
+int32 Renderer::computePolyMinMax(int16 polyRenderType, ComputedVertex **offTabPoly, int32 numVertices) {
 	const Common::Rect &clip = _engine->_interface->_clip;
 	if (clip.isEmpty()) {
 		return numVertices;
@@ -629,7 +638,7 @@ int32 Renderer::computePolyMinMax(int16 polyRenderType, Vertex **offTabPoly, int
 	int32 minsy = SCENE_SIZE_MAX;
 	int32 maxsy = SCENE_SIZE_MIN;
 
-	Vertex* pTabPoly = offTabPoly[0];
+	ComputedVertex* pTabPoly = offTabPoly[0];
 	for (int32 i = 0; i < numVertices; i++) {
 		if (pTabPoly[i].x < minsx) {
 			minsx = pTabPoly[i].x;
@@ -714,7 +723,7 @@ int32 Renderer::computePolyMinMax(int16 polyRenderType, Vertex **offTabPoly, int
 	return clippedNumVertices;
 }
 
-bool Renderer::computePoly(int16 polyRenderType, const Vertex *vertices, int32 numVertices) {
+bool Renderer::computePoly(int16 polyRenderType, const ComputedVertex *vertices, int32 numVertices) {
 	const int16 *polyTabBegin = _polyTab;
 	const int16 *polyTabEnd = &_polyTab[_polyTabSize - 1];
 	const int16 *colProgressBufStart = _colorProgressionBuffer;
@@ -726,15 +735,15 @@ bool Renderer::computePoly(int16 polyRenderType, const Vertex *vertices, int32 n
 		_clippedPolygonVertices1[i] = vertices[i];
 	}
 
-	Vertex *offTabPoly[] = {_clippedPolygonVertices1, _clippedPolygonVertices2};
+	ComputedVertex *offTabPoly[] = {_clippedPolygonVertices1, _clippedPolygonVertices2};
 
 	numVertices = computePolyMinMax(polyRenderType, offTabPoly, numVertices);
 	if (numVertices == 0) {
 		return false;
 	}
 
-	const Vertex *clippedVertices = offTabPoly[0];
-	uint8 vertexParam1 = clippedVertices[numVertices - 1].colorIndex;
+	const ComputedVertex *clippedVertices = offTabPoly[0];
+	uint8 vertexParam1 = clippedVertices[numVertices - 1].intensity;
 	int16 currentVertexX = clippedVertices[numVertices - 1].x;
 	int16 currentVertexY = clippedVertices[numVertices - 1].y;
 
@@ -743,7 +752,7 @@ bool Renderer::computePoly(int16 polyRenderType, const Vertex *vertices, int32 n
 		const int16 oldVertexX = currentVertexX;
 		const uint8 oldVertexParam = vertexParam1;
 
-		vertexParam1 = clippedVertices[nVertex].colorIndex;
+		vertexParam1 = clippedVertices[nVertex].intensity;
 		const uint8 vertexParam2 = vertexParam1;
 		currentVertexX = clippedVertices[nVertex].x;
 		currentVertexY = clippedVertices[nVertex].y;
@@ -1299,7 +1308,7 @@ void Renderer::renderPolygonsSimplified(int vtop, int32 vsize, uint16 color) con
 	}
 }
 
-void Renderer::renderPolygons(const CmdRenderPolygon &polygon, Vertex *vertices, int vtop, int vbottom) {
+void Renderer::renderPolygons(const CmdRenderPolygon &polygon, ComputedVertex *vertices, int vtop, int vbottom) {
 	if (computePoly(polygon.renderType, vertices, polygon.numVertices)) {
 		const int32 vsize = vbottom - vtop + 1;
 		fillVertices(vtop, vsize, polygon.renderType, polygon.colorIndex);
@@ -1504,7 +1513,7 @@ uint8 *Renderer::preparePolygons(const Common::Array<BodyPolygon> &polygons, int
 		assert(numVertices <= 16);
 		const int16 colorIndex = polygon.color;
 
-		int16 bestDepth = -32000;
+		int16 zMax = -32000;
 
 		CmdRenderPolygon *destinationPolygon = (CmdRenderPolygon *)renderBufferPtr;
 		destinationPolygon->numVertices = numVertices;
@@ -1513,10 +1522,10 @@ uint8 *Renderer::preparePolygons(const Common::Array<BodyPolygon> &polygons, int
 
 		renderBufferPtr += sizeof(CmdRenderPolygon);
 
-		Vertex *const vertices = (Vertex *)renderBufferPtr;
-		renderBufferPtr += destinationPolygon->numVertices * sizeof(Vertex);
+		ComputedVertex *const vertices = (ComputedVertex *)renderBufferPtr;
+		renderBufferPtr += destinationPolygon->numVertices * sizeof(ComputedVertex);
 
-		Vertex *vertex = vertices;
+		ComputedVertex *vertex = vertices;
 
 		if (materialType >= MAT_GOURAUD) {
 			destinationPolygon->renderType = polygon.materialType - (MAT_GOURAUD - POLYGONTYPE_GOURAUD);
@@ -1528,12 +1537,12 @@ uint8 *Renderer::preparePolygons(const Common::Array<BodyPolygon> &polygons, int
 				const int16 vertexIndex = polygon.indices[idx];
 				const I16Vec3 *point = &modelData->flattenPoints[vertexIndex];
 
-				vertex->colorIndex = shadeValue;
+				vertex->intensity = shadeValue;
 				vertex->x = clamp(point->x, 0, maxWidth);
 				vertex->y = clamp(point->y, 0, maxHeight);
 				destinationPolygon->top = MIN<int>(destinationPolygon->top, vertex->y);
 				destinationPolygon->bottom = MAX<int>(destinationPolygon->bottom, vertex->y);
-				bestDepth = MAX(bestDepth, point->z);
+				zMax = MAX(zMax, point->z);
 				++vertex;
 			}
 		} else {
@@ -1553,19 +1562,24 @@ uint8 *Renderer::preparePolygons(const Common::Array<BodyPolygon> &polygons, int
 				const int16 vertexIndex = polygon.indices[idx];
 				const I16Vec3 *point = &modelData->flattenPoints[vertexIndex];
 
-				vertex->colorIndex = destinationPolygon->colorIndex;
+				vertex->intensity = destinationPolygon->colorIndex;
 				vertex->x = clamp(point->x, 0, maxWidth);
 				vertex->y = clamp(point->y, 0, maxHeight);
 				destinationPolygon->top = MIN<int>(destinationPolygon->top, vertex->y);
 				destinationPolygon->bottom = MAX<int>(destinationPolygon->bottom, vertex->y);
-				bestDepth = MAX(bestDepth, point->z);
+				zMax = MAX(zMax, point->z);
 				++vertex;
 			}
 		}
 
+		if (!isPolygonVisible(vertices)) {
+			renderBufferPtr = (uint8 *)destinationPolygon;
+			continue;
+		}
+
 		numOfPrimitives++;
 
-		(*renderCmds)->depth = bestDepth;
+		(*renderCmds)->depth = zMax;
 		(*renderCmds)->renderType = RENDERTYPE_DRAWPOLYGON;
 		(*renderCmds)->dataPtr = (uint8 *)destinationPolygon;
 		(*renderCmds)++;
@@ -1608,7 +1622,7 @@ bool Renderer::renderModelElements(int32 numOfPrimitives, const BodyData &bodyDa
 		}
 		case RENDERTYPE_DRAWPOLYGON: {
 			const CmdRenderPolygon *header = (const CmdRenderPolygon *)pointer;
-			Vertex *vertices = (Vertex *)(pointer + sizeof(CmdRenderPolygon));
+			ComputedVertex *vertices = (ComputedVertex *)(pointer + sizeof(CmdRenderPolygon));
 			renderPolygons(*header, vertices, header->top, header->bottom);
 			break;
 		}
@@ -1967,7 +1981,7 @@ void Renderer::fillHolomapTriangle(int16 *pDest, int32 x0, int32 y0, int32 x1, i
 	}
 }
 
-void Renderer::fillHolomapTriangles(const Vertex &vertex0, const Vertex &vertex1, const Vertex &texCoord0, const Vertex &texCoord1, int32 &lymin, int32 &lymax) {
+void Renderer::fillHolomapTriangles(const ComputedVertex &vertex0, const ComputedVertex &vertex1, const ComputedVertex &texCoord0, const ComputedVertex &texCoord1, int32 &lymin, int32 &lymax) {
 	const int32 y0 = vertex0.y;
 	const int32 y1 = vertex1.y;
 
@@ -1994,7 +2008,7 @@ void Renderer::fillHolomapTriangles(const Vertex &vertex0, const Vertex &vertex1
 	}
 }
 
-void Renderer::renderHolomapVertices(const Vertex vertexCoordinates[3], const Vertex textureCoordinates[3], uint8 *holomapImage, uint32 holomapImageSize) {
+void Renderer::renderHolomapVertices(const ComputedVertex vertexCoordinates[3], const ComputedVertex textureCoordinates[3], uint8 *holomapImage, uint32 holomapImageSize) {
 	int32 lymin = SCENE_SIZE_MAX;
 	int32 lymax = SCENE_SIZE_MIN;
 	fillHolomapTriangles(vertexCoordinates[0], vertexCoordinates[1], textureCoordinates[0], textureCoordinates[1], lymin, lymax);
diff --git a/engines/twine/renderer/renderer.h b/engines/twine/renderer/renderer.h
index 7849067db70..6d712e99fcc 100644
--- a/engines/twine/renderer/renderer.h
+++ b/engines/twine/renderer/renderer.h
@@ -57,12 +57,14 @@ namespace TwinE {
 class BodyData;
 class TwinEEngine;
 
-struct Vertex {
-	int16 colorIndex = 0;
+struct ComputedVertex {
+	int16 intensity = 0;
 	int16 x = 0;
 	int16 y = 0;
 };
 
+bool isPolygonVisible(const ComputedVertex *vertices);
+
 struct CmdRenderPolygon {
 	uint8 renderType = 0;
 	uint8 numVertices = 0;
@@ -182,8 +184,8 @@ private:
 	 * that is needed to render the primitive.
 	 */
 	uint8 _renderCoordinatesBuffer[10000]{0};
-	Vertex _clippedPolygonVertices1[128];
-	Vertex _clippedPolygonVertices2[128];
+	ComputedVertex _clippedPolygonVertices1[128];
+	ComputedVertex _clippedPolygonVertices2[128];
 
 	int32 _polyTabSize = 0;
 	int16 *_polyTab = nullptr; // also _tabVerticG
@@ -207,7 +209,7 @@ private:
 	void renderPolygonsDither(int vtop, int32 vsize) const;
 	void renderPolygonsMarble(int vtop, int32 vsize, uint16 color) const;
 	void renderPolygonsSimplified(int vtop, int32 vsize, uint16 color) const;
-	bool computePoly(int16 polyRenderType, const Vertex *vertices, int32 numVertices);
+	bool computePoly(int16 polyRenderType, const ComputedVertex *vertices, int32 numVertices);
 
 	const RenderCommand *depthSortRenderCommands(int32 numOfPrimitives);
 	uint8 *preparePolygons(const Common::Array<BodyPolygon>& polygons, int32 &numOfPrimitives, RenderCommand **renderCmds, uint8 *renderBufferPtr, ModelData *modelData);
@@ -218,13 +220,13 @@ private:
 
 	void renderHolomapPolygons(int32 top, int32 bottom, uint8 *holomapImage, uint32 holomapImageSize);
 	void fillHolomapTriangle(int16 *pDest, int32 x1, int32 y1, int32 x2, int32 y2);
-	void fillHolomapTriangles(const Vertex &vertex1, const Vertex &vertex2, const Vertex &texCoord1, const Vertex &texCoord2, int32 &top, int32 &bottom);
+	void fillHolomapTriangles(const ComputedVertex &vertex1, const ComputedVertex &vertex2, const ComputedVertex &texCoord1, const ComputedVertex &texCoord2, int32 &top, int32 &bottom);
 
-	int16 leftClip(int16 polyRenderType, Vertex** offTabPoly, int32 numVertices);
-	int16 rightClip(int16 polyRenderType, Vertex** offTabPoly, int32 numVertices);
-	int16 topClip(int16 polyRenderType, Vertex** offTabPoly, int32 numVertices);
-	int16 bottomClip(int16 polyRenderType, Vertex** offTabPoly, int32 numVertices);
-	int32 computePolyMinMax(int16 polyRenderType, Vertex **offTabPoly, int32 numVertices);
+	int16 leftClip(int16 polyRenderType, ComputedVertex** offTabPoly, int32 numVertices);
+	int16 rightClip(int16 polyRenderType, ComputedVertex** offTabPoly, int32 numVertices);
+	int16 topClip(int16 polyRenderType, ComputedVertex** offTabPoly, int32 numVertices);
+	int16 bottomClip(int16 polyRenderType, ComputedVertex** offTabPoly, int32 numVertices);
+	int32 computePolyMinMax(int16 polyRenderType, ComputedVertex **offTabPoly, int32 numVertices);
 public:
 	Renderer(TwinEEngine *engine);
 	~Renderer();
@@ -244,7 +246,7 @@ public:
 	}
 
 	void fillVertices(int vtop, int32 vsize, uint8 renderType, uint16 color);
-	void renderPolygons(const CmdRenderPolygon &polygon, Vertex *vertices, int vtop, int vbottom);
+	void renderPolygons(const CmdRenderPolygon &polygon, ComputedVertex *vertices, int vtop, int vbottom);
 
 	inline IVec3 &projectPositionOnScreen(const IVec3& pos) { // ProjettePoint
 		return projectPositionOnScreen(pos.x, pos.y, pos.z);
@@ -281,7 +283,7 @@ public:
 
 	void renderInventoryItem(int32 x, int32 y, const BodyData &bodyData, int32 angle, int32 param);
 
-	void renderHolomapVertices(const Vertex vertexCoordinates[3], const Vertex textureCoordinates[3], uint8 *holomapImage, uint32 holomapImageSize);
+	void renderHolomapVertices(const ComputedVertex vertexCoordinates[3], const ComputedVertex textureCoordinates[3], uint8 *holomapImage, uint32 holomapImageSize);
 };
 
 inline void Renderer::setBaseRotationPos(int32 x, int32 y, int32 z) {
diff --git a/engines/twine/text.cpp b/engines/twine/text.cpp
index 2bd96ad4339..3e2ec927495 100644
--- a/engines/twine/text.cpp
+++ b/engines/twine/text.cpp
@@ -467,17 +467,17 @@ void Text::renderContinueReadingTriangle() {
 	const int32 top = _dialTextBox.bottom - (size + border);
 	const int32 bottom = _dialTextBox.bottom - border;
 
-	Vertex vertices[3];
+	ComputedVertex vertices[3];
 
-	vertices[0].colorIndex = color;
+	vertices[0].intensity = color;
 	vertices[0].x = right;
 	vertices[0].y = top;
 
-	vertices[1].colorIndex = color;
+	vertices[1].intensity = color;
 	vertices[1].x = left;
 	vertices[1].y = bottom;
 
-	vertices[2].colorIndex = color;
+	vertices[2].intensity = color;
 	vertices[2].x = right;
 	vertices[2].y = bottom;
 


Commit: 5059a77b431f8c9857dbbf8e9126ca0b06ed9720
    https://github.com/scummvm/scummvm/commit/5059a77b431f8c9857dbbf8e9126ca0b06ed9720
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2023-01-15T11:28:57+01:00

Commit Message:
TWINE: renamed and removed members

Changed paths:
    engines/twine/parser/body.cpp
    engines/twine/parser/body.h
    engines/twine/parser/bodytypes.h
    engines/twine/renderer/renderer.cpp
    engines/twine/renderer/renderer.h


diff --git a/engines/twine/parser/body.cpp b/engines/twine/parser/body.cpp
index 6ad0c3550ce..9417cb2dbe7 100644
--- a/engines/twine/parser/body.cpp
+++ b/engines/twine/parser/body.cpp
@@ -28,7 +28,7 @@ namespace TwinE {
 void BodyData::reset() {
 	_vertices.clear();
 	_bones.clear();
-	_shades.clear();
+	_normals.clear();
 	_polygons.clear();
 	_spheres.clear();
 	_lines.clear();
@@ -66,7 +66,7 @@ void BodyData::loadBones(Common::SeekableReadStream &stream) {
 		boneframe.y = stream.readSint16LE();
 		boneframe.z = stream.readSint16LE();
 		/*int16 unk1 =*/ stream.readSint16LE();
-		const int16 numOfShades = stream.readSint16LE();
+		const int16 numNormals = stream.readSint16LE();
 		/*int16 unk2 =*/ stream.readSint16LE();
 		/*int32 field_18 =*/ stream.readSint32LE();
 		/*int32 y =*/ stream.readSint32LE();
@@ -79,7 +79,7 @@ void BodyData::loadBones(Common::SeekableReadStream &stream) {
 		bone.firstVertex = firstPoint;
 		bone.numVertices = numPoints;
 		bone.initalBoneState = boneframe;
-		bone.numOfShades = numOfShades;
+		bone.numNormals = numNormals;
 
 		// assign the bone index to the vertices
 		for (int j = 0; j < numPoints; ++j) {
@@ -91,19 +91,19 @@ void BodyData::loadBones(Common::SeekableReadStream &stream) {
 	}
 }
 
-void BodyData::loadShades(Common::SeekableReadStream &stream) {
-	const uint16 numShades = stream.readUint16LE();
+void BodyData::loadNormals(Common::SeekableReadStream &stream) {
+	const uint16 numNormals = stream.readUint16LE();
 	if (stream.eos())
 		return;
 
-	_shades.reserve(numShades);
-	for (uint16 i = 0; i < numShades; ++i) {
-		BodyShade shape;
-		shape.col1 = stream.readSint16LE();
-		shape.col2 = stream.readSint16LE();
-		shape.col3 = stream.readSint16LE();
-		shape.unk4 = stream.readUint16LE();
-		_shades.push_back(shape);
+	_normals.reserve(numNormals);
+	for (uint16 i = 0; i < numNormals; ++i) {
+		BodyNormal shape;
+		shape.x = stream.readSint16LE();
+		shape.y = stream.readSint16LE();
+		shape.z = stream.readSint16LE();
+		shape.prenormalizedRange = stream.readUint16LE();
+		_normals.push_back(shape);
 	}
 }
 
@@ -118,21 +118,22 @@ void BodyData::loadPolygons(Common::SeekableReadStream &stream) {
 		poly.materialType = stream.readByte();
 		const uint8 numVertices = stream.readByte();
 
-		poly.color = stream.readSint16LE();
-		int16 intensity = -1;
+		poly.intensity = stream.readSint16LE();
+		int16 normal = -1;
 		if (poly.materialType == MAT_FLAT || poly.materialType == MAT_GRANIT) {
-			intensity = stream.readSint16LE();
+			// only one shade value is used
+			normal = stream.readSint16LE();
 		}
 
 		poly.indices.reserve(numVertices);
-		poly.intensities.reserve(numVertices);
+		poly.normals.reserve(numVertices);
 		for (int k = 0; k < numVertices; ++k) {
 			if (poly.materialType >= MAT_GOURAUD) {
-				intensity = stream.readSint16LE();
+				normal = stream.readSint16LE();
 			}
 			const uint16 vertexIndex = stream.readUint16LE() / 6;
 			poly.indices.push_back(vertexIndex);
-			poly.intensities.push_back(intensity);
+			poly.normals.push_back(normal);
 		}
 
 		_polygons.push_back(poly);
@@ -185,10 +186,12 @@ bool BodyData::loadFromStream(Common::SeekableReadStream &stream, bool lba1) {
 		bbox.mins.z = stream.readSint16LE();
 		bbox.maxs.z = stream.readSint16LE();
 
-		stream.seek(0x1A);
+		const uint16 offset = stream.readUint16LE();
+		stream.skip(offset);
+
 		loadVertices(stream);
 		loadBones(stream);
-		loadShades(stream);
+		loadNormals(stream);
 		loadPolygons(stream);
 		loadLines(stream);
 		loadSpheres(stream);
diff --git a/engines/twine/parser/body.h b/engines/twine/parser/body.h
index b074ecffdce..76b10c7d49e 100644
--- a/engines/twine/parser/body.h
+++ b/engines/twine/parser/body.h
@@ -36,7 +36,7 @@ class BodyData : public Parser {
 private:
 	void loadVertices(Common::SeekableReadStream &stream);
 	void loadBones(Common::SeekableReadStream &stream);
-	void loadShades(Common::SeekableReadStream &stream);
+	void loadNormals(Common::SeekableReadStream &stream);
 	void loadPolygons(Common::SeekableReadStream &stream);
 	void loadLines(Common::SeekableReadStream &stream);
 	void loadSpheres(Common::SeekableReadStream &stream);
@@ -44,7 +44,7 @@ private:
 	Common::Array<BodyPolygon> _polygons;
 	Common::Array<BodyVertex> _vertices;
 	Common::Array<BodySphere> _spheres;
-	Common::Array<BodyShade> _shades;
+	Common::Array<BodyNormal> _normals;
 	Common::Array<BodyLine> _lines;
 	Common::Array<BodyBone> _bones;
 
@@ -91,12 +91,12 @@ public:
 		return _spheres;
 	}
 
-	const Common::Array<BodyShade> &getShades() const {
-		return _shades;
+	const Common::Array<BodyNormal> &getNormals() const {
+		return _normals;
 	}
 
-	const BodyShade &getShade(int16 shadeIdx) const {
-		return _shades[shadeIdx];
+	const BodyNormal &getNormal(int16 normalIdx) const {
+		return _normals[normalIdx];
 	}
 
 	const Common::Array<BodyLine> &getLines() const {
diff --git a/engines/twine/parser/bodytypes.h b/engines/twine/parser/bodytypes.h
index 5afc9ae4bf7..26dc42e84bc 100644
--- a/engines/twine/parser/bodytypes.h
+++ b/engines/twine/parser/bodytypes.h
@@ -56,7 +56,7 @@ struct BodyBone {
 	uint16 vertex;
 	int16 firstVertex;
 	int16 numVertices;
-	int32 numOfShades;
+	int32 numNormals;
 	BoneFrame initalBoneState;
 
 	inline bool isRoot() const {
@@ -64,18 +64,18 @@ struct BodyBone {
 	}
 };
 
-struct BodyShade {
-	int16 col1;
-	int16 col2;
-	int16 col3;
-	uint16 unk4;
+struct BodyNormal {
+	int16 x;
+	int16 y;
+	int16 z;
+	uint16 prenormalizedRange;
 };
 
 struct BodyPolygon {
 	Common::Array<uint16> indices;
-	Common::Array<uint16> intensities;
+	Common::Array<uint16> normals;
 	int8 materialType = 0;
-	int16 color = 0;
+	int16 intensity = 0; // color1 / color2
 };
 
 }
diff --git a/engines/twine/renderer/renderer.cpp b/engines/twine/renderer/renderer.cpp
index c05b9711ff2..bde61ed24e8 100644
--- a/engines/twine/renderer/renderer.cpp
+++ b/engines/twine/renderer/renderer.cpp
@@ -58,9 +58,9 @@ void Renderer::init(int32 w, int32 h) {
 }
 
 IVec3 &Renderer::projectPositionOnScreen(int32 cX, int32 cY, int32 cZ) { // ProjettePoint
-	if (_isUsingOrthoProjection) {
-		_projPos.x = ((cX - cZ) * 24) / ISO_SCALE + _orthoProjPos.x;
-		_projPos.y = (((cX + cZ) * 12) - cY * 30) / ISO_SCALE + _orthoProjPos.y;
+	if (_isUsingIsoProjection) {
+		_projPos.x = ((cX - cZ) * 24) / ISO_SCALE + _projectionCenter.x;
+		_projPos.y = (((cX + cZ) * 12) - cY * 30) / ISO_SCALE + _projectionCenter.y;
 		_projPos.z = cZ - cY - cX;
 		return _projPos;
 	}
@@ -81,21 +81,21 @@ IVec3 &Renderer::projectPositionOnScreen(int32 cX, int32 cY, int32 cZ) { // Proj
 		posZ = 0x7FFF;
 	}
 
-	_projPos.x = (cX * _cameraScaleX) / posZ + _orthoProjPos.x;
-	_projPos.y = (-cY * _cameraScaleY) / posZ + _orthoProjPos.y;
+	_projPos.x = (cX * _cameraScaleX) / posZ + _projectionCenter.x;
+	_projPos.y = (-cY * _cameraScaleY) / posZ + _projectionCenter.y;
 	_projPos.z = posZ;
 	return _projPos;
 }
 
 void Renderer::setCameraPosition(int32 x, int32 y, int32 depthOffset, int32 scaleX, int32 scaleY) {
-	_orthoProjPos.x = x;
-	_orthoProjPos.y = y;
+	_projectionCenter.x = x;
+	_projectionCenter.y = y;
 
 	_cameraDepthOffset = depthOffset;
 	_cameraScaleX = scaleX;
 	_cameraScaleY = scaleY;
 
-	_isUsingOrthoProjection = false;
+	_isUsingIsoProjection = false;
 }
 
 void Renderer::setBaseTranslation(int32 x, int32 y, int32 z) {
@@ -105,11 +105,11 @@ void Renderer::setBaseTranslation(int32 x, int32 y, int32 z) {
 }
 
 void Renderer::setOrthoProjection(int32 x, int32 y, int32 z) {
-	_orthoProjPos.x = x;
-	_orthoProjPos.y = y;
-	_orthoProjPos.z = z;
+	_projectionCenter.x = x;
+	_projectionCenter.y = y;
+	_projectionCenter.z = z;
 
-	_isUsingOrthoProjection = true;
+	_isUsingIsoProjection = true;
 }
 
 void Renderer::baseMatrixTranspose() {
@@ -163,10 +163,10 @@ IVec3 Renderer::getCameraAnglePositions(int32 x, int32 y, int32 z) {
 	return IVec3(vx, vy, vz);
 }
 
-IVec3 Renderer::translateGroup(int32 x, int32 y, int32 z) {
-	const int32 vx = (_shadeMatrix.row1.x * x + _shadeMatrix.row1.y * y + _shadeMatrix.row1.z * z) / SCENE_SIZE_HALF;
-	const int32 vy = (_shadeMatrix.row2.x * x + _shadeMatrix.row2.y * y + _shadeMatrix.row2.z * z) / SCENE_SIZE_HALF;
-	const int32 vz = (_shadeMatrix.row3.x * x + _shadeMatrix.row3.y * y + _shadeMatrix.row3.z * z) / SCENE_SIZE_HALF;
+IVec3 Renderer::translateGroup(const IMatrix3x3 &matrix, int32 x, int32 y, int32 z) {
+	const int32 vx = (matrix.row1.x * x + matrix.row1.y * y + matrix.row1.z * z) / SCENE_SIZE_HALF;
+	const int32 vy = (matrix.row2.x * x + matrix.row2.y * y + matrix.row2.z * z) / SCENE_SIZE_HALF;
+	const int32 vz = (matrix.row3.x * x + matrix.row3.y * y + matrix.row3.z * z) / SCENE_SIZE_HALF;
 	return IVec3(vx, vy, vz);
 }
 
@@ -379,8 +379,9 @@ void Renderer::setLightVector(int32 angleX, int32 angleY, int32 angleZ) {
 	_cameraAngleZ = angleZ;*/
 	const int32 normalUnit = 64;
 	const IVec3 renderAngle(angleX, angleY, angleZ);
-	applyRotation(&_shadeMatrix, &_baseMatrix, renderAngle);
-	_lightNorm = translateGroup(0, 0, normalUnit - 5);
+	IMatrix3x3 matrix;
+	applyRotation(&matrix, &_baseMatrix, renderAngle);
+	_lightNorm = translateGroup(matrix, 0, 0, normalUnit - 5);
 }
 
 static FORCEINLINE int16 clamp(int16 x, int16 a, int16 b) {
@@ -1364,7 +1365,7 @@ void Renderer::fillVertices(int vtop, int32 vsize, uint8 renderType, uint16 colo
 	}
 }
 
-bool Renderer::prepareCircle(int32 x, int32 y, int32 radius) {
+bool Renderer::computeSphere(int32 x, int32 y, int32 radius) {
 	if (radius <= 0) {
 		return false;
 	}
@@ -1462,7 +1463,7 @@ bool Renderer::prepareCircle(int32 x, int32 y, int32 radius) {
 
 uint8 *Renderer::prepareSpheres(const Common::Array<BodySphere> &spheres, int32 &numOfPrimitives, RenderCommand **renderCmds, uint8 *renderBufferPtr, ModelData *modelData) {
 	for (const BodySphere &sphere : spheres) {
-		CmdRenderSphere *cmd = (CmdRenderSphere *)renderBufferPtr;
+		CmdRenderSphere *cmd = (CmdRenderSphere *)(void*)renderBufferPtr;
 		cmd->color = sphere.color;
 		cmd->polyRenderType = sphere.fillType;
 		cmd->radius = sphere.radius;
@@ -1484,7 +1485,7 @@ uint8 *Renderer::prepareSpheres(const Common::Array<BodySphere> &spheres, int32
 
 uint8 *Renderer::prepareLines(const Common::Array<BodyLine> &lines, int32 &numOfPrimitives, RenderCommand **renderCmds, uint8 *renderBufferPtr, ModelData *modelData) {
 	for (const BodyLine &line : lines) {
-		CmdRenderLine *cmd = (CmdRenderLine *)renderBufferPtr;
+		CmdRenderLine *cmd = (CmdRenderLine *)(void*)renderBufferPtr;
 		cmd->colorIndex = line.color;
 		const int32 point1Index = line.vertex1;
 		const int32 point2Index = line.vertex2;
@@ -1511,37 +1512,36 @@ uint8 *Renderer::preparePolygons(const Common::Array<BodyPolygon> &polygons, int
 		const uint8 materialType = polygon.materialType;
 		const uint8 numVertices = polygon.indices.size();
 		assert(numVertices <= 16);
-		const int16 colorIndex = polygon.color;
 
 		int16 zMax = -32000;
 
-		CmdRenderPolygon *destinationPolygon = (CmdRenderPolygon *)renderBufferPtr;
+		CmdRenderPolygon *destinationPolygon = (CmdRenderPolygon *)(void*)renderBufferPtr;
 		destinationPolygon->numVertices = numVertices;
 		destinationPolygon->top = SCENE_SIZE_MAX;
 		destinationPolygon->bottom = SCENE_SIZE_MIN;
 
 		renderBufferPtr += sizeof(CmdRenderPolygon);
 
-		ComputedVertex *const vertices = (ComputedVertex *)renderBufferPtr;
+		ComputedVertex *const vertices = (ComputedVertex *)(void*)renderBufferPtr;
 		renderBufferPtr += destinationPolygon->numVertices * sizeof(ComputedVertex);
 
 		ComputedVertex *vertex = vertices;
 
 		if (materialType >= MAT_GOURAUD) {
 			destinationPolygon->renderType = polygon.materialType - (MAT_GOURAUD - POLYGONTYPE_GOURAUD);
-			destinationPolygon->colorIndex = polygon.color;
+			destinationPolygon->colorIndex = polygon.intensity;
 
 			for (int16 idx = 0; idx < numVertices; ++idx) {
-				const int16 shadeEntry = polygon.intensities[idx];
-				const int16 shadeValue = colorIndex + modelData->shadeTable[shadeEntry];
-				const int16 vertexIndex = polygon.indices[idx];
+				const uint16 shadeEntry = polygon.normals[idx];
+				const int16 shadeValue = polygon.intensity + modelData->normalTable[shadeEntry];
+				const uint16 vertexIndex = polygon.indices[idx];
 				const I16Vec3 *point = &modelData->flattenPoints[vertexIndex];
 
 				vertex->intensity = shadeValue;
 				vertex->x = clamp(point->x, 0, maxWidth);
 				vertex->y = clamp(point->y, 0, maxHeight);
-				destinationPolygon->top = MIN<int>(destinationPolygon->top, vertex->y);
-				destinationPolygon->bottom = MAX<int>(destinationPolygon->bottom, vertex->y);
+				destinationPolygon->top = MIN<int16>(destinationPolygon->top, vertex->y);
+				destinationPolygon->bottom = MAX<int16>(destinationPolygon->bottom, vertex->y);
 				zMax = MAX(zMax, point->z);
 				++vertex;
 			}
@@ -1549,24 +1549,24 @@ uint8 *Renderer::preparePolygons(const Common::Array<BodyPolygon> &polygons, int
 			if (materialType >= MAT_FLAT) {
 				// only 1 shade value is used
 				destinationPolygon->renderType = materialType - MAT_FLAT;
-				const int16 shadeEntry = polygon.intensities[0];
-				const int16 shadeValue = colorIndex + modelData->shadeTable[shadeEntry];
+				const uint16 normalIndex = polygon.normals[0];
+				const int16 shadeValue = polygon.intensity + modelData->normalTable[normalIndex];
 				destinationPolygon->colorIndex = shadeValue;
 			} else {
 				// no shade is used
 				destinationPolygon->renderType = materialType;
-				destinationPolygon->colorIndex = colorIndex;
+				destinationPolygon->colorIndex = polygon.intensity;
 			}
 
 			for (int16 idx = 0; idx < numVertices; ++idx) {
-				const int16 vertexIndex = polygon.indices[idx];
+				const uint16 vertexIndex = polygon.indices[idx];
 				const I16Vec3 *point = &modelData->flattenPoints[vertexIndex];
 
 				vertex->intensity = destinationPolygon->colorIndex;
 				vertex->x = clamp(point->x, 0, maxWidth);
 				vertex->y = clamp(point->y, 0, maxHeight);
-				destinationPolygon->top = MIN<int>(destinationPolygon->top, vertex->y);
-				destinationPolygon->bottom = MAX<int>(destinationPolygon->bottom, vertex->y);
+				destinationPolygon->top = MIN<int16>(destinationPolygon->top, vertex->y);
+				destinationPolygon->bottom = MAX<int16>(destinationPolygon->bottom, vertex->y);
 				zMax = MAX(zMax, point->z);
 				++vertex;
 			}
@@ -1597,14 +1597,14 @@ bool Renderer::renderModelElements(int32 numOfPrimitives, const BodyData &bodyDa
 	uint8 *renderBufferPtr = _renderCoordinatesBuffer;
 	renderBufferPtr = preparePolygons(bodyData.getPolygons(), numOfPrimitives, renderCmds, renderBufferPtr, modelData);
 	renderBufferPtr = prepareLines(bodyData.getLines(), numOfPrimitives, renderCmds, renderBufferPtr, modelData);
-	renderBufferPtr = prepareSpheres(bodyData.getSpheres(), numOfPrimitives, renderCmds, renderBufferPtr, modelData);
+	prepareSpheres(bodyData.getSpheres(), numOfPrimitives, renderCmds, renderBufferPtr, modelData);
 
 	if (numOfPrimitives == 0) {
 		return false;
 	}
 	const RenderCommand *cmds = depthSortRenderCommands(numOfPrimitives);
 
-	int16 primitiveCounter = numOfPrimitives;
+	int32 primitiveCounter = numOfPrimitives;
 
 	do {
 		int16 type = cmds->renderType;
@@ -1612,7 +1612,7 @@ bool Renderer::renderModelElements(int32 numOfPrimitives, const BodyData &bodyDa
 
 		switch (type) {
 		case RENDERTYPE_DRAWLINE: {
-			const CmdRenderLine *lineCoords = (const CmdRenderLine *)pointer;
+			const CmdRenderLine *lineCoords = (const CmdRenderLine *)(const void*)pointer;
 			const int32 x1 = lineCoords->x1;
 			const int32 y1 = lineCoords->y1;
 			const int32 x2 = lineCoords->x2;
@@ -1621,16 +1621,16 @@ bool Renderer::renderModelElements(int32 numOfPrimitives, const BodyData &bodyDa
 			break;
 		}
 		case RENDERTYPE_DRAWPOLYGON: {
-			const CmdRenderPolygon *header = (const CmdRenderPolygon *)pointer;
-			ComputedVertex *vertices = (ComputedVertex *)(pointer + sizeof(CmdRenderPolygon));
+			const CmdRenderPolygon *header = (const CmdRenderPolygon *)(const void*)pointer;
+			ComputedVertex *vertices = (ComputedVertex *)(void*)(pointer + sizeof(CmdRenderPolygon));
 			renderPolygons(*header, vertices, header->top, header->bottom);
 			break;
 		}
 		case RENDERTYPE_DRAWSPHERE: {
-			CmdRenderSphere *sphere = (CmdRenderSphere *)pointer;
+			const CmdRenderSphere *sphere = (const CmdRenderSphere *)(const void*)pointer;
 			int32 radius = sphere->radius;
 
-			if (_isUsingOrthoProjection) {
+			if (_isUsingIsoProjection) {
 				// * sqrt(sx+sy) / 512 (isometric scale)
 				radius = (radius * 34) / ISO_SCALE;
 			} else {
@@ -1661,7 +1661,7 @@ bool Renderer::renderModelElements(int32 numOfPrimitives, const BodyData &bodyDa
 
 			radius -= 3;
 
-			if (prepareCircle(sphere->x, sphere->y, radius)) {
+			if (computeSphere(sphere->x, sphere->y, radius)) {
 				const int32 vsize = 2 * radius;
 				fillVertices(sphere->y - radius, vsize, sphere->polyRenderType, sphere->color);
 			}
@@ -1714,15 +1714,15 @@ bool Renderer::renderAnimatedModel(ModelData *modelData, const BodyData &bodyDat
 	const I16Vec3 *pointPtr = &modelData->computedPoints[0];
 	I16Vec3 *pointPtrDest = &modelData->flattenPoints[0];
 
-	if (_isUsingOrthoProjection) { // use standard projection
+	if (_isUsingIsoProjection) { // use standard projection
 		do {
 			const int32 coX = pointPtr->x + renderPos.x;
 			const int32 coY = pointPtr->y + renderPos.y;
 			const int32 coZ = -(pointPtr->z + renderPos.z);
 
 			// TODO: use projectPositionOnScreen()
-			pointPtrDest->x = (coX + coZ) * 24 / ISO_SCALE + _orthoProjPos.x;
-			pointPtrDest->y = (((coX - coZ) * 12) - coY * 30) / ISO_SCALE + _orthoProjPos.y;
+			pointPtrDest->x = (coX + coZ) * 24 / ISO_SCALE + _projectionCenter.x;
+			pointPtrDest->y = (((coX - coZ) * 12) - coY * 30) / ISO_SCALE + _projectionCenter.y;
 			pointPtrDest->z = coZ - coX - coY;
 
 			if (pointPtrDest->x < modelRect.left) {
@@ -1756,7 +1756,7 @@ bool Renderer::renderAnimatedModel(ModelData *modelData, const BodyData &bodyDat
 
 			// X projection
 			{
-				coX = _orthoProjPos.x + ((coX * _cameraScaleX) / coZ);
+				coX = _projectionCenter.x + ((coX * _cameraScaleX) / coZ);
 
 				if (coX > 0xFFFF) {
 					coX = 0x7FFF;
@@ -1775,7 +1775,7 @@ bool Renderer::renderAnimatedModel(ModelData *modelData, const BodyData &bodyDat
 
 			// Y projection
 			{
-				coY = _orthoProjPos.y + ((-coY * _cameraScaleY) / coZ);
+				coY = _projectionCenter.y + ((-coY * _cameraScaleY) / coZ);
 
 				if (coY > 0xFFFF) {
 					coY = 0x7FFF;
@@ -1806,10 +1806,10 @@ bool Renderer::renderAnimatedModel(ModelData *modelData, const BodyData &bodyDat
 		} while (--numOfPrimitives);
 	}
 
-	int32 numOfShades = bodyData.getShades().size();
+	int32 numNormals = bodyData.getNormals().size();
 
-	if (numOfShades) { // process normal data
-		uint16 *currentShadeDestination = (uint16 *)modelData->shadeTable;
+	if (numNormals) { // process normal data
+		uint16 *currentShadeDestination = (uint16 *)modelData->normalTable;
 		IMatrix3x3 *lightMatrix = &_matricesTable[0];
 
 		numOfPrimitives = numBones;
@@ -1817,37 +1817,33 @@ bool Renderer::renderAnimatedModel(ModelData *modelData, const BodyData &bodyDat
 		int shadeIndex = 0;
 		int boneIdx = 0;
 		do { // for each element
-			numOfShades = bodyData.getBone(boneIdx).numOfShades;
+			numNormals = bodyData.getBone(boneIdx).numNormals;
 
-			if (numOfShades) {
-				int32 numShades = numOfShades;
+			if (numNormals) {
+				const IMatrix3x3 matrix = *lightMatrix * _lightNorm;
 
-				_shadeMatrix = *lightMatrix * _lightNorm;
+				for (int32 i = 0; i < numNormals; ++i) { // for each normal
+					const BodyNormal &normalPtr = bodyData.getNormal(shadeIndex);
 
-				do { // for each normal
-					const BodyShade &shadePtr = bodyData.getShade(shadeIndex);
+					const int32 x = (int32)normalPtr.x;
+					const int32 y = (int32)normalPtr.y;
+					const int32 z = (int32)normalPtr.z;
 
-					const int32 col1 = (int32)shadePtr.col1;
-					const int32 col2 = (int32)shadePtr.col2;
-					const int32 col3 = (int32)shadePtr.col3;
+					int32 intensity = 0;
+					intensity += matrix.row1.x * x + matrix.row1.y * y + matrix.row1.z * z;
+					intensity += matrix.row2.x * x + matrix.row2.y * y + matrix.row2.z * z;
+					intensity += matrix.row3.x * x + matrix.row3.y * y + matrix.row3.z * z;
 
-					int32 color = 0;
-					color += _shadeMatrix.row1.x * col1 + _shadeMatrix.row1.y * col2 + _shadeMatrix.row1.z * col3;
-					color += _shadeMatrix.row2.x * col1 + _shadeMatrix.row2.y * col2 + _shadeMatrix.row2.z * col3;
-					color += _shadeMatrix.row3.x * col1 + _shadeMatrix.row3.y * col2 + _shadeMatrix.row3.z * col3;
-
-					int32 shade = 0;
-
-					if (color > 0) {
-						color >>= 14;
-						color /= shadePtr.unk4;
-						shade = (uint16)color;
+					if (intensity > 0) {
+						intensity >>= 14;
+						intensity /= normalPtr.prenormalizedRange;
+					} else {
+						intensity = 0;
 					}
 
-					*currentShadeDestination = shade;
-					currentShadeDestination++;
+					*currentShadeDestination++ = (uint16)intensity;
 					++shadeIndex;
-				} while (--numShades);
+				};
 			}
 
 			++boneIdx;
@@ -1871,7 +1867,7 @@ bool Renderer::renderIsoModel(int32 x, int32 y, int32 z, int32 angleX, int32 ang
 	modelRect.bottom = SCENE_SIZE_MIN;
 
 	IVec3 renderPos;
-	if (_isUsingOrthoProjection) {
+	if (_isUsingIsoProjection) {
 		renderPos.x = x;
 		renderPos.y = y;
 		renderPos.z = z;
diff --git a/engines/twine/renderer/renderer.h b/engines/twine/renderer/renderer.h
index 6d712e99fcc..3ae0efdfc35 100644
--- a/engines/twine/renderer/renderer.h
+++ b/engines/twine/renderer/renderer.h
@@ -68,7 +68,7 @@ bool isPolygonVisible(const ComputedVertex *vertices);
 struct CmdRenderPolygon {
 	uint8 renderType = 0;
 	uint8 numVertices = 0;
-	int16 colorIndex = 0;
+	int16 colorIndex = 0; // intensity
 	int16 top = 0;
 	int16 bottom = 0;
 	// followed by Vertex array
@@ -146,13 +146,13 @@ private:
 	struct ModelData {
 		I16Vec3 computedPoints[800];
 		I16Vec3 flattenPoints[800];
-		int16 shadeTable[500]{0};
+		int16 normalTable[500]{0};
 	};
 
 	ModelData _modelData;
 
 	bool renderAnimatedModel(ModelData *modelData, const BodyData &bodyData, RenderCommand *renderCmds, const IVec3 &angleVec, const IVec3 &renderPos, Common::Rect &modelRect);
-	bool prepareCircle(int32 x, int32 y, int32 radius);
+	bool computeSphere(int32 x, int32 y, int32 radius);
 	bool renderModelElements(int32 numOfPrimitives, const BodyData &bodyData, RenderCommand **renderCmds, ModelData *modelData, Common::Rect &modelRect);
 	IVec3 getCameraAnglePositions(int32 x, int32 y, int32 z);
 	inline IVec3 getCameraAnglePositions(const IVec3 &vec) {
@@ -163,10 +163,10 @@ private:
 	void processRotatedElement(IMatrix3x3 *targetMatrix, const Common::Array<BodyVertex>& vertices, int32 rotX, int32 rotY, int32 rotZ, const BodyBone &bone, ModelData *modelData);
 	void applyPointsTranslation(const Common::Array<BodyVertex>& vertices, int32 firstPoint, int32 numPoints, I16Vec3 *destPoints, const IMatrix3x3 *translationMatrix, const IVec3 &angleVec, const IVec3 &destPos);
 	void processTranslatedElement(IMatrix3x3 *targetMatrix, const Common::Array<BodyVertex>& vertices, int32 rotX, int32 rotY, int32 rotZ, const BodyBone &bone, ModelData *modelData);
-	IVec3 translateGroup(int32 x, int32 y, int32 z);
+	IVec3 translateGroup(const IMatrix3x3 &matrix, int32 x, int32 y, int32 z);
 
 	IVec3 _baseTransPos;
-	IVec3 _orthoProjPos;
+	IVec3 _projectionCenter;
 
 	int32 _cameraDepthOffset = 0;
 	int32 _cameraScaleX = 0;
@@ -174,7 +174,6 @@ private:
 
 	IMatrix3x3 _baseMatrix;
 	IMatrix3x3 _matricesTable[30 + 1];
-	IMatrix3x3 _shadeMatrix;
 	IVec3 _lightNorm;
 	IVec3 _baseRotPos;
 
@@ -197,7 +196,7 @@ private:
 	int16* _tabx1 = nullptr;
 	int16* _tabVerticD = nullptr;
 
-	bool _isUsingOrthoProjection = false;
+	bool _isUsingIsoProjection = false;
 
 	void renderPolygonsCopper(int vtop, int32 vsize, uint16 color) const;
 	void renderPolygonsBopper(int vtop, int32 vsize, uint16 color) const;


Commit: 9163381d4b51b5a58314c81f32928cef776a1106
    https://github.com/scummvm/scummvm/commit/9163381d4b51b5a58314c81f32928cef776a1106
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2023-01-15T11:28:57+01:00

Commit Message:
TWINE: renamed methods to match original sources

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 bde61ed24e8..ff2b8847f65 100644
--- a/engines/twine/renderer/renderer.cpp
+++ b/engines/twine/renderer/renderer.cpp
@@ -815,7 +815,7 @@ bool Renderer::computePoly(int16 polyRenderType, const ComputedVertex *vertices,
 	return true;
 }
 
-void Renderer::renderPolygonsCopper(int vtop, int32 vsize, uint16 color) const {
+void Renderer::svgaPolyCopper(int vtop, int32 vsize, uint16 color) const {
 	uint8 *out = (uint8 *)_engine->_frontVideoBuffer.getBasePtr(0, vtop);
 	const int16 *ptr1 = &_polyTab[vtop];
 	const int screenWidth = _engine->width();
@@ -853,7 +853,7 @@ void Renderer::renderPolygonsCopper(int vtop, int32 vsize, uint16 color) const {
 	}
 }
 
-void Renderer::renderPolygonsBopper(int vtop, int32 vsize, uint16 color) const {
+void Renderer::svgaPolyBopper(int vtop, int32 vsize, uint16 color) const {
 	uint8 *out = (uint8 *)_engine->_frontVideoBuffer.getBasePtr(0, vtop);
 	const int16 *ptr1 = &_polyTab[vtop];
 	const int screenWidth = _engine->width();
@@ -894,7 +894,7 @@ void Renderer::renderPolygonsBopper(int vtop, int32 vsize, uint16 color) const {
 	}
 }
 
-void Renderer::renderPolygonsFlat(int vtop, int32 vsize, uint16 color) const {
+void Renderer::svgaPolyTriste(int vtop, int32 vsize, uint16 color) const {
 	uint8 *out = (uint8 *)_engine->_frontVideoBuffer.getBasePtr(0, vtop);
 	const int16 *ptr1 = &_polyTab[vtop];
 	const int screenWidth = _engine->width();
@@ -924,7 +924,7 @@ void Renderer::renderPolygonsFlat(int vtop, int32 vsize, uint16 color) const {
 
 #define ROL16(x, b) (((x) << (b)) | ((x) >> (16 - (b))))
 
-void Renderer::renderPolygonsTele(int vtop, int32 vsize, uint16 color) const {
+void Renderer::svgaPolyTele(int vtop, int32 vsize, uint16 color) const {
 	uint8 *out = (uint8 *)_engine->_frontVideoBuffer.getBasePtr(0, vtop);
 	const int16 *ptr1 = &_polyTab[vtop];
 	const int screenWidth = _engine->width();
@@ -959,7 +959,7 @@ void Renderer::renderPolygonsTele(int vtop, int32 vsize, uint16 color) const {
 	}
 }
 
-void Renderer::renderPolygonsTrans(int vtop, int32 vsize, uint16 color) const {
+void Renderer::svgaPolyTrans(int vtop, int32 vsize, uint16 color) const {
 	uint8 *out = (uint8 *)_engine->_frontVideoBuffer.getBasePtr(0, vtop);
 	const int16 *ptr1 = &_polyTab[vtop];
 	const int screenWidth = _engine->width();
@@ -983,7 +983,7 @@ void Renderer::renderPolygonsTrans(int vtop, int32 vsize, uint16 color) const {
 }
 
 // Used e.g for the legs of the horse or the ears of most characters
-void Renderer::renderPolygonsTrame(int vtop, int32 vsize, uint16 color) const {
+void Renderer::svgaPolyTrame(int vtop, int32 vsize, uint16 color) const {
 	uint8 *out = (uint8 *)_engine->_frontVideoBuffer.getBasePtr(0, vtop);
 	const int16 *ptr1 = &_polyTab[vtop];
 	const int screenWidth = _engine->width();
@@ -1020,7 +1020,7 @@ void Renderer::renderPolygonsTrame(int vtop, int32 vsize, uint16 color) const {
 	}
 }
 
-void Renderer::renderPolygonsGouraud(int vtop, int32 vsize) const {
+void Renderer::svgaPolyGouraud(int vtop, int32 vsize) const {
 	uint8 *out = (uint8 *)_engine->_frontVideoBuffer.getBasePtr(0, vtop);
 	const int16 *ptr1 = &_polyTab[vtop];
 	const int16 *ptr2 = &_colorProgressionBuffer[vtop];
@@ -1104,7 +1104,7 @@ void Renderer::renderPolygonsGouraud(int vtop, int32 vsize) const {
 }
 
 // used for the most of the heads of the characters and the horse body
-void Renderer::renderPolygonsDither(int vtop, int32 vsize) const {
+void Renderer::svgaPolyDith(int vtop, int32 vsize) const {
 	uint8 *out = (uint8 *)_engine->_frontVideoBuffer.getBasePtr(0, vtop);
 	const int16 *ptr1 = &_polyTab[vtop];
 	const int16 *ptr2 = &_colorProgressionBuffer[vtop];
@@ -1237,7 +1237,7 @@ void Renderer::renderPolygonsDither(int vtop, int32 vsize) const {
 	}
 }
 
-void Renderer::renderPolygonsMarble(int vtop, int32 vsize, uint16 color) const {
+void Renderer::svgaPolyMarbre(int vtop, int32 vsize, uint16 color) const {
 	const int screenWidth = _engine->width();
 	const int screenHeight = _engine->height();
 
@@ -1279,7 +1279,7 @@ void Renderer::renderPolygonsMarble(int vtop, int32 vsize, uint16 color) const {
 	}
 }
 
-void Renderer::renderPolygonsSimplified(int vtop, int32 vsize, uint16 color) const {
+void Renderer::svgaPolyTriche(int vtop, int32 vsize, uint16 color) const {
 	uint8 *out = (uint8 *)_engine->_frontVideoBuffer.getBasePtr(0, vtop);
 	const int16 *ptr1 = &_polyTab[vtop];
 	const int16 *ptr2 = &_colorProgressionBuffer[vtop];
@@ -1319,45 +1319,45 @@ void Renderer::renderPolygons(const CmdRenderPolygon &polygon, ComputedVertex *v
 void Renderer::fillVertices(int vtop, int32 vsize, uint8 renderType, uint16 color) {
 	switch (renderType) {
 	case POLYGONTYPE_FLAT:
-		renderPolygonsFlat(vtop, vsize, color);
+		svgaPolyTriste(vtop, vsize, color);
 		break;
 	case POLYGONTYPE_TELE:
 		if (_engine->_cfgfile.PolygonDetails == 0) {
-			renderPolygonsFlat(vtop, vsize, color);
+			svgaPolyTriste(vtop, vsize, color);
 		} else {
-			renderPolygonsTele(vtop, vsize, color);
+			svgaPolyTele(vtop, vsize, color);
 		}
 		break;
 	case POLYGONTYPE_COPPER:
-		renderPolygonsCopper(vtop, vsize, color);
+		svgaPolyCopper(vtop, vsize, color);
 		break;
 	case POLYGONTYPE_BOPPER:
-		renderPolygonsBopper(vtop, vsize, color);
+		svgaPolyBopper(vtop, vsize, color);
 		break;
 	case POLYGONTYPE_TRANS:
-		renderPolygonsTrans(vtop, vsize, color);
+		svgaPolyTrans(vtop, vsize, color);
 		break;
 	case POLYGONTYPE_TRAME: // raster
-		renderPolygonsTrame(vtop, vsize, color);
+		svgaPolyTrame(vtop, vsize, color);
 		break;
 	case POLYGONTYPE_GOURAUD:
 		if (_engine->_cfgfile.PolygonDetails == 0) {
-			renderPolygonsSimplified(vtop, vsize, color);
+			svgaPolyTriche(vtop, vsize, color);
 		} else {
-			renderPolygonsGouraud(vtop, vsize);
+			svgaPolyGouraud(vtop, vsize);
 		}
 		break;
 	case POLYGONTYPE_DITHER:
 		if (_engine->_cfgfile.PolygonDetails == 0) {
-			renderPolygonsSimplified(vtop, vsize, color);
+			svgaPolyTriche(vtop, vsize, color);
 		} else if (_engine->_cfgfile.PolygonDetails == 1) {
-			renderPolygonsGouraud(vtop, vsize);
+			svgaPolyGouraud(vtop, vsize);
 		} else {
-			renderPolygonsDither(vtop, vsize);
+			svgaPolyDith(vtop, vsize);
 		}
 		break;
 	case POLYGONTYPE_MARBLE:
-		renderPolygonsMarble(vtop, vsize, color);
+		svgaPolyMarbre(vtop, vsize, color);
 		break;
 	default:
 		warning("RENDER WARNING: Unsupported render type %d", renderType);
diff --git a/engines/twine/renderer/renderer.h b/engines/twine/renderer/renderer.h
index 3ae0efdfc35..901acb6d105 100644
--- a/engines/twine/renderer/renderer.h
+++ b/engines/twine/renderer/renderer.h
@@ -198,16 +198,16 @@ private:
 
 	bool _isUsingIsoProjection = false;
 
-	void renderPolygonsCopper(int vtop, int32 vsize, uint16 color) const;
-	void renderPolygonsBopper(int vtop, int32 vsize, uint16 color) const;
-	void renderPolygonsFlat(int vtop, int32 vsize, uint16 color) const;
-	void renderPolygonsTele(int vtop, int32 vsize, uint16 color) const;
-	void renderPolygonsTrans(int vtop, int32 vsize, uint16 color) const;
-	void renderPolygonsTrame(int vtop, int32 vsize, uint16 color) const;
-	void renderPolygonsGouraud(int vtop, int32 vsize) const;
-	void renderPolygonsDither(int vtop, int32 vsize) const;
-	void renderPolygonsMarble(int vtop, int32 vsize, uint16 color) const;
-	void renderPolygonsSimplified(int vtop, int32 vsize, uint16 color) const;
+	void svgaPolyCopper(int vtop, int32 vsize, uint16 color) const;
+	void svgaPolyBopper(int vtop, int32 vsize, uint16 color) const;
+	void svgaPolyTriste(int vtop, int32 vsize, uint16 color) const;
+	void svgaPolyTele(int vtop, int32 vsize, uint16 color) const;
+	void svgaPolyTrans(int vtop, int32 vsize, uint16 color) const;
+	void svgaPolyTrame(int vtop, int32 vsize, uint16 color) const;
+	void svgaPolyGouraud(int vtop, int32 vsize) const;
+	void svgaPolyDith(int vtop, int32 vsize) const;
+	void svgaPolyMarbre(int vtop, int32 vsize, uint16 color) const;
+	void svgaPolyTriche(int vtop, int32 vsize, uint16 color) const;
 	bool computePoly(int16 polyRenderType, const ComputedVertex *vertices, int32 numVertices);
 
 	const RenderCommand *depthSortRenderCommands(int32 numOfPrimitives);


Commit: 1ab3df79a833f423ae06c420ce0a82f765e5d8d7
    https://github.com/scummvm/scummvm/commit/1ab3df79a833f423ae06c420ce0a82f765e5d8d7
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2023-01-15T11:28:58+01:00

Commit Message:
TWINE: renamed methods and members to match the original sources

Changed paths:
    engines/twine/debugger/console.cpp
    engines/twine/holomap.cpp
    engines/twine/menu/menu.cpp
    engines/twine/menu/menuoptions.cpp
    engines/twine/renderer/renderer.cpp
    engines/twine/renderer/renderer.h
    engines/twine/scene/gamestate.cpp
    engines/twine/script/script_life_v1.cpp
    engines/twine/text.cpp
    engines/twine/text.h
    engines/twine/twine.cpp


diff --git a/engines/twine/debugger/console.cpp b/engines/twine/debugger/console.cpp
index e817d9b6d0b..d224bfd67e9 100644
--- a/engines/twine/debugger/console.cpp
+++ b/engines/twine/debugger/console.cpp
@@ -356,14 +356,14 @@ bool TwinEConsole::doListMenuText(int argc, const char **argv) {
 		textBankId = (TextBankId)atoi(argv[1]);
 	}
 	const TextBankId oldTextBankId = _engine->_text->textBank();
-	_engine->_text->initTextBank(textBankId);
+	_engine->_text->initDial(textBankId);
 	for (int32 i = 0; i < 1000; ++i) {
 		char buf[256];
 		if (_engine->_text->getMenuText((TextId)i, buf, sizeof(buf))) {
 			debugPrintf("%4i: %s\n", i, buf);
 		}
 	}
-	_engine->_text->initTextBank(oldTextBankId);
+	_engine->_text->initDial(oldTextBankId);
 	return true;
 }
 
diff --git a/engines/twine/holomap.cpp b/engines/twine/holomap.cpp
index 859e1fb8802..5b41c40d860 100644
--- a/engines/twine/holomap.cpp
+++ b/engines/twine/holomap.cpp
@@ -90,7 +90,7 @@ bool Holomap::loadLocations() {
 		return false;
 	}
 
-	_engine->_text->initTextBank(TextBankId::Inventory_Intro_and_Holomap);
+	_engine->_text->initDial(TextBankId::Inventory_Intro_and_Holomap);
 	for (int32 i = 0; i < _numLocations; i++) {
 		_locations[i].angleX = (int16)ClampAngle(stream.readSint16LE());
 		_locations[i].angleY = (int16)ClampAngle(stream.readSint16LE());
@@ -306,7 +306,7 @@ void Holomap::renderHolomapVehicle(uint &frameNumber, ActorMoveStruct &move, Ani
 		}
 	}
 	const Common::Rect rect(0, _engine->height() - 280, 200, _engine->height() - 1);
-	_engine->_renderer->setCameraPosition(rect.width() / 2, _engine->height() - 80, 128, 900, 900);
+	_engine->_renderer->setProjection(rect.width() / 2, _engine->height() - 80, 128, 900, 900);
 	_engine->_renderer->setCameraAngle(0, 0, 0, 60, 128, 0, distance(30000));
 	_engine->_renderer->setLightVector(-60, 128, 0);
 	// background of the vehicle
@@ -338,7 +338,7 @@ void Holomap::drawHolomapTrajectory(int32 trajectoryIndex) {
 	ScopedEngineFreeze timeFreeze(_engine);
 	const int32 cameraPosX = _engine->width() / 2 + 80;
 	const int32 cameraPosY = _engine->height() / 2;
-	_engine->_renderer->setCameraPosition(cameraPosX, cameraPosY, 128, 1024, 1024);
+	_engine->_renderer->setProjection(cameraPosX, cameraPosY, 128, 1024, 1024);
 	_engine->_renderer->setCameraAngle(0, 0, 0, data->pos.x, data->pos.y, data->pos.z, distance(zDistanceTrajectory));
 
 	constexpr TwineResource holomapImageRes(Resources::HQR_RESS_FILE, RESSHQR_HOLOIMG);
@@ -384,7 +384,7 @@ void Holomap::drawHolomapTrajectory(int32 trajectoryIndex) {
 		renderHolomapVehicle(frameNumber, move, animTimerData, bodyData, animData);
 
 		// now render the holomap path
-		_engine->_renderer->setCameraPosition(cameraPosX, cameraPosY, 128, 1024, 1024);
+		_engine->_renderer->setProjection(cameraPosX, cameraPosY, 128, 1024, 1024);
 		_engine->_renderer->setCameraAngle(0, 0, 0, data->pos.x, data->pos.y, data->pos.z, distance(zDistanceTrajectory));
 		_engine->_renderer->setLightVector(data->pos.x, data->pos.y, 0);
 
@@ -516,11 +516,11 @@ void Holomap::processHolomap() {
 
 	initHoloDatas();
 
-	_engine->_text->initTextBank(TextBankId::Inventory_Intro_and_Holomap);
+	_engine->_text->initDial(TextBankId::Inventory_Intro_and_Holomap);
 	_engine->_text->setFontCrossColor(COLOR_9);
 	const int32 cameraPosX = _engine->width() / 2;
 	const int32 cameraPosY = scale(190);
-	_engine->_renderer->setCameraPosition(cameraPosX, cameraPosY, 128, 1024, 1024);
+	_engine->_renderer->setProjection(cameraPosX, cameraPosY, 128, 1024, 1024);
 
 	constexpr TwineResource holomapImageRes(Resources::HQR_RESS_FILE, RESSHQR_HOLOIMG);
 	uint8 *holomapImagePtr = nullptr;
diff --git a/engines/twine/menu/menu.cpp b/engines/twine/menu/menu.cpp
index 3749335cc2f..2f90ca70694 100644
--- a/engines/twine/menu/menu.cpp
+++ b/engines/twine/menu/menu.cpp
@@ -633,7 +633,7 @@ int32 Menu::processMenu(MenuSettings *menuSettings) {
 					}
 				}
 			}
-			_engine->_text->initTextBank(TextBankId::Options_and_menus);
+			_engine->_text->initDial(TextBankId::Options_and_menus);
 			startMillis = _engine->_system->getMillis();
 			_engine->_screens->loadMenuImage(false);
 		}
@@ -715,7 +715,7 @@ int32 Menu::volumeMenu() {
 }
 
 void Menu::inGameOptionsMenu() {
-	_engine->_text->initTextBank(TextBankId::Options_and_menus);
+	_engine->_text->initDial(TextBankId::Options_and_menus);
 	_optionsMenuState.setButtonTextId(0, TextId::kReturnGame);
 	_engine->saveFrontBuffer();
 	optionsMenu();
@@ -824,7 +824,7 @@ bool Menu::init() {
 
 EngineState Menu::run() {
 	FrameMarker frame(_engine);
-	_engine->_text->initTextBank(TextBankId::Options_and_menus);
+	_engine->_text->initDial(TextBankId::Options_and_menus);
 
 	if (_engine->isLBA1()) {
 		_engine->_music->playTrackMusic(9); // LBA's Theme
@@ -889,7 +889,7 @@ int32 Menu::giveupMenu() {
 	int32 menuId;
 	do {
 		FrameMarker frame(_engine);
-		_engine->_text->initTextBank(TextBankId::Options_and_menus);
+		_engine->_text->initDial(TextBankId::Options_and_menus);
 		menuId = processMenu(localMenu);
 		switch (menuId) {
 		case (int32)TextId::kContinue:
@@ -1120,7 +1120,7 @@ void Menu::processBehaviourMenu(bool behaviourMenu) {
 	TextBankId tmpTextBank = _engine->_scene->_sceneTextBank;
 	_engine->_scene->_sceneTextBank = TextBankId::None;
 
-	_engine->_text->initTextBank(TextBankId::Options_and_menus);
+	_engine->_text->initDial(TextBankId::Options_and_menus);
 
 	// quick actions to change behaviour don't show the menu in classic edition
 	if (!behaviourMenu && _engine->isLba1Classic()) {
@@ -1259,7 +1259,7 @@ void Menu::processInventoryMenu() {
 	const int32 top = _engine->height() / 2 - 210;
 	drawInventoryItems(left, top);
 
-	_engine->_text->initTextBank(TextBankId::Inventory_Intro_and_Holomap);
+	_engine->_text->initDial(TextBankId::Inventory_Intro_and_Holomap);
 
 	_engine->_text->setFontCrossColor(COLOR_BRIGHT_BLUE);
 	_engine->_text->initDialogueBox();
diff --git a/engines/twine/menu/menuoptions.cpp b/engines/twine/menu/menuoptions.cpp
index 833b5170b42..854c8d1f275 100644
--- a/engines/twine/menu/menuoptions.cpp
+++ b/engines/twine/menu/menuoptions.cpp
@@ -57,7 +57,7 @@ void MenuOptions::newGame() {
 	_engine->_text->_drawTextBoxBackground = false;
 	_engine->_text->_renderTextTriangle = true;
 
-	_engine->_text->initTextBank(TextBankId::Inventory_Intro_and_Holomap);
+	_engine->_text->initDial(TextBankId::Inventory_Intro_and_Holomap);
 	_engine->_text->textClipFull();
 	_engine->_text->setFontCrossColor(COLOR_WHITE);
 
@@ -233,7 +233,7 @@ public:
 };
 
 bool MenuOptions::enterText(TextId textIdx, char *textTargetBuf, size_t bufSize) {
-	_engine->_text->initTextBank(TextBankId::Options_and_menus);
+	_engine->_text->initDial(TextBankId::Options_and_menus);
 	char buffer[256];
 	_engine->_text->getMenuText(textIdx, buffer, sizeof(buffer));
 	_engine->_text->setFontColor(COLOR_WHITE);
@@ -350,7 +350,7 @@ int MenuOptions::chooseSave(TextId textIdx, bool showEmptySlots) {
 		return -1;
 	}
 
-	_engine->_text->initTextBank(TextBankId::Options_and_menus);
+	_engine->_text->initDial(TextBankId::Options_and_menus);
 
 	MenuSettings saveFiles;
 	saveFiles.addButton(TextId::kReturnMenu);
diff --git a/engines/twine/renderer/renderer.cpp b/engines/twine/renderer/renderer.cpp
index ff2b8847f65..ec5dc318ac7 100644
--- a/engines/twine/renderer/renderer.cpp
+++ b/engines/twine/renderer/renderer.cpp
@@ -76,24 +76,24 @@ IVec3 &Renderer::projectPositionOnScreen(int32 cX, int32 cY, int32 cZ) { // Proj
 	cY -= _baseRotPos.y;
 	cZ = _baseRotPos.z - cZ;
 
-	int32 posZ = cZ + _cameraDepthOffset;
+	int32 posZ = cZ + _kFactor;
 	if (posZ <= 0) {
 		posZ = 0x7FFF;
 	}
 
-	_projPos.x = (cX * _cameraScaleX) / posZ + _projectionCenter.x;
-	_projPos.y = (-cY * _cameraScaleY) / posZ + _projectionCenter.y;
+	_projPos.x = (cX * _lFactorX) / posZ + _projectionCenter.x;
+	_projPos.y = (-cY * _lFactorY) / posZ + _projectionCenter.y;
 	_projPos.z = posZ;
 	return _projPos;
 }
 
-void Renderer::setCameraPosition(int32 x, int32 y, int32 depthOffset, int32 scaleX, int32 scaleY) {
+void Renderer::setProjection(int32 x, int32 y, int32 kfact, int32 lfactx, int32 lfacty) {
 	_projectionCenter.x = x;
 	_projectionCenter.y = y;
 
-	_cameraDepthOffset = depthOffset;
-	_cameraScaleX = scaleX;
-	_cameraScaleY = scaleY;
+	_kFactor = kfact;
+	_lFactorX = lfactx;
+	_lFactorY = lfacty;
 
 	_isUsingIsoProjection = false;
 }
@@ -104,10 +104,10 @@ void Renderer::setBaseTranslation(int32 x, int32 y, int32 z) {
 	_baseTransPos.z = z;
 }
 
-void Renderer::setOrthoProjection(int32 x, int32 y, int32 z) {
+void Renderer::setIsoProjection(int32 x, int32 y, int32 scale) {
 	_projectionCenter.x = x;
 	_projectionCenter.y = y;
-	_projectionCenter.z = z;
+	_projectionCenter.z = scale; // not used - IsoScale is always 512
 
 	_isUsingIsoProjection = true;
 }
@@ -1634,11 +1634,11 @@ bool Renderer::renderModelElements(int32 numOfPrimitives, const BodyData &bodyDa
 				// * sqrt(sx+sy) / 512 (isometric scale)
 				radius = (radius * 34) / ISO_SCALE;
 			} else {
-				int32 delta = _cameraDepthOffset + sphere->z;
+				int32 delta = _kFactor + sphere->z;
 				if (delta == 0) {
 					break;
 				}
-				radius = (sphere->radius * _cameraScaleX) / delta;
+				radius = (sphere->radius * _lFactorX) / delta;
 			}
 
 			radius += 3;
@@ -1748,7 +1748,7 @@ bool Renderer::renderAnimatedModel(ModelData *modelData, const BodyData &bodyDat
 			int32 coY = pointPtr->y + renderPos.y;
 			int32 coZ = -(pointPtr->z + renderPos.z);
 
-			coZ += _cameraDepthOffset;
+			coZ += _kFactor;
 
 			if (coZ <= 0) {
 				coZ = 0x7FFFFFFF;
@@ -1756,7 +1756,7 @@ bool Renderer::renderAnimatedModel(ModelData *modelData, const BodyData &bodyDat
 
 			// X projection
 			{
-				coX = _projectionCenter.x + ((coX * _cameraScaleX) / coZ);
+				coX = _projectionCenter.x + ((coX * _lFactorX) / coZ);
 
 				if (coX > 0xFFFF) {
 					coX = 0x7FFF;
@@ -1775,7 +1775,7 @@ bool Renderer::renderAnimatedModel(ModelData *modelData, const BodyData &bodyDat
 
 			// Y projection
 			{
-				coY = _projectionCenter.y + ((-coY * _cameraScaleY) / coZ);
+				coY = _projectionCenter.y + ((-coY * _lFactorY) / coZ);
 
 				if (coY > 0xFFFF) {
 					coY = 0x7FFF;
@@ -1904,7 +1904,7 @@ void Renderer::renderBehaviourModel(const Common::Rect &rect, int32 y, int32 ang
 	const int32 ypos = (boxBottom + boxTop) / 2;
 	const int32 xpos = (boxRight + boxLeft) / 2;
 
-	setOrthoProjection(xpos, ypos, 0);
+	setIsoProjection(xpos, ypos, 0);
 	_engine->_interface->setClip(rect);
 
 	Common::Rect dummy;
@@ -1921,7 +1921,7 @@ void Renderer::renderBehaviourModel(const Common::Rect &rect, int32 y, int32 ang
 }
 
 void Renderer::renderInventoryItem(int32 x, int32 y, const BodyData &bodyData, int32 angle, int32 param) {
-	setCameraPosition(x, y, 128, 200, 200);
+	setProjection(x, y, 128, 200, 200);
 	setCameraAngle(0, 0, 0, 60, 0, 0, param);
 
 	Common::Rect dummy;
diff --git a/engines/twine/renderer/renderer.h b/engines/twine/renderer/renderer.h
index 901acb6d105..79756fc7fef 100644
--- a/engines/twine/renderer/renderer.h
+++ b/engines/twine/renderer/renderer.h
@@ -166,11 +166,11 @@ private:
 	IVec3 translateGroup(const IMatrix3x3 &matrix, int32 x, int32 y, int32 z);
 
 	IVec3 _baseTransPos;
-	IVec3 _projectionCenter;
+	IVec3 _projectionCenter{320, 200, 0};
 
-	int32 _cameraDepthOffset = 0;
-	int32 _cameraScaleX = 0;
-	int32 _cameraScaleY = 0;
+	int32 _kFactor = 128;
+	int32 _lFactorX = 1024;
+	int32 _lFactorY = 840;
 
 	IMatrix3x3 _baseMatrix;
 	IMatrix3x3 _matricesTable[30 + 1];
@@ -253,7 +253,6 @@ public:
 
 	IVec3 &projectPositionOnScreen(int32 cX, int32 cY, int32 cZ);
 
-	void setCameraPosition(int32 x, int32 y, int32 depthOffset, int32 scaleX, int32 scaleY);
 	void setCameraAngle(int32 transPosX, int32 transPosY, int32 transPosZ, int32 rotPosX, int32 rotPosY, int32 rotPosZ, int32 param6);
 	IVec3 updateCameraAnglePositions(int zShift = 0);
 	void setBaseTranslation(int32 x, int32 y, int32 z);
@@ -263,7 +262,8 @@ public:
 		return setAngleCamera(rot.x, rot.y, rot.z, transpose);
 	}
 
-	void setOrthoProjection(int32 x, int32 y, int32 z);
+	void setProjection(int32 x, int32 y, int32 depthOffset, int32 scaleX, int32 scaleY);
+	void setIsoProjection(int32 x, int32 y, int32 scale);
 
 	bool renderIsoModel(int32 x, int32 y, int32 z, int32 angleX, int32 angleY, int32 angleZ, const BodyData &bodyData, Common::Rect &modelRect);
 
diff --git a/engines/twine/scene/gamestate.cpp b/engines/twine/scene/gamestate.cpp
index d38a0515457..85840c457d3 100644
--- a/engines/twine/scene/gamestate.cpp
+++ b/engines/twine/scene/gamestate.cpp
@@ -56,7 +56,7 @@ GameState::GameState(TwinEEngine *engine) : _engine(engine) {
 }
 
 void GameState::initEngineProjections() {
-	_engine->_renderer->setOrthoProjection(_engine->width() / 2 - 9, _engine->height() / 2, 512);
+	_engine->_renderer->setIsoProjection(_engine->width() / 2 - 9, _engine->height() / 2, 512);
 	_engine->_renderer->setBaseTranslation(0, 0, 0);
 	_engine->_renderer->setAngleCamera(ANGLE_0, ANGLE_0, ANGLE_0);
 	_engine->_renderer->setLightVector(_engine->_scene->_alphaLight, _engine->_scene->_betaLight, ANGLE_0);
@@ -347,7 +347,7 @@ void GameState::processFoundItem(InventoryItems item) {
 
 	// process vox play
 	_engine->_music->stopMusic();
-	_engine->_text->initTextBank(TextBankId::Inventory_Intro_and_Holomap);
+	_engine->_text->initDial(TextBankId::Inventory_Intro_and_Holomap);
 
 	_engine->_interface->resetClip();
 	_engine->_text->initItemFoundText(item);
@@ -497,7 +497,7 @@ void GameState::processGameoverAnimation() {
 
 	_engine->_sound->stopSamples();
 	_engine->_music->stopMidiMusic(); // stop fade music
-	_engine->_renderer->setCameraPosition(_engine->width() / 2, _engine->height() / 2, 128, 200, 200);
+	_engine->_renderer->setProjection(_engine->width() / 2, _engine->height() / 2, 128, 200, 200);
 	int32 startLbaTime = _engine->_lbaTime;
 	const Common::Rect &rect = _engine->centerOnScreen(_engine->width() / 2, _engine->height() / 2);
 	_engine->_interface->setClip(rect);
diff --git a/engines/twine/script/script_life_v1.cpp b/engines/twine/script/script_life_v1.cpp
index 71694d67d48..acc1e4fbe1a 100644
--- a/engines/twine/script/script_life_v1.cpp
+++ b/engines/twine/script/script_life_v1.cpp
@@ -1855,11 +1855,11 @@ static int32 lPROJ_3D(TwinEEngine *engine, LifeScriptContext &ctx) {
 	engine->_screens->copyScreen(engine->_frontVideoBuffer, engine->_workVideoBuffer);
 	engine->_scene->_enableGridTileRendering = false;
 
-	engine->_renderer->setCameraPosition(engine->width() / 2, engine->height() / 2, 128, 1024, 1024);
+	engine->_renderer->setProjection(engine->width() / 2, engine->height() / 2, 128, 1024, 1024);
 	engine->_renderer->setCameraAngle(0, 1500, 0, 25, -128, 0, 13000);
 	engine->_renderer->setLightVector(ANGLE_315, ANGLE_334, ANGLE_0);
 
-	engine->_text->initTextBank(TextBankId::Credits);
+	engine->_text->initDial(TextBankId::Credits);
 
 	return 0;
 }
diff --git a/engines/twine/text.cpp b/engines/twine/text.cpp
index 3e2ec927495..16dac63ee74 100644
--- a/engines/twine/text.cpp
+++ b/engines/twine/text.cpp
@@ -148,7 +148,7 @@ bool Text::stopVox(const TextEntry *text) {
 	return true;
 }
 
-void Text::initTextBank(TextBankId bankIdx) {
+void Text::initDial(TextBankId bankIdx) {
 	// don't load if we already have the dialogue text bank loaded
 	if (bankIdx == _currentBankIdx) {
 		return;
@@ -159,7 +159,7 @@ void Text::initTextBank(TextBankId bankIdx) {
 }
 
 void Text::initSceneTextBank() {
-	initTextBank((TextBankId)((int)_engine->_scene->_sceneTextBank + (int)TextBankId::Citadel_Island));
+	initDial((TextBankId)((int)_engine->_scene->_sceneTextBank + (int)TextBankId::Citadel_Island));
 }
 
 void Text::drawCharacter(int32 x, int32 y, uint8 character) {
diff --git a/engines/twine/text.h b/engines/twine/text.h
index 9e249c4f8e1..6977040e8cb 100644
--- a/engines/twine/text.h
+++ b/engines/twine/text.h
@@ -162,7 +162,7 @@ public:
 	 * Initialize dialogue
 	 * @param bankIdx Text bank index
 	 */
-	void initTextBank(TextBankId bankIdx);
+	void initDial(TextBankId bankIdx);
 	void initSceneTextBank();
 	inline TextBankId textBank() const {
 		return _currentBankIdx;
@@ -224,7 +224,7 @@ public:
 
 	/**
 	 * Get dialogue text into text buffer from the currently loaded text bank
-	 * @sa initTextBank()
+	 * @sa initDial()
 	 * @param index dialogue index
 	 */
 	bool getText(TextId index);
diff --git a/engines/twine/twine.cpp b/engines/twine/twine.cpp
index 62d7dd79e19..f2be59a211c 100644
--- a/engines/twine/twine.cpp
+++ b/engines/twine/twine.cpp
@@ -630,7 +630,7 @@ void TwinEEngine::processActorSamplePosition(int32 actorIdx) {
 void TwinEEngine::processBookOfBu() {
 	_screens->fadeToBlack(_screens->_paletteRGBA);
 	_screens->loadImage(TwineImage(Resources::HQR_RESS_FILE, 15, 16));
-	_text->initTextBank(TextBankId::Inventory_Intro_and_Holomap);
+	_text->initDial(TextBankId::Inventory_Intro_and_Holomap);
 	_text->_drawTextBoxBackground = false;
 	_text->textClipFull();
 	_text->setFontCrossColor(COLOR_WHITE);
@@ -649,7 +649,7 @@ void TwinEEngine::processBookOfBu() {
 }
 
 void TwinEEngine::processBonusList() {
-	_text->initTextBank(TextBankId::Inventory_Intro_and_Holomap);
+	_text->initDial(TextBankId::Inventory_Intro_and_Holomap);
 	_text->textClipFull();
 	_text->setFontCrossColor(COLOR_WHITE);
 	const bool tmpFlagDisplayText = _cfgfile.FlagDisplayText;


Commit: 38ce97cb9ced8f5b1012c7850f26efe3adcec8d8
    https://github.com/scummvm/scummvm/commit/38ce97cb9ced8f5b1012c7850f26efe3adcec8d8
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2023-01-15T11:28:58+01:00

Commit Message:
TWINE: debug command to switch the game chapter

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


diff --git a/engines/twine/debugger/console.cpp b/engines/twine/debugger/console.cpp
index d224bfd67e9..2fd3c3aa1b0 100644
--- a/engines/twine/debugger/console.cpp
+++ b/engines/twine/debugger/console.cpp
@@ -46,6 +46,7 @@ TwinEConsole::TwinEConsole(TwinEEngine *engine) : _engine(engine), GUI::Debugger
 	registerCmd("play_midi", WRAP_METHOD(TwinEConsole, doPlayMidi));
 	registerCmd("play_music", WRAP_METHOD(TwinEConsole, doPlayMusic));
 	registerCmd("change_scene", WRAP_METHOD(TwinEConsole, doChangeScene));
+	registerCmd("change_chapter", WRAP_METHOD(TwinEConsole, doChangeChapter));
 	registerCmd("toggle_scenery_view", WRAP_METHOD(TwinEConsole, doToggleSceneryView));
 	registerCmd("magic_points", WRAP_METHOD(TwinEConsole, doAddMagicPoints));
 	registerCmd("dumpfile", WRAP_METHOD(TwinEConsole, doDumpFile));
@@ -424,6 +425,16 @@ bool TwinEConsole::doChangeScene(int argc, const char **argv) {
 	return true;
 }
 
+bool TwinEConsole::doChangeChapter(int argc, const char **argv) {
+	if (argc <= 1) {
+		debugPrintf("Expected to get a chapter index as first parameter\n");
+		return true;
+	}
+	debugPrintf("Old chapter was: %i\n", _engine->_gameState->_gameChapter);
+	_engine->_gameState->_gameChapter = (int16)atoi(argv[1]);
+	return true;
+}
+
 bool TwinEConsole::doDumpFile(int argc, const char **argv) {
 	if (argc <= 2) {
 		debugPrintf("Expected to get a a hqr file and an index\n");
diff --git a/engines/twine/debugger/console.h b/engines/twine/debugger/console.h
index 311480e5daa..ba17d3b26c0 100644
--- a/engines/twine/debugger/console.h
+++ b/engines/twine/debugger/console.h
@@ -63,6 +63,7 @@ private:
 	bool doToggleSceneChanges(int argc, const char **argv);
 	bool doToggleSceneRendering(int argc, const char **argv);
 	bool doSetTrackObject(int argc, const char **argv);
+	bool doChangeChapter(int argc, const char **argv);
 	bool doSkipSceneActorsBut(int argc, const char **argv);
 	bool doSetGameFlag(int argc, const char **argv);
 	bool doSetInventoryFlag(int argc, const char **argv);
diff --git a/engines/twine/script/script_life_v1.cpp b/engines/twine/script/script_life_v1.cpp
index acc1e4fbe1a..ed6d2fbd36e 100644
--- a/engines/twine/script/script_life_v1.cpp
+++ b/engines/twine/script/script_life_v1.cpp
@@ -1033,6 +1033,7 @@ static int32 lMESSAGE_OBJ(TwinEEngine *engine, LifeScriptContext &ctx) {
 static int32 lINC_CHAPTER(TwinEEngine *engine, LifeScriptContext &ctx) {
 	debugC(3, kDebugLevels::kDebugScripts, "LIFE::INC_CHAPTER()");
 	engine->_gameState->_gameChapter++;
+	debug("Switched chapter to %i", engine->_gameState->_gameChapter);
 	return 0;
 }
 


Commit: decbede936863c22bf5a99617d9ff4149207ec3f
    https://github.com/scummvm/scummvm/commit/decbede936863c22bf5a99617d9ff4149207ec3f
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2023-01-15T11:28:58+01:00

Commit Message:
TWINE: renamed members and methods

Changed paths:
    engines/twine/menu/menu.cpp
    engines/twine/renderer/redraw.cpp
    engines/twine/scene/actor.cpp
    engines/twine/scene/actor.h
    engines/twine/scene/animations.cpp
    engines/twine/scene/animations.h
    engines/twine/scene/collision.cpp
    engines/twine/scene/gamestate.cpp
    engines/twine/script/script_life_v1.cpp


diff --git a/engines/twine/menu/menu.cpp b/engines/twine/menu/menu.cpp
index 2f90ca70694..b7cb18b1ec0 100644
--- a/engines/twine/menu/menu.cpp
+++ b/engines/twine/menu/menu.cpp
@@ -1072,7 +1072,7 @@ void Menu::drawBehaviour(int32 left, int32 top, HeroBehaviourType behaviour, int
 
 void Menu::prepareAndDrawBehaviour(int32 left, int32 top, int32 angle, HeroBehaviourType behaviour) {
 	const int animIdx = _engine->_actor->_heroAnimIdx[(byte)behaviour];
-	_engine->_animations->setAnimAtKeyframe(_behaviourAnimState[(byte)behaviour], _engine->_resources->_animData[animIdx], *_behaviourEntity, &_behaviourAnimData[(byte)behaviour]);
+	_engine->_animations->setAnimObjet(_behaviourAnimState[(byte)behaviour], _engine->_resources->_animData[animIdx], *_behaviourEntity, &_behaviourAnimData[(byte)behaviour]);
 	drawBehaviour(left, top, behaviour, angle, false);
 }
 
@@ -1135,7 +1135,7 @@ void Menu::processBehaviourMenu(bool behaviourMenu) {
 		HeroBehaviourType tmpHeroBehaviour = _engine->_actor->_heroBehaviour;
 
 		const int animIdx = _engine->_actor->_heroAnimIdx[(byte)_engine->_actor->_heroBehaviour];
-		_engine->_animations->setAnimAtKeyframe(_behaviourAnimState[(byte)_engine->_actor->_heroBehaviour], _engine->_resources->_animData[animIdx], *_behaviourEntity, &_behaviourAnimData[(byte)_engine->_actor->_heroBehaviour]);
+		_engine->_animations->setAnimObjet(_behaviourAnimState[(byte)_engine->_actor->_heroBehaviour], _engine->_resources->_animData[animIdx], *_behaviourEntity, &_behaviourAnimData[(byte)_engine->_actor->_heroBehaviour]);
 
 		int32 tmpTime = _engine->_lbaTime;
 
@@ -1182,7 +1182,7 @@ void Menu::processBehaviourMenu(bool behaviourMenu) {
 				tmpHeroBehaviour = _engine->_actor->_heroBehaviour;
 				_engine->_movements->setActorAngleSafe(_engine->_scene->_sceneHero->_angle, _engine->_scene->_sceneHero->_angle - ANGLE_90, ANGLE_17, &_moveMenu);
 				const int tmpAnimIdx = _engine->_actor->_heroAnimIdx[(byte)_engine->_actor->_heroBehaviour];
-				_engine->_animations->setAnimAtKeyframe(_behaviourAnimState[(byte)_engine->_actor->_heroBehaviour], _engine->_resources->_animData[tmpAnimIdx], *_behaviourEntity, &_behaviourAnimData[(byte)_engine->_actor->_heroBehaviour]);
+				_engine->_animations->setAnimObjet(_behaviourAnimState[(byte)_engine->_actor->_heroBehaviour], _engine->_resources->_animData[tmpAnimIdx], *_behaviourEntity, &_behaviourAnimData[(byte)_engine->_actor->_heroBehaviour]);
 			}
 
 			drawBehaviour(left, top, _engine->_actor->_heroBehaviour, -1, true);
diff --git a/engines/twine/renderer/redraw.cpp b/engines/twine/renderer/redraw.cpp
index 2f333da54b4..2eaa944627a 100644
--- a/engines/twine/renderer/redraw.cpp
+++ b/engines/twine/renderer/redraw.cpp
@@ -345,9 +345,9 @@ void Redraw::processDrawListShadows(const DrawListStruct &drawCmd) {
 void Redraw::processDrawListActors(const DrawListStruct &drawCmd, bool bgRedraw) {
 	const int32 actorIdx = drawCmd.actorIdx;
 	ActorStruct *actor = _engine->_scene->getActor(actorIdx);
-	if (actor->_previousAnimIdx >= 0) {
-		const AnimData &animData = _engine->_resources->_animData[actor->_previousAnimIdx];
-		_engine->_animations->setModelAnimation(actor->_animPosition, animData, _engine->_resources->_bodyData[actor->_body], &actor->_animTimerData);
+	if (actor->_anim >= 0) {
+		const AnimData &animData = _engine->_resources->_animData[actor->_anim];
+		_engine->_animations->setModelAnimation(actor->_frame, animData, _engine->_resources->_bodyData[actor->_body], &actor->_animTimerData);
 	}
 
 	const IVec3 &delta = actor->posObj() - _engine->_grid->_camera;
diff --git a/engines/twine/scene/actor.cpp b/engines/twine/scene/actor.cpp
index a1b3f9ad555..5bb9c0c4d78 100644
--- a/engines/twine/scene/actor.cpp
+++ b/engines/twine/scene/actor.cpp
@@ -90,7 +90,7 @@ void Actor::loadHeroEntities() {
 	loadBehaviourEntity(sceneHero, _heroEntityNORMAL, _heroAnimIdxNORMAL, FILE3DHQR_HERONORMAL);
 
 	_engine->_animations->_currentActorAnimExtraPtr = AnimationTypes::kStanding;
-	sceneHero->_animExtraPtr = _engine->_animations->_currentActorAnimExtraPtr;
+	sceneHero->_ptrAnimAction = _engine->_animations->_currentActorAnimExtraPtr;
 }
 
 void Actor::setBehaviour(HeroBehaviourType behaviour) {
@@ -126,7 +126,7 @@ void Actor::setBehaviour(HeroBehaviourType behaviour) {
 	initModelActor(bodyIdx, OWN_ACTOR_SCENE_INDEX);
 
 	sceneHero->_genAnim = AnimationTypes::kAnimNone;
-	sceneHero->_animType = AnimType::kAnimationTypeLoop;
+	sceneHero->_flagAnim = AnimType::kAnimationTypeLoop;
 
 	_engine->_animations->initAnim(AnimationTypes::kStanding, AnimType::kAnimationTypeLoop, AnimationTypes::kAnimInvalid, OWN_ACTOR_SCENE_INDEX);
 }
@@ -242,8 +242,8 @@ void Actor::initActor(int16 actorIdx) {
 		debug(1, "Init actor %i with model %i", actorIdx, (int)actor->_genBody);
 		initModelActor(actor->_genBody, actorIdx);
 
-		actor->_previousAnimIdx = -1;
-		actor->_animType = AnimType::kAnimationTypeLoop;
+		actor->_anim = -1;
+		actor->_flagAnim = AnimType::kAnimationTypeLoop;
 
 		if (actor->_body != -1) {
 			_engine->_animations->initAnim(actor->_genAnim, AnimType::kAnimationTypeLoop, AnimationTypes::kAnimInvalid, actorIdx);
@@ -286,12 +286,12 @@ void Actor::hitObj(int32 actorIdx, int32 actorIdxAttacked, int32 strengthOfHit,
 
 	if (actor->_armor <= strengthOfHit) {
 		if (actor->_genAnim == AnimationTypes::kBigHit || actor->_genAnim == AnimationTypes::kHit2) {
-			const int32 tmpAnimPos = actor->_animPosition;
-			if (actor->_animExtra != AnimationTypes::kStanding) {
+			if (actor->_nextGenAnim != AnimationTypes::kStanding) {
+				const int32 tmpAnimPos = actor->_frame;
 				_engine->_animations->processAnimActions(actorIdxAttacked);
+				actor->_frame = tmpAnimPos;
 			}
 
-			actor->_animPosition = tmpAnimPos;
 		} else {
 			if (angle != -1) {
 				_engine->_movements->setActorAngleSafe(angle, angle, ANGLE_0, &actor->_move);
diff --git a/engines/twine/scene/actor.h b/engines/twine/scene/actor.h
index dfa83bdb8fe..d115d0028b9 100644
--- a/engines/twine/scene/actor.h
+++ b/engines/twine/scene/actor.h
@@ -93,7 +93,7 @@ struct DynamicFlagsStruct {
 	uint16 bWaitHitFrame : 1;            // 0x0001 WAIT_HIT_FRAME - wait for hit frame
 	uint16 bIsHitting : 1;               // 0x0002 OK_HIT - hit frame anim
 	uint16 bAnimEnded : 1;               // 0x0004 ANIM_END - anim ended in the current loop (will be looped in the next engine loop)
-	uint16 bAnimFrameReached : 1;        // 0x0008 NEW_FRAME - new frame anim reached
+	uint16 bAnimNewFrame : 1;        // 0x0008 NEW_FRAME - new frame anim reached
 	uint16 bIsDrawn : 1;                 // 0x0010 WAS_DRAWN - actor has been drawn in this loop
 	uint16 bIsDead : 1;                  // 0x0020 OBJ_DEAD - is dead
 	uint16 bIsSpriteMoving : 1;          // 0x0040 AUTO_STOP_DOOR - door is opening or closing (wait to reach the destination position)
@@ -170,8 +170,8 @@ public:
 	int32 _body = -1; // costumeIndex - index into bodyTable
 	BodyType _genBody = BodyType::btNormal;
 	AnimationTypes _genAnim = AnimationTypes::kAnimNone;
-	AnimationTypes _animExtra = AnimationTypes::kStanding;
-	AnimationTypes _animExtraPtr = AnimationTypes::kAnimNone;
+	AnimationTypes _nextGenAnim = AnimationTypes::kStanding;
+	AnimationTypes _ptrAnimAction = AnimationTypes::kAnimNone;
 	int32 _sprite = 0;
 	EntityData *_entityDataPtr = nullptr;
 
@@ -222,12 +222,12 @@ public:
 	int32 _carryBy = -1;
 	int32 _zone = -1;
 
-	int32 _lastRotationAngle = ANGLE_0;
+	int32 _animStepBeta = ANGLE_0;
 	IVec3 _animStep;
-	int32 _previousAnimIdx = -1;
+	int32 _anim = -1;
 	int32 _doorWidth = 0;
-	int32 _animPosition = 0;
-	AnimType _animType = AnimType::kAnimationTypeLoop;
+	int32 _frame = 0;
+	AnimType _flagAnim = AnimType::kAnimationTypeLoop;
 	int32 _spriteActorRotation = 0;
 	uint8 _brickSound = 0U; // CodeJeu
 
diff --git a/engines/twine/scene/animations.cpp b/engines/twine/scene/animations.cpp
index e94238d4f03..92031262179 100644
--- a/engines/twine/scene/animations.cpp
+++ b/engines/twine/scene/animations.cpp
@@ -51,7 +51,7 @@ static const int32 magicLevelStrengthOfHit[] = {
 Animations::Animations(TwinEEngine *engine) : _engine(engine) {
 }
 
-int32 Animations::getBodyAnimIndex(AnimationTypes animIdx, int32 actorIdx) {
+int32 Animations::searchAnim(AnimationTypes animIdx, int32 actorIdx) {
 	ActorStruct *actor = _engine->_scene->getActor(actorIdx);
 	const int32 bodyAnimIndex = actor->_entityDataPtr->getAnimIndex(animIdx);
 	if (bodyAnimIndex != -1) {
@@ -166,7 +166,7 @@ bool Animations::setModelAnimation(int32 keyframeIdx, const AnimData &animData,
 	return false;
 }
 
-void Animations::setAnimAtKeyframe(int32 keyframeIdx, const AnimData &animData, BodyData &bodyData, AnimTimerDataStruct *animTimerDataPtr) {
+void Animations::setAnimObjet(int32 keyframeIdx, const AnimData &animData, BodyData &bodyData, AnimTimerDataStruct *animTimerDataPtr) {
 	if (!bodyData.isAnimated()) {
 		return;
 	}
@@ -198,7 +198,7 @@ void Animations::setAnimAtKeyframe(int32 keyframeIdx, const AnimData &animData,
 	copyKeyFrameToState(keyFrame, bodyData, numOfBonesInAnim);
 }
 
-void Animations::stockAnimation(const BodyData &bodyData, AnimTimerDataStruct *animTimerDataPtr) {
+void Animations::stockInterAnim(const BodyData &bodyData, AnimTimerDataStruct *animTimerDataPtr) {
 	if (!bodyData.isAnimated()) {
 		return;
 	}
@@ -262,80 +262,80 @@ bool Animations::verifyAnimAtKeyframe(int32 keyframeIdx, const AnimData &animDat
 	return false;
 }
 
-void Animations::processAnimActions(int32 actorIdx) {
+void Animations::processAnimActions(int32 actorIdx) { // GereAnimAction
 	ActorStruct *actor = _engine->_scene->getActor(actorIdx);
-	if (actor->_entityDataPtr == nullptr || actor->_animExtraPtr == AnimationTypes::kAnimNone) {
+	if (actor->_entityDataPtr == nullptr || actor->_ptrAnimAction == AnimationTypes::kAnimNone) {
 		return;
 	}
 
-	const Common::Array<EntityAnim::Action> *actions = actor->_entityDataPtr->getActions(actor->_animExtraPtr);
+	const Common::Array<EntityAnim::Action> *actions = actor->_entityDataPtr->getActions(actor->_ptrAnimAction);
 	if (actions == nullptr) {
 		return;
 	}
 	for (const EntityAnim::Action &action : *actions) {
 		switch (action.type) {
 		case ActionType::ACTION_HITTING:
-			if (action.animFrame - 1 == actor->_animPosition) {
+			if (action.animFrame - 1 == actor->_frame) {
 				actor->_strengthOfHit = action.strength;
 				actor->_dynamicFlags.bIsHitting = 1;
 			}
 			break;
 		case ActionType::ACTION_SAMPLE:
 		case ActionType::ACTION_SAMPLE_FREQ:
-			if (action.animFrame == actor->_animPosition) {
+			if (action.animFrame == actor->_frame) {
 				_engine->_sound->playSample(action.sampleIndex, 1, actor->posObj(), actorIdx);
 			}
 			break;
 		case ActionType::ACTION_THROW_EXTRA_BONUS:
-			if (action.animFrame == actor->_animPosition) {
+			if (action.animFrame == actor->_frame) {
 				_engine->_extra->throwExtra(actorIdx, actor->_pos.x, actor->_pos.y + action.yHeight, actor->_pos.z, action.spriteIndex, action.xAngle, actor->_angle + action.yAngle, action.xRotPoint, action.extraAngle, action.strength);
 			}
 			break;
 		case ActionType::ACTION_THROW_MAGIC_BALL:
-			if (_engine->_gameState->_magicBall == -1 && action.animFrame == actor->_animPosition) {
+			if (_engine->_gameState->_magicBall == -1 && action.animFrame == actor->_frame) {
 				_engine->_extra->addExtraThrowMagicball(actor->_pos.x, actor->_pos.y + action.yHeight, actor->_pos.z, action.xAngle, actor->_angle + action.yAngle, action.xRotPoint, action.extraAngle);
 			}
 			break;
 		case ActionType::ACTION_SAMPLE_REPEAT:
-			if (action.animFrame == actor->_animPosition) {
+			if (action.animFrame == actor->_frame) {
 				_engine->_sound->playSample(action.sampleIndex, action.repeat, actor->posObj(), actorIdx);
 			}
 			break;
 		case ActionType::ACTION_THROW_SEARCH:
-			if (action.animFrame == actor->_animPosition) {
+			if (action.animFrame == actor->_frame) {
 				_engine->_extra->addExtraAiming(actorIdx, actor->_pos.x, actor->_pos.y + action.yHeight, actor->_pos.z, action.spriteIndex, action.targetActor, action.finalAngle, action.strength);
 			}
 			break;
 		case ActionType::ACTION_THROW_ALPHA:
-			if (action.animFrame == actor->_animPosition) {
+			if (action.animFrame == actor->_frame) {
 				_engine->_extra->throwExtra(actorIdx, actor->_pos.x, actor->_pos.y + action.yHeight, actor->_pos.z, action.spriteIndex, action.xAngle, actor->_angle + action.yAngle, action.xRotPoint, action.extraAngle, action.strength);
 			}
 			break;
 		case ActionType::ACTION_SAMPLE_STOP:
-			if (action.animFrame == actor->_animPosition) {
+			if (action.animFrame == actor->_frame) {
 				_engine->_sound->stopSample(action.sampleIndex);
 			}
 			break;
 		case ActionType::ACTION_LEFT_STEP:
-			if (action.animFrame == actor->_animPosition && (actor->_brickSound & 0xF0U) != 0xF0U) {
+			if (action.animFrame == actor->_frame && (actor->_brickSound & 0xF0U) != 0xF0U) {
 				const int16 sampleIdx = (actor->_brickSound & 0x0FU) + Samples::WalkFloorBegin;
 				_engine->_sound->playSample(sampleIdx, 1, actor->posObj(), actorIdx);
 			}
 			break;
 		case ActionType::ACTION_RIGHT_STEP:
-			if (action.animFrame == actor->_animPosition && (actor->_brickSound & 0xF0U) != 0xF0U) {
+			if (action.animFrame == actor->_frame && (actor->_brickSound & 0xF0U) != 0xF0U) {
 				const int16 sampleIdx = (actor->_brickSound & 0x0FU) + Samples::WalkFloorRightBegin;
 				_engine->_sound->playSample(sampleIdx, 1, actor->posObj(), actorIdx);
 			}
 			break;
 		case ActionType::ACTION_HERO_HITTING:
-			if (action.animFrame - 1 == actor->_animPosition) {
+			if (action.animFrame - 1 == actor->_frame) {
 				actor->_strengthOfHit = magicLevelStrengthOfHit[_engine->_gameState->_magicLevelIdx];
 				actor->_dynamicFlags.bIsHitting = 1;
 			}
 			break;
 		case ActionType::ACTION_THROW_3D:
-			if (action.animFrame == actor->_animPosition) {
+			if (action.animFrame == actor->_frame) {
 				const IVec3 &destPos = _engine->_movements->rotateActor(action.distanceX, action.distanceZ, actor->_angle);
 
 				const int32 throwX = destPos.x + actor->_pos.x;
@@ -347,7 +347,7 @@ void Animations::processAnimActions(int32 actorIdx) {
 			}
 			break;
 		case ActionType::ACTION_THROW_3D_ALPHA:
-			if (action.animFrame == actor->_animPosition) {
+			if (action.animFrame == actor->_frame) {
 				const int32 distance = getDistance2D(actor->posObj(), _engine->_scene->_sceneHero->posObj());
 				const int32 newAngle = _engine->_movements->getAngleAndSetTargetActorDistance(actor->_pos.y, 0, _engine->_scene->_sceneHero->_pos.y, distance);
 
@@ -362,7 +362,7 @@ void Animations::processAnimActions(int32 actorIdx) {
 			}
 			break;
 		case ActionType::ACTION_THROW_3D_SEARCH:
-			if (action.animFrame == actor->_animPosition) {
+			if (action.animFrame == actor->_frame) {
 				const IVec3 &destPos = _engine->_movements->rotateActor(action.distanceX, action.distanceZ, actor->_angle);
 				const int32 x = actor->_pos.x + destPos.x;
 				const int32 y = actor->_pos.y + action.distanceY;
@@ -372,7 +372,7 @@ void Animations::processAnimActions(int32 actorIdx) {
 			}
 			break;
 		case ActionType::ACTION_THROW_3D_MAGIC:
-			if (_engine->_gameState->_magicBall == -1 && action.animFrame == actor->_animPosition) {
+			if (_engine->_gameState->_magicBall == -1 && action.animFrame == actor->_frame) {
 				const IVec3 &destPos = _engine->_movements->rotateActor(action.distanceX, action.distanceZ, actor->_angle);
 				const int32 x = actor->_pos.x + destPos.x;
 				const int32 y = actor->_pos.y + action.distanceY;
@@ -387,7 +387,7 @@ void Animations::processAnimActions(int32 actorIdx) {
 	}
 }
 
-bool Animations::initAnim(AnimationTypes newAnim, AnimType animType, AnimationTypes animExtra, int32 actorIdx) {
+bool Animations::initAnim(AnimationTypes newAnim, AnimType flag, AnimationTypes genNextAnim, int32 actorIdx) {
 	ActorStruct *actor = _engine->_scene->getActor(actorIdx);
 	if (actor->_body == -1) {
 		return false;
@@ -397,63 +397,65 @@ bool Animations::initAnim(AnimationTypes newAnim, AnimType animType, AnimationTy
 		return false;
 	}
 
-	if (newAnim == actor->_genAnim && actor->_previousAnimIdx != -1) {
+	if (newAnim == actor->_genAnim && actor->_anim != -1) {
 		return true;
 	}
 
-	if (animExtra == AnimationTypes::kAnimInvalid && actor->_animType != AnimType::kAnimationAllThen) {
-		animExtra = actor->_genAnim;
+	if (genNextAnim == AnimationTypes::kAnimInvalid && actor->_flagAnim != AnimType::kAnimationAllThen) {
+		genNextAnim = actor->_genAnim;
 	}
 
-	int32 animIndex = getBodyAnimIndex(newAnim, actorIdx);
+	int32 newanim = searchAnim(newAnim, actorIdx);
 
-	if (animIndex == -1) {
-		animIndex = getBodyAnimIndex(AnimationTypes::kStanding, actorIdx);
-		if (animIndex == -1) {
+	if (newanim == -1) {
+		newanim = searchAnim(AnimationTypes::kStanding, actorIdx);
+		if (newanim == -1) {
 			error("Could not find anim index for 'standing' (actor %i)", actorIdx);
 		}
 	}
 
-	if (animType != AnimType::kAnimationSet && actor->_animType == AnimType::kAnimationAllThen) {
-		actor->_animExtra = newAnim;
+	if (flag != AnimType::kAnimationSet && actor->_flagAnim == AnimType::kAnimationAllThen) {
+		actor->_nextGenAnim = newAnim;
 		return false;
 	}
 
-	if (animType == AnimType::kAnimationInsert) {
-		animType = AnimType::kAnimationAllThen;
+	if (flag == AnimType::kAnimationInsert) {
+		flag = AnimType::kAnimationAllThen;
 
-		animExtra = actor->_genAnim;
+		genNextAnim = actor->_genAnim;
 
-		if (animExtra == AnimationTypes::kThrowBall || animExtra == AnimationTypes::kFall || animExtra == AnimationTypes::kLanding || animExtra == AnimationTypes::kLandingHit) {
-			animExtra = AnimationTypes::kStanding;
+		if (genNextAnim == AnimationTypes::kThrowBall || genNextAnim == AnimationTypes::kFall || genNextAnim == AnimationTypes::kLanding || genNextAnim == AnimationTypes::kLandingHit) {
+			genNextAnim = AnimationTypes::kStanding;
 		}
 	}
 
-	if (animType == AnimType::kAnimationSet) {
-		animType = AnimType::kAnimationAllThen;
+	if (flag == AnimType::kAnimationSet) {
+		flag = AnimType::kAnimationAllThen;
 	}
 
-	if (actor->_previousAnimIdx == -1) {
+	if (actor->_anim == -1) {
 		// if no previous animation
-		setAnimAtKeyframe(0, _engine->_resources->_animData[animIndex], _engine->_resources->_bodyData[actor->_body], &actor->_animTimerData);
+		setAnimObjet(0, _engine->_resources->_animData[newanim], _engine->_resources->_bodyData[actor->_body], &actor->_animTimerData);
 	} else {
 		// interpolation between animations
-		stockAnimation(_engine->_resources->_bodyData[actor->_body], &actor->_animTimerData);
+		stockInterAnim(_engine->_resources->_bodyData[actor->_body], &actor->_animTimerData);
 	}
 
-	actor->_previousAnimIdx = animIndex;
+	actor->_anim = newanim;
 	actor->_genAnim = newAnim;
-	actor->_animExtra = animExtra;
-	actor->_animExtraPtr = _currentActorAnimExtraPtr;
-	actor->_animType = animType;
-	actor->_animPosition = 0;
+	actor->_nextGenAnim = genNextAnim;
+	actor->_ptrAnimAction = _currentActorAnimExtraPtr;
+
+	actor->_flagAnim = flag;
+	actor->_frame = 0;
+
 	actor->_dynamicFlags.bIsHitting = 0;
 	actor->_dynamicFlags.bAnimEnded = 0;
-	actor->_dynamicFlags.bAnimFrameReached = 1;
+	actor->_dynamicFlags.bAnimNewFrame = 1;
 
 	processAnimActions(actorIdx);
 
-	actor->_lastRotationAngle = ANGLE_0;
+	actor->_animStepBeta = ANGLE_0;
 	actor->_animStep = IVec3();
 
 	return true;
@@ -560,12 +562,12 @@ void Animations::doAnim(int32 actorIdx) {
 			}
 		}
 	} else { // 3D actor
-		if (actor->_previousAnimIdx != -1) {
-			const AnimData &animData = _engine->_resources->_animData[actor->_previousAnimIdx];
+		if (actor->_anim != -1) {
+			const AnimData &animData = _engine->_resources->_animData[actor->_anim];
 
 			bool keyFramePassed = false;
 			if (_engine->_resources->_bodyData[actor->_body].isAnimated()) {
-				keyFramePassed = verifyAnimAtKeyframe(actor->_animPosition, animData, &actor->_animTimerData);
+				keyFramePassed = verifyAnimAtKeyframe(actor->_frame, animData, &actor->_animTimerData);
 			}
 
 			if (_processRotationByAnim) {
@@ -574,8 +576,8 @@ void Animations::doAnim(int32 actorIdx) {
 				actor->_dynamicFlags.bIsRotationByAnim = 0;
 			}
 
-			actor->_angle = ClampAngle(actor->_angle + _processLastRotationAngle - actor->_lastRotationAngle);
-			actor->_lastRotationAngle = _processLastRotationAngle;
+			actor->_angle = ClampAngle(actor->_angle + _processLastRotationAngle - actor->_animStepBeta);
+			actor->_animStepBeta = _processLastRotationAngle;
 
 			const IVec3 &destPos = _engine->_movements->rotateActor(_currentStep.x, _currentStep.z, actor->_angle);
 
@@ -587,34 +589,34 @@ void Animations::doAnim(int32 actorIdx) {
 			actor->_animStep = _currentStep;
 
 			actor->_dynamicFlags.bAnimEnded = 0;
-			actor->_dynamicFlags.bAnimFrameReached = 0;
+			actor->_dynamicFlags.bAnimNewFrame = 0;
 
 			if (keyFramePassed) {
-				actor->_animPosition++;
-				actor->_dynamicFlags.bAnimFrameReached = 1;
+				actor->_frame++;
+				actor->_dynamicFlags.bAnimNewFrame = 1;
 
 				// if actor have animation actions to process
 				processAnimActions(actorIdx);
 
-				int16 numKeyframe = actor->_animPosition;
+				int16 numKeyframe = actor->_frame;
 				if (numKeyframe == (int16)animData.getNumKeyframes()) {
 					actor->_dynamicFlags.bIsHitting = 0;
 
-					if (actor->_animType == AnimType::kAnimationTypeLoop) {
-						actor->_animPosition = animData.getLoopFrame();
+					if (actor->_flagAnim == AnimType::kAnimationTypeLoop) {
+						actor->_frame = animData.getLoopFrame();
 					} else {
-						actor->_genAnim = actor->_animExtra;
-						actor->_previousAnimIdx = getBodyAnimIndex(actor->_genAnim, actorIdx);
+						actor->_genAnim = actor->_nextGenAnim;
+						actor->_anim = searchAnim(actor->_genAnim, actorIdx);
 
-						if (actor->_previousAnimIdx == -1) {
-							actor->_previousAnimIdx = getBodyAnimIndex(AnimationTypes::kStanding, actorIdx);
+						if (actor->_anim == -1) {
+							actor->_anim = searchAnim(AnimationTypes::kStanding, actorIdx);
 							actor->_genAnim = AnimationTypes::kStanding;
 						}
 
-						actor->_animExtraPtr = _currentActorAnimExtraPtr;
+						actor->_ptrAnimAction = _currentActorAnimExtraPtr;
 
-						actor->_animType = AnimType::kAnimationTypeLoop;
-						actor->_animPosition = 0;
+						actor->_flagAnim = AnimType::kAnimationTypeLoop;
+						actor->_frame = 0;
 						actor->_strengthOfHit = 0;
 					}
 
@@ -623,7 +625,7 @@ void Animations::doAnim(int32 actorIdx) {
 					actor->_dynamicFlags.bAnimEnded = 1;
 				}
 
-				actor->_lastRotationAngle = ANGLE_0;
+				actor->_animStepBeta = ANGLE_0;
 
 				actor->_animStep = IVec3();
 			}
diff --git a/engines/twine/scene/animations.h b/engines/twine/scene/animations.h
index efad7d01360..5b4f6c83410 100644
--- a/engines/twine/scene/animations.h
+++ b/engines/twine/scene/animations.h
@@ -72,7 +72,7 @@ public:
 	 * @param bodyData Body model data
 	 * @param animTimerDataPtr Animation time data
 	 */
-	void setAnimAtKeyframe(int32 keyframeIdx, const AnimData &animData, BodyData &bodyData, AnimTimerDataStruct *animTimerDataPtr);
+	void setAnimObjet(int32 keyframeIdx, const AnimData &animData, BodyData &bodyData, AnimTimerDataStruct *animTimerDataPtr);
 
 	/**
 	 * Set new body animation
@@ -88,14 +88,14 @@ public:
 	 * @param animIdx Entity animation index
 	 * @param actorIdx Actor index
 	 */
-	int32 getBodyAnimIndex(AnimationTypes animIdx, int32 actorIdx = OWN_ACTOR_SCENE_INDEX);
+	int32 searchAnim(AnimationTypes animIdx, int32 actorIdx = OWN_ACTOR_SCENE_INDEX);
 
 	/**
 	 * Stock animation - copy the next keyFrame from a different buffer
 	 * @param bodyData Body model data
 	 * @param animTimerDataPtr Animation time data
 	 */
-	void stockAnimation(const BodyData &bodyData, AnimTimerDataStruct *animTimerDataPtr);
+	void stockInterAnim(const BodyData &bodyData, AnimTimerDataStruct *animTimerDataPtr);
 
 	/**
 	 * Initialize animation
diff --git a/engines/twine/scene/collision.cpp b/engines/twine/scene/collision.cpp
index e5ca312b9b6..074d97ba6be 100644
--- a/engines/twine/scene/collision.cpp
+++ b/engines/twine/scene/collision.cpp
@@ -444,7 +444,7 @@ void Collision::receptionObj(int actorIdx) {
 
 		_engine->_scene->_startYFalling = 0;
 	} else {
-		_engine->_animations->initAnim(AnimationTypes::kLanding, AnimType::kAnimationAllThen, _engine->_actor->_processActorPtr->_animExtra, actorIdx);
+		_engine->_animations->initAnim(AnimationTypes::kLanding, AnimType::kAnimationAllThen, _engine->_actor->_processActorPtr->_nextGenAnim, actorIdx);
 	}
 
 	_engine->_actor->_processActorPtr->_dynamicFlags.bIsFalling = 0;
diff --git a/engines/twine/scene/gamestate.cpp b/engines/twine/scene/gamestate.cpp
index 85840c457d3..78194efb0b6 100644
--- a/engines/twine/scene/gamestate.cpp
+++ b/engines/twine/scene/gamestate.cpp
@@ -357,12 +357,12 @@ void GameState::processFoundItem(InventoryItems item) {
 
 	_engine->_text->initVoxToPlayTextId((TextId)item);
 
-	const int32 bodyAnimIdx = _engine->_animations->getBodyAnimIndex(AnimationTypes::kFoundItem);
+	const int32 bodyAnimIdx = _engine->_animations->searchAnim(AnimationTypes::kFoundItem);
 	const AnimData &currentAnimData = _engine->_resources->_animData[bodyAnimIdx];
 
 	AnimTimerDataStruct tmpAnimTimer = _engine->_scene->_sceneHero->_animTimerData;
 
-	_engine->_animations->stockAnimation(bodyData, &_engine->_scene->_sceneHero->_animTimerData);
+	_engine->_animations->stockInterAnim(bodyData, &_engine->_scene->_sceneHero->_animTimerData);
 
 	uint currentAnimState = 0;
 
diff --git a/engines/twine/script/script_life_v1.cpp b/engines/twine/script/script_life_v1.cpp
index ed6d2fbd36e..63514a42144 100644
--- a/engines/twine/script/script_life_v1.cpp
+++ b/engines/twine/script/script_life_v1.cpp
@@ -1769,7 +1769,7 @@ static int32 lANIM_SET(TwinEEngine *engine, LifeScriptContext &ctx) {
 	debugC(3, kDebugLevels::kDebugScripts, "LIFE::ANIM_SET(%i)", (int)animIdx);
 
 	ctx.actor->_genAnim = AnimationTypes::kAnimNone;
-	ctx.actor->_previousAnimIdx = -1;
+	ctx.actor->_anim = -1;
 	engine->_animations->initAnim(animIdx, AnimType::kAnimationTypeLoop, AnimationTypes::kStanding, ctx.actorIdx);
 
 	return 0;


Commit: b936aee7dce554a15f7b645c69fed68981348450
    https://github.com/scummvm/scummvm/commit/b936aee7dce554a15f7b645c69fed68981348450
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2023-01-15T11:28:58+01:00

Commit Message:
TWINE: set the frame to 1 as found in the original sources

in HitObj() of OBJECT.C

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


diff --git a/engines/twine/scene/actor.cpp b/engines/twine/scene/actor.cpp
index 5bb9c0c4d78..343817e5aaa 100644
--- a/engines/twine/scene/actor.cpp
+++ b/engines/twine/scene/actor.cpp
@@ -288,6 +288,7 @@ void Actor::hitObj(int32 actorIdx, int32 actorIdxAttacked, int32 strengthOfHit,
 		if (actor->_genAnim == AnimationTypes::kBigHit || actor->_genAnim == AnimationTypes::kHit2) {
 			if (actor->_nextGenAnim != AnimationTypes::kStanding) {
 				const int32 tmpAnimPos = actor->_frame;
+				actor->_frame = 1;
 				_engine->_animations->processAnimActions(actorIdxAttacked);
 				actor->_frame = tmpAnimPos;
 			}


Commit: c32a1d6b2e63f622001cd64daa0752c986e5ea2c
    https://github.com/scummvm/scummvm/commit/c32a1d6b2e63f622001cd64daa0752c986e5ea2c
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2023-01-15T11:28:58+01:00

Commit Message:
TWINE: renamed members

Changed paths:
    engines/twine/holomap.cpp
    engines/twine/menu/menu.cpp
    engines/twine/renderer/redraw.cpp
    engines/twine/renderer/renderer.cpp
    engines/twine/scene/actor.cpp
    engines/twine/scene/actor.h
    engines/twine/scene/animations.cpp
    engines/twine/scene/collision.cpp
    engines/twine/scene/collision.h
    engines/twine/scene/extra.cpp
    engines/twine/scene/gamestate.cpp
    engines/twine/scene/movements.cpp
    engines/twine/scene/movements.h
    engines/twine/scene/scene.cpp
    engines/twine/script/script_life_v1.cpp
    engines/twine/script/script_move_v1.cpp
    engines/twine/twine.cpp


diff --git a/engines/twine/holomap.cpp b/engines/twine/holomap.cpp
index 5b41c40d860..7e68f3ed727 100644
--- a/engines/twine/holomap.cpp
+++ b/engines/twine/holomap.cpp
@@ -296,7 +296,7 @@ void Holomap::drawHoloObj(const IVec3 &angle, int32 x, int32 y) {
 void Holomap::renderHolomapVehicle(uint &frameNumber, ActorMoveStruct &move, AnimTimerDataStruct &animTimerData, BodyData &bodyData, AnimData &animData) {
 	const int16 newAngle = move.getRealAngle(_engine->_lbaTime);
 	if (move.numOfStep == 0) {
-		_engine->_movements->setActorAngleSafe(ANGLE_0, -ANGLE_90, 500, &move);
+		_engine->_movements->initRealAngle(ANGLE_0, -ANGLE_90, 500, &move);
 	}
 
 	if (_engine->_animations->setModelAnimation(frameNumber, animData, bodyData, &animTimerData)) {
diff --git a/engines/twine/menu/menu.cpp b/engines/twine/menu/menu.cpp
index b7cb18b1ec0..08f83e71265 100644
--- a/engines/twine/menu/menu.cpp
+++ b/engines/twine/menu/menu.cpp
@@ -915,7 +915,7 @@ int32 Menu::giveupMenu() {
 void Menu::drawHealthBar(int32 left, int32 right, int32 top, int32 barLeftPadding, int32 barHeight) {
 	_engine->_grid->drawSprite(left, top + 3, _engine->_resources->_spriteData[SPRITEHQR_LIFEPOINTS]);
 	const int32 barLeft = left + barLeftPadding;
-	const int32 healthBarRight = _engine->_screens->lerp(barLeft, right, 50, _engine->_scene->_sceneHero->_life);
+	const int32 healthBarRight = _engine->_screens->lerp(barLeft, right, 50, _engine->_scene->_sceneHero->_lifePoint);
 	const int32 barBottom = top + barHeight;
 	_engine->_interface->drawFilledRect(Common::Rect(barLeft, top, healthBarRight, barBottom), COLOR_91);
 	drawRectBorders(Common::Rect(barLeft, top, right, barBottom));
@@ -1113,7 +1113,7 @@ void Menu::processBehaviourMenu(bool behaviourMenu) {
 	_engine->_actor->_heroAnimIdx[(byte)HeroBehaviourType::kAggressive] = _engine->_actor->_heroAnimIdxAGGRESSIVE;
 	_engine->_actor->_heroAnimIdx[(byte)HeroBehaviourType::kDiscrete] = _engine->_actor->_heroAnimIdxDISCRETE;
 
-	_engine->_movements->setActorAngleSafe(_engine->_scene->_sceneHero->_angle, _engine->_scene->_sceneHero->_angle - ANGLE_90, ANGLE_17, &_moveMenu);
+	_engine->_movements->initRealAngle(_engine->_scene->_sceneHero->_beta, _engine->_scene->_sceneHero->_beta - ANGLE_90, ANGLE_17, &_moveMenu);
 
 	_engine->saveFrontBuffer();
 
@@ -1130,7 +1130,7 @@ void Menu::processBehaviourMenu(bool behaviourMenu) {
 	} else {
 		const int32 left = _engine->width() / 2 - 220;
 		const int32 top = _engine->height() / 2 - 140;
-		drawBehaviourMenu(left, top, _engine->_scene->_sceneHero->_angle);
+		drawBehaviourMenu(left, top, _engine->_scene->_sceneHero->_beta);
 
 		HeroBehaviourType tmpHeroBehaviour = _engine->_actor->_heroBehaviour;
 
@@ -1178,9 +1178,9 @@ void Menu::processBehaviourMenu(bool behaviourMenu) {
 			_engine->_actor->_heroBehaviour = (HeroBehaviourType)heroBehaviour;
 
 			if (tmpHeroBehaviour != _engine->_actor->_heroBehaviour) {
-				drawBehaviour(left, top, tmpHeroBehaviour, _engine->_scene->_sceneHero->_angle, true);
+				drawBehaviour(left, top, tmpHeroBehaviour, _engine->_scene->_sceneHero->_beta, true);
 				tmpHeroBehaviour = _engine->_actor->_heroBehaviour;
-				_engine->_movements->setActorAngleSafe(_engine->_scene->_sceneHero->_angle, _engine->_scene->_sceneHero->_angle - ANGLE_90, ANGLE_17, &_moveMenu);
+				_engine->_movements->initRealAngle(_engine->_scene->_sceneHero->_beta, _engine->_scene->_sceneHero->_beta - ANGLE_90, ANGLE_17, &_moveMenu);
 				const int tmpAnimIdx = _engine->_actor->_heroAnimIdx[(byte)_engine->_actor->_heroBehaviour];
 				_engine->_animations->setAnimObjet(_behaviourAnimState[(byte)_engine->_actor->_heroBehaviour], _engine->_resources->_animData[tmpAnimIdx], *_behaviourEntity, &_behaviourAnimData[(byte)_engine->_actor->_heroBehaviour]);
 			}
diff --git a/engines/twine/renderer/redraw.cpp b/engines/twine/renderer/redraw.cpp
index 2eaa944627a..6a9a5d76377 100644
--- a/engines/twine/renderer/redraw.cpp
+++ b/engines/twine/renderer/redraw.cpp
@@ -359,7 +359,7 @@ void Redraw::processDrawListActors(const DrawListStruct &drawCmd, bool bgRedraw)
 		}
 	}
 
-	if (!_engine->_renderer->renderIsoModel(delta.x, delta.y, delta.z, ANGLE_0, actor->_angle, ANGLE_0, _engine->_resources->_bodyData[actor->_body], renderRect)) {
+	if (!_engine->_renderer->renderIsoModel(delta.x, delta.y, delta.z, ANGLE_0, actor->_beta, ANGLE_0, _engine->_resources->_bodyData[actor->_body], renderRect)) {
 		_engine->_interface->resetClip();
 		return;
 	}
diff --git a/engines/twine/renderer/renderer.cpp b/engines/twine/renderer/renderer.cpp
index ec5dc318ac7..1ce0fed2824 100644
--- a/engines/twine/renderer/renderer.cpp
+++ b/engines/twine/renderer/renderer.cpp
@@ -1911,7 +1911,7 @@ void Renderer::renderBehaviourModel(const Common::Rect &rect, int32 y, int32 ang
 	if (angle == -1) {
 		const int16 newAngle = move.getRealAngle(_engine->_lbaTime);
 		if (move.numOfStep == 0) {
-			_engine->_movements->setActorAngleSafe(newAngle, newAngle - ANGLE_90, ANGLE_17, &move);
+			_engine->_movements->initRealAngle(newAngle, newAngle - ANGLE_90, ANGLE_17, &move);
 		}
 		renderIsoModel(0, y, 0, ANGLE_0, newAngle, ANGLE_0, bodyData, dummy);
 	} else {
diff --git a/engines/twine/scene/actor.cpp b/engines/twine/scene/actor.cpp
index 343817e5aaa..1e193a7b0cb 100644
--- a/engines/twine/scene/actor.cpp
+++ b/engines/twine/scene/actor.cpp
@@ -61,9 +61,9 @@ void Actor::restartHeroScene() {
 	sceneHero->_labelIdx = -1;
 	sceneHero->_offsetLife = 0;
 	sceneHero->_zone = -1;
-	sceneHero->_angle = _previousHeroAngle;
+	sceneHero->_beta = _previousHeroAngle;
 
-	_engine->_movements->setActorAngleSafe(sceneHero->_angle, sceneHero->_angle, ANGLE_0, &sceneHero->_move);
+	_engine->_movements->initRealAngle(sceneHero->_beta, sceneHero->_beta, ANGLE_0, &sceneHero->_moveAngle);
 	setBehaviour(_previousHeroBehaviour);
 
 	_cropBottomScreen = 0;
@@ -231,7 +231,7 @@ void Actor::initActor(int16 actorIdx) {
 
 		initSpriteActor(actorIdx);
 
-		_engine->_movements->setActorAngleSafe(ANGLE_0, ANGLE_0, ANGLE_0, &actor->_move);
+		_engine->_movements->initRealAngle(ANGLE_0, ANGLE_0, ANGLE_0, &actor->_moveAngle);
 
 		if (actor->_staticFlags.bUsesClipping) {
 			actor->_animStep = actor->posObj();
@@ -249,7 +249,7 @@ void Actor::initActor(int16 actorIdx) {
 			_engine->_animations->initAnim(actor->_genAnim, AnimType::kAnimationTypeLoop, AnimationTypes::kAnimInvalid, actorIdx);
 		}
 
-		_engine->_movements->setActorAngleSafe(actor->_angle, actor->_angle, ANGLE_0, &actor->_move);
+		_engine->_movements->initRealAngle(actor->_beta, actor->_beta, ANGLE_0, &actor->_moveAngle);
 	}
 
 	actor->_offsetTrack = -1;
@@ -269,12 +269,12 @@ void Actor::resetActor(int16 actorIdx) {
 	memset(&actor->_dynamicFlags, 0, sizeof(DynamicFlagsStruct));
 	memset(&actor->_bonusParameter, 0, sizeof(BonusParameter));
 
-	_engine->_movements->setActorAngleSafe(ANGLE_0, ANGLE_0, ANGLE_0, &actor->_move);
+	_engine->_movements->initRealAngle(ANGLE_0, ANGLE_0, ANGLE_0, &actor->_moveAngle);
 }
 
-void Actor::hitObj(int32 actorIdx, int32 actorIdxAttacked, int32 strengthOfHit, int32 angle) {
+void Actor::hitObj(int32 actorIdx, int32 actorIdxAttacked, int32 hitforce, int32 angle) {
 	ActorStruct *actor = _engine->_scene->getActor(actorIdxAttacked);
-	if (actor->_life <= 0) {
+	if (actor->_lifePoint <= 0) {
 		return;
 	}
 
@@ -284,7 +284,7 @@ void Actor::hitObj(int32 actorIdx, int32 actorIdxAttacked, int32 strengthOfHit,
 
 	actor->_hitBy = actorIdx;
 
-	if (actor->_armor <= strengthOfHit) {
+	if (actor->_armor <= hitforce) {
 		if (actor->_genAnim == AnimationTypes::kBigHit || actor->_genAnim == AnimationTypes::kHit2) {
 			if (actor->_nextGenAnim != AnimationTypes::kStanding) {
 				const int32 tmpAnimPos = actor->_frame;
@@ -295,7 +295,7 @@ void Actor::hitObj(int32 actorIdx, int32 actorIdxAttacked, int32 strengthOfHit,
 
 		} else {
 			if (angle != -1) {
-				_engine->_movements->setActorAngleSafe(angle, angle, ANGLE_0, &actor->_move);
+				_engine->_movements->initRealAngle(angle, angle, ANGLE_0, &actor->_moveAngle);
 			}
 
 			if (_engine->getRandomNumber() & 1) {
@@ -311,9 +311,9 @@ void Actor::hitObj(int32 actorIdx, int32 actorIdxAttacked, int32 strengthOfHit,
 			_engine->_movements->_lastJoyFlag = true;
 		}
 
-		actor->_life -= strengthOfHit;
-		if (actor->_life < 0) {
-			actor->_life = 0;
+		actor->_lifePoint -= hitforce;
+		if (actor->_lifePoint < 0) {
+			actor->_lifePoint = 0;
 		}
 	} else {
 		_engine->_animations->initAnim(AnimationTypes::kHit, AnimType::kAnimationInsert, AnimationTypes::kAnimInvalid, actorIdxAttacked);
diff --git a/engines/twine/scene/actor.h b/engines/twine/scene/actor.h
index d115d0028b9..181a5adff5c 100644
--- a/engines/twine/scene/actor.h
+++ b/engines/twine/scene/actor.h
@@ -180,7 +180,7 @@ public:
 	int32 _strengthOfHit = 0;
 	int32 _hitBy = -1;
 	BonusParameter _bonusParameter;
-	int32 _angle = 0; // facing angle of actor. Minumum is 0 (SW). Going counter clock wise (BETA in original sources)
+	int32 _beta = 0; // facing angle of actor. Minumum is 0 (SW). Going counter clock wise (BETA in original sources)
 	int32 _speed = 40; // speed of movement
 	ControlMode _controlMode = ControlMode::kNoMove;
 	int32 _delayInMillis = 0;
@@ -192,7 +192,7 @@ public:
 	int32 _bonusAmount = 0;
 	int32 _talkColor = COLOR_BLACK;
 	int32 _armor = 1;
-	int32 _life = kActorMaxLife;
+	int32 _lifePoint = kActorMaxLife;
 
 	/** Process actor coordinate Nxw, Nyw, Nzw */
 	IVec3 _processActor;
@@ -232,7 +232,7 @@ public:
 	uint8 _brickSound = 0U; // CodeJeu
 
 	BoundingBox _boundingBox; // Xmin, YMin, Zmin, Xmax, Ymax, Zmax
-	ActorMoveStruct _move;
+	ActorMoveStruct _moveAngle;
 	AnimTimerDataStruct _animTimerData;
 };
 
@@ -241,13 +241,13 @@ inline const IVec3 &ActorStruct::posObj() const {
 }
 
 inline void ActorStruct::addLife(int32 val) {
-	setLife(_life + val);
+	setLife(_lifePoint + val);
 }
 
 inline void ActorStruct::setLife(int32 val) {
-	_life = val;
-	if (_life > kActorMaxLife) {
-		_life = kActorMaxLife;
+	_lifePoint = val;
+	if (_lifePoint > kActorMaxLife) {
+		_lifePoint = kActorMaxLife;
 	}
 }
 
diff --git a/engines/twine/scene/animations.cpp b/engines/twine/scene/animations.cpp
index 92031262179..8fbc2063d94 100644
--- a/engines/twine/scene/animations.cpp
+++ b/engines/twine/scene/animations.cpp
@@ -288,12 +288,12 @@ void Animations::processAnimActions(int32 actorIdx) { // GereAnimAction
 			break;
 		case ActionType::ACTION_THROW_EXTRA_BONUS:
 			if (action.animFrame == actor->_frame) {
-				_engine->_extra->throwExtra(actorIdx, actor->_pos.x, actor->_pos.y + action.yHeight, actor->_pos.z, action.spriteIndex, action.xAngle, actor->_angle + action.yAngle, action.xRotPoint, action.extraAngle, action.strength);
+				_engine->_extra->throwExtra(actorIdx, actor->_pos.x, actor->_pos.y + action.yHeight, actor->_pos.z, action.spriteIndex, action.xAngle, actor->_beta + action.yAngle, action.xRotPoint, action.extraAngle, action.strength);
 			}
 			break;
 		case ActionType::ACTION_THROW_MAGIC_BALL:
 			if (_engine->_gameState->_magicBall == -1 && action.animFrame == actor->_frame) {
-				_engine->_extra->addExtraThrowMagicball(actor->_pos.x, actor->_pos.y + action.yHeight, actor->_pos.z, action.xAngle, actor->_angle + action.yAngle, action.xRotPoint, action.extraAngle);
+				_engine->_extra->addExtraThrowMagicball(actor->_pos.x, actor->_pos.y + action.yHeight, actor->_pos.z, action.xAngle, actor->_beta + action.yAngle, action.xRotPoint, action.extraAngle);
 			}
 			break;
 		case ActionType::ACTION_SAMPLE_REPEAT:
@@ -308,7 +308,7 @@ void Animations::processAnimActions(int32 actorIdx) { // GereAnimAction
 			break;
 		case ActionType::ACTION_THROW_ALPHA:
 			if (action.animFrame == actor->_frame) {
-				_engine->_extra->throwExtra(actorIdx, actor->_pos.x, actor->_pos.y + action.yHeight, actor->_pos.z, action.spriteIndex, action.xAngle, actor->_angle + action.yAngle, action.xRotPoint, action.extraAngle, action.strength);
+				_engine->_extra->throwExtra(actorIdx, actor->_pos.x, actor->_pos.y + action.yHeight, actor->_pos.z, action.spriteIndex, action.xAngle, actor->_beta + action.yAngle, action.xRotPoint, action.extraAngle, action.strength);
 			}
 			break;
 		case ActionType::ACTION_SAMPLE_STOP:
@@ -336,14 +336,14 @@ void Animations::processAnimActions(int32 actorIdx) { // GereAnimAction
 			break;
 		case ActionType::ACTION_THROW_3D:
 			if (action.animFrame == actor->_frame) {
-				const IVec3 &destPos = _engine->_movements->rotateActor(action.distanceX, action.distanceZ, actor->_angle);
+				const IVec3 &destPos = _engine->_movements->rotate(action.distanceX, action.distanceZ, actor->_beta);
 
 				const int32 throwX = destPos.x + actor->_pos.x;
 				const int32 throwY = action.distanceY + actor->_pos.y;
 				const int32 throwZ = destPos.z + actor->_pos.z;
 
 				_engine->_extra->throwExtra(actorIdx, throwX, throwY, throwZ, action.spriteIndex,
-				                               action.xAngle, action.yAngle + actor->_angle, action.xRotPoint, action.extraAngle, action.strength);
+				                               action.xAngle, action.yAngle + actor->_beta, action.xRotPoint, action.extraAngle, action.strength);
 			}
 			break;
 		case ActionType::ACTION_THROW_3D_ALPHA:
@@ -351,19 +351,19 @@ void Animations::processAnimActions(int32 actorIdx) { // GereAnimAction
 				const int32 distance = getDistance2D(actor->posObj(), _engine->_scene->_sceneHero->posObj());
 				const int32 newAngle = _engine->_movements->getAngleAndSetTargetActorDistance(actor->_pos.y, 0, _engine->_scene->_sceneHero->_pos.y, distance);
 
-				const IVec3 &destPos = _engine->_movements->rotateActor(action.distanceX, action.distanceZ, actor->_angle);
+				const IVec3 &destPos = _engine->_movements->rotate(action.distanceX, action.distanceZ, actor->_beta);
 
 				const int32 throwX = destPos.x + actor->_pos.x;
 				const int32 throwY = action.distanceY + actor->_pos.y;
 				const int32 throwZ = destPos.z + actor->_pos.z;
 
 				_engine->_extra->throwExtra(actorIdx, throwX, throwY, throwZ, action.spriteIndex,
-				                               action.xAngle + newAngle, action.yAngle + actor->_angle, action.xRotPoint, action.extraAngle, action.strength);
+				                               action.xAngle + newAngle, action.yAngle + actor->_beta, action.xRotPoint, action.extraAngle, action.strength);
 			}
 			break;
 		case ActionType::ACTION_THROW_3D_SEARCH:
 			if (action.animFrame == actor->_frame) {
-				const IVec3 &destPos = _engine->_movements->rotateActor(action.distanceX, action.distanceZ, actor->_angle);
+				const IVec3 &destPos = _engine->_movements->rotate(action.distanceX, action.distanceZ, actor->_beta);
 				const int32 x = actor->_pos.x + destPos.x;
 				const int32 y = actor->_pos.y + action.distanceY;
 				const int32 z = actor->_pos.z + destPos.z;
@@ -373,11 +373,11 @@ void Animations::processAnimActions(int32 actorIdx) { // GereAnimAction
 			break;
 		case ActionType::ACTION_THROW_3D_MAGIC:
 			if (_engine->_gameState->_magicBall == -1 && action.animFrame == actor->_frame) {
-				const IVec3 &destPos = _engine->_movements->rotateActor(action.distanceX, action.distanceZ, actor->_angle);
+				const IVec3 &destPos = _engine->_movements->rotate(action.distanceX, action.distanceZ, actor->_beta);
 				const int32 x = actor->_pos.x + destPos.x;
 				const int32 y = actor->_pos.y + action.distanceY;
 				const int32 z = actor->_pos.z + destPos.z;
-				_engine->_extra->addExtraThrowMagicball(x, y, z, action.xAngle, actor->_angle, action.yAngle, action.finalAngle);
+				_engine->_extra->addExtraThrowMagicball(x, y, z, action.xAngle, actor->_beta, action.yAngle, action.finalAngle);
 			}
 			break;
 		case ActionType::ACTION_ZV:
@@ -483,36 +483,36 @@ void Animations::doAnim(int32 actorIdx) {
 
 		if (!actor->_dynamicFlags.bIsFalling) {
 			if (actor->_speed) {
-				int32 xAxisRotation = actor->_move.getRealValue(_engine->_lbaTime);
+				int32 xAxisRotation = actor->_moveAngle.getRealValue(_engine->_lbaTime);
 				if (!xAxisRotation) {
-					if (actor->_move.to > 0) {
+					if (actor->_moveAngle.to > 0) {
 						xAxisRotation = 1;
 					} else {
 						xAxisRotation = -1;
 					}
 				}
 
-				const IVec3 xRotPos = _engine->_movements->rotateActor(xAxisRotation, 0, actor->_spriteActorRotation);
+				const IVec3 xRotPos = _engine->_movements->rotate(xAxisRotation, 0, actor->_spriteActorRotation);
 
 				processActor.y = actor->_pos.y - xRotPos.z;
 
-				const IVec3 destPos = _engine->_movements->rotateActor(0, xRotPos.x, actor->_angle);
+				const IVec3 destPos = _engine->_movements->rotate(0, xRotPos.x, actor->_beta);
 
 				processActor.x = actor->_pos.x + destPos.x;
 				processActor.z = actor->_pos.z + destPos.z;
 
-				_engine->_movements->setActorAngle(ANGLE_0, actor->_speed, ANGLE_17, &actor->_move);
+				_engine->_movements->setActorAngle(ANGLE_0, actor->_speed, ANGLE_17, &actor->_moveAngle);
 
 				if (actor->_dynamicFlags.bIsSpriteMoving) {
 					if (actor->_doorWidth) { // open door
 						if (getDistance2D(processActor.x, processActor.z, actor->_animStep.x, actor->_animStep.z) >= actor->_doorWidth) {
-							if (actor->_angle == ANGLE_0) { // down
+							if (actor->_beta == ANGLE_0) { // down
 								processActor.z = actor->_animStep.z + actor->_doorWidth;
-							} else if (actor->_angle == ANGLE_90) { // right
+							} else if (actor->_beta == ANGLE_90) { // right
 								processActor.x = actor->_animStep.x + actor->_doorWidth;
-							} else if (actor->_angle == ANGLE_180) { // up
+							} else if (actor->_beta == ANGLE_180) { // up
 								processActor.z = actor->_animStep.z - actor->_doorWidth;
-							} else if (actor->_angle == ANGLE_270) { // left
+							} else if (actor->_beta == ANGLE_270) { // left
 								processActor.x = actor->_animStep.x - actor->_doorWidth;
 							}
 
@@ -522,19 +522,19 @@ void Animations::doAnim(int32 actorIdx) {
 					} else { // close door
 						bool updatePos = false;
 
-						if (actor->_angle == ANGLE_0) { // down
+						if (actor->_beta == ANGLE_0) { // down
 							if (processActor.z <= actor->_animStep.z) {
 								updatePos = true;
 							}
-						} else if (actor->_angle == ANGLE_90) { // right
+						} else if (actor->_beta == ANGLE_90) { // right
 							if (processActor.x <= actor->_animStep.x) {
 								updatePos = true;
 							}
-						} else if (actor->_angle == ANGLE_180) { // up
+						} else if (actor->_beta == ANGLE_180) { // up
 							if (processActor.z >= actor->_animStep.z) {
 								updatePos = true;
 							}
-						} else if (actor->_angle == ANGLE_270) { // left
+						} else if (actor->_beta == ANGLE_270) { // left
 							if (processActor.x >= actor->_animStep.x) {
 								updatePos = true;
 							}
@@ -576,10 +576,10 @@ void Animations::doAnim(int32 actorIdx) {
 				actor->_dynamicFlags.bIsRotationByAnim = 0;
 			}
 
-			actor->_angle = ClampAngle(actor->_angle + _processLastRotationAngle - actor->_animStepBeta);
+			actor->_beta = ClampAngle(actor->_beta + _processLastRotationAngle - actor->_animStepBeta);
 			actor->_animStepBeta = _processLastRotationAngle;
 
-			const IVec3 &destPos = _engine->_movements->rotateActor(_currentStep.x, _currentStep.z, actor->_angle);
+			const IVec3 &destPos = _engine->_movements->rotate(_currentStep.x, _currentStep.z, actor->_beta);
 
 			_currentStep.x = destPos.x;
 			_currentStep.z = destPos.z;
@@ -639,7 +639,7 @@ void Animations::doAnim(int32 actorIdx) {
 		processActor -= standOnActor->_oldPos;
 		processActor += standOnActor->posObj();
 
-		if (!collision->standingOnActor(actorIdx, actor->_carryBy)) {
+		if (!collision->checkZvOnZv(actorIdx, actor->_carryBy)) {
 			actor->_carryBy = -1; // no longer standing on other actor
 		}
 	}
@@ -697,7 +697,7 @@ void Animations::doAnim(int32 actorIdx) {
 
 		// process wall hit while running
 		if (collision->_causeActorDamage && !actor->_dynamicFlags.bIsFalling && IS_HERO(actorIdx) && _engine->_actor->_heroBehaviour == HeroBehaviourType::kAthletic && actor->_genAnim == AnimationTypes::kForward) {
-			IVec3 destPos = _engine->_movements->rotateActor(actor->_boundingBox.mins.x, actor->_boundingBox.mins.z, actor->_angle + ANGLE_360 + ANGLE_135);
+			IVec3 destPos = _engine->_movements->rotate(actor->_boundingBox.mins.x, actor->_boundingBox.mins.z, actor->_beta + ANGLE_360 + ANGLE_135);
 
 			destPos.x += processActor.x;
 			destPos.z += processActor.z;
diff --git a/engines/twine/scene/collision.cpp b/engines/twine/scene/collision.cpp
index 074d97ba6be..140717aa422 100644
--- a/engines/twine/scene/collision.cpp
+++ b/engines/twine/scene/collision.cpp
@@ -40,7 +40,7 @@ namespace TwinE {
 Collision::Collision(TwinEEngine *engine) : _engine(engine) {
 }
 
-bool Collision::standingOnActor(int32 actorIdx1, int32 actorIdx2) const {
+bool Collision::checkZvOnZv(int32 actorIdx1, int32 actorIdx2) const {
 	const ActorStruct *actor1 = _engine->_scene->getActor(actorIdx1);
 	const ActorStruct *actor2 = _engine->_scene->getActor(actorIdx2);
 
@@ -194,16 +194,16 @@ void Collision::handlePushing(const IVec3 &minsTest, const IVec3 &maxsTest, Acto
 		actorTest->_animStep.y = 0;
 
 		if (actorTest->_staticFlags.bUseMiniZv) {
-			if (newAngle >= ANGLE_45 && newAngle < ANGLE_135 && actor->_angle >= ANGLE_45 && actor->_angle < ANGLE_135) {
+			if (newAngle >= ANGLE_45 && newAngle < ANGLE_135 && actor->_beta >= ANGLE_45 && actor->_beta < ANGLE_135) {
 				actorTest->_animStep.x = SIZE_BRICK_XZ / 4 + SIZE_BRICK_XZ / 8;
 			}
-			if (newAngle >= ANGLE_135 && newAngle < ANGLE_225 && actor->_angle >= ANGLE_135 && actor->_angle < ANGLE_225) {
+			if (newAngle >= ANGLE_135 && newAngle < ANGLE_225 && actor->_beta >= ANGLE_135 && actor->_beta < ANGLE_225) {
 				actorTest->_animStep.z = -SIZE_BRICK_XZ / 4 + SIZE_BRICK_XZ / 8;
 			}
-			if (newAngle >= ANGLE_225 && newAngle < ANGLE_315 && actor->_angle >= ANGLE_225 && actor->_angle < ANGLE_315) {
+			if (newAngle >= ANGLE_225 && newAngle < ANGLE_315 && actor->_beta >= ANGLE_225 && actor->_beta < ANGLE_315) {
 				actorTest->_animStep.x = -SIZE_BRICK_XZ / 4 + SIZE_BRICK_XZ / 8;
 			}
-			if ((newAngle >= ANGLE_315 || newAngle < ANGLE_45) && (actor->_angle >= ANGLE_315 || actor->_angle < ANGLE_45)) {
+			if ((newAngle >= ANGLE_315 || newAngle < ANGLE_45) && (actor->_beta >= ANGLE_315 || actor->_beta < ANGLE_45)) {
 				actorTest->_animStep.z = SIZE_BRICK_XZ / 4 + SIZE_BRICK_XZ / 8;
 			}
 		} else {
@@ -307,12 +307,12 @@ int32 Collision::checkObjCol(int32 actorIdx) {
 				actor->_collision = a; // mark as collision with actor a
 
 				if (actorTest->_staticFlags.bIsCarrierActor) {
-					if (actor->_dynamicFlags.bIsFalling || standingOnActor(actorIdx, a)) {
+					if (actor->_dynamicFlags.bIsFalling || checkZvOnZv(actorIdx, a)) {
 						processActor.y = maxsTest.y - actor->_boundingBox.mins.y + 1;
 						actor->_carryBy = a;
 						continue;
 					}
-				} else if (standingOnActor(actorIdx, a)) {
+				} else if (checkZvOnZv(actorIdx, a)) {
 					_engine->_actor->hitObj(actorIdx, a, 1, -1);
 				}
 				handlePushing(minsTest, maxsTest, actor, actorTest);
@@ -321,7 +321,7 @@ int32 Collision::checkObjCol(int32 actorIdx) {
 	}
 
 	if (actor->_dynamicFlags.bIsHitting) {
-		const IVec3 &destPos = _engine->_movements->rotateActor(0, 200, actor->_angle);
+		const IVec3 &destPos = _engine->_movements->rotate(0, 200, actor->_beta);
 		mins = processActor + actor->_boundingBox.mins;
 		mins.x += destPos.x;
 		mins.z += destPos.z;
@@ -338,7 +338,7 @@ int32 Collision::checkObjCol(int32 actorIdx) {
 				const IVec3 minsTest = actorTest->posObj() + actorTest->_boundingBox.mins;
 				const IVec3 maxsTest = actorTest->posObj() + actorTest->_boundingBox.maxs;
 				if (mins.x < maxsTest.x && maxs.x > minsTest.x && mins.y < maxsTest.y && maxs.y > minsTest.y && mins.z < maxsTest.z && maxs.z > minsTest.z) {
-					_engine->_actor->hitObj(actorIdx, a, actor->_strengthOfHit, actor->_angle + ANGLE_180);
+					_engine->_actor->hitObj(actorIdx, a, actor->_strengthOfHit, actor->_beta + ANGLE_180);
 					actor->_dynamicFlags.bIsHitting = 0;
 				}
 			}
diff --git a/engines/twine/scene/collision.h b/engines/twine/scene/collision.h
index 9a8027ed1f4..561b9bd35b7 100644
--- a/engines/twine/scene/collision.h
+++ b/engines/twine/scene/collision.h
@@ -52,7 +52,7 @@ public:
 	 * @param actorIdx1 Actor 1 index
 	 * @param actorIdx2 Actor 2 index
 	 */
-	bool standingOnActor(int32 actorIdx1, int32 actorIdx2) const;
+	bool checkZvOnZv(int32 actorIdx1, int32 actorIdx2) const;
 
 	int32 clampedLerp(int32 start, int32 end, int32 maxDelay, int32 delay) const;
 
diff --git a/engines/twine/scene/extra.cpp b/engines/twine/scene/extra.cpp
index b011c492b2b..4be29bb7ebc 100644
--- a/engines/twine/scene/extra.cpp
+++ b/engines/twine/scene/extra.cpp
@@ -135,11 +135,11 @@ void Extra::initFly(ExtraListStruct *extra, int32 xAngle, int32 yAngle, int32 x,
 
 	extra->lastPos = extra->pos;
 
-	IVec3 destPos = _engine->_movements->rotateActor(x, 0, xAngle);
+	IVec3 destPos = _engine->_movements->rotate(x, 0, xAngle);
 
 	extra->destPos.y = -destPos.z;
 
-	destPos = _engine->_movements->rotateActor(0, destPos.x, yAngle);
+	destPos = _engine->_movements->rotate(0, destPos.x, yAngle);
 
 	extra->destPos.x = destPos.x;
 	extra->destPos.z = destPos.z;
@@ -406,7 +406,7 @@ void Extra::drawSpecialShape(const ExtraShape &shapeTable, int32 x, int32 y, int
 	renderRect.top = 0x7D00;
 	renderRect.bottom = -0x7D00;
 
-	IVec3 destPos = _engine->_movements->rotateActor(shapeX, shapeZ, angle);
+	IVec3 destPos = _engine->_movements->rotate(shapeX, shapeZ, angle);
 
 	const int32 computedX = destPos.x + x;
 	const int32 computedY = destPos.z + y;
@@ -441,7 +441,7 @@ void Extra::drawSpecialShape(const ExtraShape &shapeTable, int32 x, int32 y, int
 		_engine->_renderer->_projPos.x = currentX;
 		_engine->_renderer->_projPos.y = currentY;
 
-		destPos = _engine->_movements->rotateActor(shapeX, shapeZ, angle);
+		destPos = _engine->_movements->rotate(shapeX, shapeZ, angle);
 
 		currentX = destPos.x + x;
 		currentY = destPos.z + y;
@@ -626,10 +626,10 @@ void Extra::gereExtras() {
 				pos = 1;
 			}
 
-			IVec3 destPos = _engine->_movements->rotateActor(pos, 0, angle2);
+			IVec3 destPos = _engine->_movements->rotate(pos, 0, angle2);
 			extra->pos.y -= destPos.z;
 
-			destPos = _engine->_movements->rotateActor(0, destPos.x, tmpAngle);
+			destPos = _engine->_movements->rotate(0, destPos.x, tmpAngle);
 			extra->pos.x += destPos.x;
 			extra->pos.z += destPos.z;
 
@@ -676,10 +676,10 @@ void Extra::gereExtras() {
 				pos = 1;
 			}
 
-			IVec3 destPos = _engine->_movements->rotateActor(pos, 0, angle2);
+			IVec3 destPos = _engine->_movements->rotate(pos, 0, angle2);
 			extra->pos.y -= destPos.z;
 
-			destPos = _engine->_movements->rotateActor(0, destPos.x, tmpAngle);
+			destPos = _engine->_movements->rotate(0, destPos.x, tmpAngle);
 			extra->pos.x += destPos.x;
 			extra->pos.z += destPos.z;
 
diff --git a/engines/twine/scene/gamestate.cpp b/engines/twine/scene/gamestate.cpp
index 78194efb0b6..2c99e42d111 100644
--- a/engines/twine/scene/gamestate.cpp
+++ b/engines/twine/scene/gamestate.cpp
@@ -191,8 +191,8 @@ bool GameState::loadGame(Common::SeekableReadStream *file) {
 	_engine->_scene->_newHeroPos.x = file->readSint16LE();
 	_engine->_scene->_newHeroPos.y = file->readSint16LE();
 	_engine->_scene->_newHeroPos.z = file->readSint16LE();
-	_engine->_scene->_sceneHero->_angle = ToAngle(file->readSint16LE());
-	_engine->_actor->_previousHeroAngle = _engine->_scene->_sceneHero->_angle;
+	_engine->_scene->_sceneHero->_beta = ToAngle(file->readSint16LE());
+	_engine->_actor->_previousHeroAngle = _engine->_scene->_sceneHero->_beta;
 	_engine->_scene->_sceneHero->_genBody = (BodyType)file->readByte();
 
 	const byte numHolomapFlags = file->readByte(); // number of holomap locations
@@ -249,7 +249,7 @@ bool GameState::saveGame(Common::WriteStream *file) {
 	file->writeByte(sceneIdx);
 	file->writeByte(_gameChapter);
 	file->writeByte((byte)_engine->_actor->_heroBehaviour);
-	file->writeByte(_engine->_scene->_sceneHero->_life);
+	file->writeByte(_engine->_scene->_sceneHero->_lifePoint);
 	file->writeSint16LE(_inventoryNumKashes);
 	file->writeByte(_magicLevelIdx);
 	file->writeByte(_magicPoint);
@@ -259,7 +259,7 @@ bool GameState::saveGame(Common::WriteStream *file) {
 	file->writeSint16LE(_engine->_scene->_newHeroPos.x);
 	file->writeSint16LE(_engine->_scene->_newHeroPos.y);
 	file->writeSint16LE(_engine->_scene->_newHeroPos.z);
-	file->writeSint16LE(FromAngle(_engine->_scene->_sceneHero->_angle));
+	file->writeSint16LE(FromAngle(_engine->_scene->_sceneHero->_beta));
 	file->writeByte((uint8)_engine->_scene->_sceneHero->_genBody);
 
 	// number of holomap locations
diff --git a/engines/twine/scene/movements.cpp b/engines/twine/scene/movements.cpp
index 38ea0a6b16c..f03da4f81d7 100644
--- a/engines/twine/scene/movements.cpp
+++ b/engines/twine/scene/movements.cpp
@@ -56,7 +56,7 @@ IVec3 Movements::getShadowPosition(const IVec3 &pos) { // GetShadow
 	return shadowCoord;
 }
 
-void Movements::setActorAngleSafe(int16 startAngle, int16 endAngle, int16 stepAngle, ActorMoveStruct *movePtr) {
+void Movements::initRealAngle(int16 startAngle, int16 endAngle, int16 stepAngle, ActorMoveStruct *movePtr) {
 	movePtr->from = ClampAngle(startAngle);
 	movePtr->to = ClampAngle(endAngle);
 	movePtr->numOfStep = ClampAngle(stepAngle);
@@ -64,7 +64,7 @@ void Movements::setActorAngleSafe(int16 startAngle, int16 endAngle, int16 stepAn
 }
 
 void Movements::clearRealAngle(ActorStruct *actorPtr) {
-	setActorAngleSafe(actorPtr->_angle, actorPtr->_angle, ANGLE_0, &actorPtr->_move);
+	initRealAngle(actorPtr->_beta, actorPtr->_beta, ANGLE_0, &actorPtr->_moveAngle);
 }
 
 void Movements::setActorAngle(int16 startAngle, int16 endAngle, int16 stepAngle, ActorMoveStruct *movePtr) {
@@ -140,7 +140,7 @@ int32 Movements::getAngleAndSetTargetActorDistance(int32 x1, int32 z1, int32 x2,
 	return ClampAngle(finalAngle);
 }
 
-IVec3 Movements::rotateActor(int32 x, int32 z, int32 angle) {
+IVec3 Movements::rotate(int32 x, int32 z, int32 angle) {
 	if (angle) {
 		const double radians = AngleToRadians(angle);
 		const int32 vx = (int32)(x * cos(radians) + z * sin(radians));
@@ -226,7 +226,7 @@ bool Movements::processBehaviourExecution(int actorIdx) {
 		if (_engine->_actor->_combatAuto) {
 			ActorStruct *actor = _engine->_scene->getActor(actorIdx);
 			_lastJoyFlag = true;
-			actor->_angle = actor->_move.getRealAngle(_engine->_lbaTime);
+			actor->_beta = actor->_moveAngle.getRealAngle(_engine->_lbaTime);
 			// TODO: previousLoopActionKey must be handled properly
 			if (!_previousLoopActionKey || actor->_genAnim == AnimationTypes::kStanding) {
 				const int32 aggresiveMode = _engine->getRandomNumber(3);
@@ -274,7 +274,7 @@ bool Movements::processAttackExecution(int actorIdx) {
 				_engine->_animations->initAnim(AnimationTypes::kThrowBall, AnimType::kAnimationThen, AnimationTypes::kStanding, actorIdx);
 			}
 
-			actor->_angle = actor->_move.getRealAngle(_engine->_lbaTime);
+			actor->_beta = actor->_moveAngle.getRealAngle(_engine->_lbaTime);
 			return true;
 		}
 	} else if (_engine->_gameState->hasItem(InventoryItems::kiUseSabre)) {
@@ -284,7 +284,7 @@ bool Movements::processAttackExecution(int actorIdx) {
 
 		_engine->_animations->initAnim(AnimationTypes::kSabreAttack, AnimType::kAnimationThen, AnimationTypes::kStanding, actorIdx);
 
-		actor->_angle = actor->_move.getRealAngle(_engine->_lbaTime);
+		actor->_beta = actor->_moveAngle.getRealAngle(_engine->_lbaTime);
 		return true;
 	}
 	return false;
@@ -326,7 +326,7 @@ void Movements::processManualMovementExecution(int actorIdx) {
 				_engine->_animations->initAnim(AnimationTypes::kTurnLeft, AnimType::kAnimationTypeLoop, AnimationTypes::kAnimInvalid, actorIdx);
 			} else {
 				if (!actor->_dynamicFlags.bIsRotationByAnim) {
-					actor->_angle = actor->_move.getRealAngle(_engine->_lbaTime);
+					actor->_beta = actor->_moveAngle.getRealAngle(_engine->_lbaTime);
 				}
 			}
 			_lastJoyFlag = true;
@@ -335,7 +335,7 @@ void Movements::processManualMovementExecution(int actorIdx) {
 				_engine->_animations->initAnim(AnimationTypes::kTurnRight, AnimType::kAnimationTypeLoop, AnimationTypes::kAnimInvalid, actorIdx);
 			} else {
 				if (!actor->_dynamicFlags.bIsRotationByAnim) {
-					actor->_angle = actor->_move.getRealAngle(_engine->_lbaTime);
+					actor->_beta = actor->_moveAngle.getRealAngle(_engine->_lbaTime);
 				}
 			}
 			_lastJoyFlag = true;
@@ -361,7 +361,7 @@ void Movements::processManualRotationExecution(int actorIdx) {
 		tempAngle = ANGLE_0;
 	}
 
-	initRealAngleConst(actor->_angle, actor->_angle + tempAngle, actor->_speed, &actor->_move);
+	initRealAngleConst(actor->_beta, actor->_beta + tempAngle, actor->_speed, &actor->_moveAngle);
 }
 
 void Movements::processManualAction(int actorIdx) {
@@ -387,9 +387,9 @@ void Movements::processFollowAction(int actorIdx) {
 	const ActorStruct *followedActor = _engine->_scene->getActor(actor->_followedActor);
 	int32 newAngle = getAngleAndSetTargetActorDistance(actor->posObj(), followedActor->posObj());
 	if (actor->_staticFlags.bIsSpriteActor) {
-		actor->_angle = newAngle;
+		actor->_beta = newAngle;
 	} else {
-		initRealAngleConst(actor->_angle, newAngle, actor->_speed, &actor->_move);
+		initRealAngleConst(actor->_beta, newAngle, actor->_speed, &actor->_moveAngle);
 	}
 }
 
@@ -400,17 +400,17 @@ void Movements::processRandomAction(int actorIdx) {
 	}
 
 	if (actor->brickCausesDamage()) {
-		const int32 angle = ClampAngle(actor->_angle + (_engine->getRandomNumber() & (ANGLE_180 - 1)) - ANGLE_90 + ANGLE_180);
-		initRealAngleConst(actor->_angle, angle, actor->_speed, &actor->_move);
+		const int32 angle = ClampAngle(actor->_beta + (_engine->getRandomNumber() & (ANGLE_180 - 1)) - ANGLE_90 + ANGLE_180);
+		initRealAngleConst(actor->_beta, angle, actor->_speed, &actor->_moveAngle);
 		actor->_delayInMillis = _engine->getRandomNumber(300) + _engine->_lbaTime + 300;
 		_engine->_animations->initAnim(AnimationTypes::kStanding, AnimType::kAnimationTypeLoop, AnimationTypes::kAnimInvalid, actorIdx);
 	}
 
-	if (!actor->_move.numOfStep) {
+	if (!actor->_moveAngle.numOfStep) {
 		_engine->_animations->initAnim(AnimationTypes::kForward, AnimType::kAnimationTypeLoop, AnimationTypes::kAnimInvalid, actorIdx);
 		if (_engine->_lbaTime > actor->_delayInMillis) {
-			const int32 angle = ClampAngle(actor->_angle + (_engine->getRandomNumber() & (ANGLE_180 - 1)) - ANGLE_90);
-			initRealAngleConst(actor->_angle, angle, actor->_speed, &actor->_move);
+			const int32 angle = ClampAngle(actor->_beta + (_engine->getRandomNumber() & (ANGLE_180 - 1)) - ANGLE_90);
+			initRealAngleConst(actor->_beta, angle, actor->_speed, &actor->_moveAngle);
 			actor->_delayInMillis = _engine->getRandomNumber(300) + _engine->_lbaTime + 300;
 		}
 	}
@@ -448,12 +448,12 @@ void Movements::doDir(int32 actorIdx) {
 			tempAngle = -ANGLE_90;
 		}
 
-		initRealAngleConst(actor->_angle, actor->_angle + tempAngle, actor->_speed, &actor->_move);
+		initRealAngleConst(actor->_beta, actor->_beta + tempAngle, actor->_speed, &actor->_moveAngle);
 		return;
 	}
 	if (!actor->_staticFlags.bIsSpriteActor) {
 		if (actor->_controlMode != ControlMode::kManual) {
-			actor->_angle = actor->_move.getRealAngle(_engine->_lbaTime);
+			actor->_beta = actor->_moveAngle.getRealAngle(_engine->_lbaTime);
 		}
 	}
 
diff --git a/engines/twine/scene/movements.h b/engines/twine/scene/movements.h
index e355ccfaa1a..aec11e09c56 100644
--- a/engines/twine/scene/movements.h
+++ b/engines/twine/scene/movements.h
@@ -142,7 +142,7 @@ public:
 	 * @param stepAngle number of steps
 	 * @param movePtr time pointer to update
 	 */
-	void setActorAngleSafe(int16 startAngle, int16 endAngle, int16 stepAngle, ActorMoveStruct *movePtr);
+	void initRealAngle(int16 startAngle, int16 endAngle, int16 stepAngle, ActorMoveStruct *movePtr);
 
 	/**
 	 * Clear actors safe angle
@@ -178,7 +178,7 @@ public:
 	 * @param z Actor current Z coordinate
 	 * @param angle Actor angle to rotate
 	 */
-	IVec3 rotateActor(int32 x, int32 z, int32 angle);
+	IVec3 rotate(int32 x, int32 z, int32 angle);
 
 	/**
 	 * Move actor around the scene
diff --git a/engines/twine/scene/scene.cpp b/engines/twine/scene/scene.cpp
index 1e0ccb604e5..dd71644fd11 100644
--- a/engines/twine/scene/scene.cpp
+++ b/engines/twine/scene/scene.cpp
@@ -204,7 +204,7 @@ bool Scene::loadSceneLBA2() {
 		act->_oldPos = act->posObj();
 		act->_strengthOfHit = stream.readByte();
 		setBonusParameterFlags(act, stream.readUint16LE());
-		act->_angle = (int16)stream.readUint16LE();
+		act->_beta = (int16)stream.readUint16LE();
 		act->_speed = (int16)stream.readUint16LE();
 		act->_controlMode = (ControlMode)stream.readByte();
 		act->_cropLeft = stream.readSint16LE();
@@ -337,7 +337,7 @@ bool Scene::loadSceneLBA1() {
 		act->_strengthOfHit = stream.readByte();
 		setBonusParameterFlags(act, stream.readUint16LE());
 		act->_bonusParameter.givenNothing = 0;
-		act->_angle = (int16)stream.readUint16LE();
+		act->_beta = (int16)stream.readUint16LE();
 		act->_speed = (int16)stream.readUint16LE();
 		act->_controlMode = (ControlMode)stream.readUint16LE();
 		act->_cropLeft = stream.readSint16LE();
@@ -570,7 +570,7 @@ void Scene::changeScene() {
 
 	if (_previousSceneIdx != SCENE_CEILING_GRID_FADE_1 && _previousSceneIdx != _needChangeScene) {
 		_engine->_actor->_previousHeroBehaviour = _engine->_actor->_heroBehaviour;
-		_engine->_actor->_previousHeroAngle = _sceneHero->_angle;
+		_engine->_actor->_previousHeroAngle = _sceneHero->_beta;
 		_engine->autoSave();
 	}
 
@@ -719,7 +719,7 @@ void Scene::checkZoneSce(int32 actorIdx) {
 		    (currentZ >= zone->mins.z && currentZ <= zone->maxs.z)) {
 			switch (zone->type) {
 			case ZoneType::kCube:
-				if (IS_HERO(actorIdx) && actor->_life > 0) {
+				if (IS_HERO(actorIdx) && actor->_lifePoint > 0) {
 					_needChangeScene = zone->num;
 					_zoneHeroPos.x = actor->_pos.x - zone->mins.x + zone->infoData.ChangeScene.x;
 					_zoneHeroPos.y = actor->_pos.y - zone->mins.y + zone->infoData.ChangeScene.y;
@@ -774,7 +774,7 @@ void Scene::checkZoneSce(int32 actorIdx) {
 				break;
 			case ZoneType::kLadder:
 				if (IS_HERO(actorIdx) && _engine->_actor->_heroBehaviour != HeroBehaviourType::kProtoPack && (actor->_genAnim == AnimationTypes::kForward || actor->_genAnim == AnimationTypes::kTopLadder || actor->_genAnim == AnimationTypes::kClimbLadder)) {
-					IVec3 destPos = _engine->_movements->rotateActor(actor->_boundingBox.mins.x, actor->_boundingBox.mins.z, actor->_angle + ANGLE_360 + ANGLE_135);
+					IVec3 destPos = _engine->_movements->rotate(actor->_boundingBox.mins.x, actor->_boundingBox.mins.z, actor->_beta + ANGLE_360 + ANGLE_135);
 					destPos.x += actor->_processActor.x;
 					destPos.z += actor->_processActor.z;
 
diff --git a/engines/twine/script/script_life_v1.cpp b/engines/twine/script/script_life_v1.cpp
index 63514a42144..936acd53a29 100644
--- a/engines/twine/script/script_life_v1.cpp
+++ b/engines/twine/script/script_life_v1.cpp
@@ -138,7 +138,7 @@ static int32 processLifeConditions(TwinEEngine *engine, LifeScriptContext &ctx)
 	int32 conditionOpcode = ctx.stream.readByte();
 	switch (conditionOpcode) {
 	case kcCOL:
-		if (ctx.actor->_life <= 0) {
+		if (ctx.actor->_lifePoint <= 0) {
 			engine->_scene->_currentScriptValue = -1;
 		} else {
 			engine->_scene->_currentScriptValue = ctx.actor->_collision;
@@ -147,7 +147,7 @@ static int32 processLifeConditions(TwinEEngine *engine, LifeScriptContext &ctx)
 		break;
 	case kcCOL_OBJ: {
 		int32 actorIdx = ctx.stream.readByte();
-		if (engine->_scene->getActor(actorIdx)->_life <= 0) {
+		if (engine->_scene->getActor(actorIdx)->_lifePoint <= 0) {
 			engine->_scene->_currentScriptValue = -1;
 		} else {
 			engine->_scene->_currentScriptValue = engine->_scene->getActor(actorIdx)->_collision;
@@ -247,7 +247,7 @@ static int32 processLifeConditions(TwinEEngine *engine, LifeScriptContext &ctx)
 
 		if (IS_HERO(targetActorIdx)) {
 			if (engine->_actor->_heroBehaviour == HeroBehaviourType::kDiscrete) {
-				int32 heroAngle = ClampAngle(ctx.actor->_angle + ANGLE_360 + ANGLE_45 - newAngle + ANGLE_360);
+				int32 heroAngle = ClampAngle(ctx.actor->_beta + ANGLE_360 + ANGLE_45 - newAngle + ANGLE_360);
 
 				if (ABS(heroAngle) <= ANGLE_90) {
 					engine->_scene->_currentScriptValue = engine->_movements->_targetActorDistance;
@@ -258,7 +258,7 @@ static int32 processLifeConditions(TwinEEngine *engine, LifeScriptContext &ctx)
 				engine->_scene->_currentScriptValue = engine->_movements->_targetActorDistance;
 			}
 		} else {
-			int32 heroAngle = ClampAngle(ctx.actor->_angle + ANGLE_360 + ANGLE_45 - newAngle + ANGLE_360);
+			int32 heroAngle = ClampAngle(ctx.actor->_beta + ANGLE_360 + ANGLE_45 - newAngle + ANGLE_360);
 
 			if (ABS(heroAngle) <= ANGLE_90) {
 				engine->_scene->_currentScriptValue = engine->_movements->_targetActorDistance;
@@ -294,12 +294,12 @@ static int32 processLifeConditions(TwinEEngine *engine, LifeScriptContext &ctx)
 	}
 	case kcLIFE_POINT:
 		debugCN(3, kDebugLevels::kDebugScripts, "life_point(");
-		engine->_scene->_currentScriptValue = ctx.actor->_life;
+		engine->_scene->_currentScriptValue = ctx.actor->_lifePoint;
 		break;
 	case kcLIFE_POINT_OBJ: {
 		int32 actorIdx = ctx.stream.readByte();
 		debugCN(3, kDebugLevels::kDebugScripts, "life_point_obj(%i, ", actorIdx);
-		engine->_scene->_currentScriptValue = engine->_scene->getActor(actorIdx)->_life;
+		engine->_scene->_currentScriptValue = engine->_scene->getActor(actorIdx)->_lifePoint;
 		break;
 	}
 	case kcNUM_LITTLE_KEYS:
@@ -1059,7 +1059,7 @@ static int32 lSET_DOOR_LEFT(TwinEEngine *engine, LifeScriptContext &ctx) {
 	const int32 distance = ctx.stream.readSint16LE();
 	debugC(3, kDebugLevels::kDebugScripts, "LIFE::SET_DOOR_LEFT(%i)", (int)distance);
 
-	ctx.actor->_angle = ANGLE_270;
+	ctx.actor->_beta = ANGLE_270;
 	ctx.actor->_pos.x = ctx.actor->_animStep.x - distance;
 	ctx.actor->_dynamicFlags.bIsSpriteMoving = 0;
 	ctx.actor->_speed = 0;
@@ -1075,7 +1075,7 @@ static int32 lSET_DOOR_RIGHT(TwinEEngine *engine, LifeScriptContext &ctx) {
 	const int32 distance = ctx.stream.readSint16LE();
 	debugC(3, kDebugLevels::kDebugScripts, "LIFE::SET_DOOR_RIGHT(%i)", (int)distance);
 
-	ctx.actor->_angle = ANGLE_90;
+	ctx.actor->_beta = ANGLE_90;
 	ctx.actor->_pos.x = ctx.actor->_animStep.x + distance;
 	ctx.actor->_dynamicFlags.bIsSpriteMoving = 0;
 	ctx.actor->_speed = 0;
@@ -1091,7 +1091,7 @@ static int32 lSET_DOOR_UP(TwinEEngine *engine, LifeScriptContext &ctx) {
 	const int32 distance = ctx.stream.readSint16LE();
 	debugC(3, kDebugLevels::kDebugScripts, "LIFE::SET_DOOR_UP(%i)", (int)distance);
 
-	ctx.actor->_angle = ANGLE_180;
+	ctx.actor->_beta = ANGLE_180;
 	ctx.actor->_pos.z = ctx.actor->_animStep.z - distance;
 	ctx.actor->_dynamicFlags.bIsSpriteMoving = 0;
 	ctx.actor->_speed = 0;
@@ -1107,7 +1107,7 @@ static int32 lSET_DOOR_DOWN(TwinEEngine *engine, LifeScriptContext &ctx) {
 	const int32 distance = ctx.stream.readSint16LE();
 	debugC(3, kDebugLevels::kDebugScripts, "LIFE::SET_DOOR_DOWN(%i)", (int)distance);
 
-	ctx.actor->_angle = ANGLE_0;
+	ctx.actor->_beta = ANGLE_0;
 	ctx.actor->_pos.z = ctx.actor->_animStep.z + distance;
 	ctx.actor->_dynamicFlags.bIsSpriteMoving = 0;
 	ctx.actor->_speed = 0;
@@ -1301,7 +1301,7 @@ static int32 lSUB_LIFE_POINT_OBJ(TwinEEngine *engine, LifeScriptContext &ctx) {
 
 	ActorStruct *otherActor = engine->_scene->getActor(otherActorIdx);
 	otherActor->addLife(-lifeValue);
-	if (otherActor->_life < 0) {
+	if (otherActor->_lifePoint < 0) {
 		otherActor->setLife(0);
 	}
 
@@ -1316,7 +1316,7 @@ static int32 lHIT_OBJ(TwinEEngine *engine, LifeScriptContext &ctx) {
 	const int32 otherActorIdx = ctx.stream.readByte();
 	const int32 strengthOfHit = ctx.stream.readByte();
 	debugC(3, kDebugLevels::kDebugScripts, "LIFE::HIT_OBJ(%i, %i)", (int)otherActorIdx, (int)strengthOfHit);
-	engine->_actor->hitObj(ctx.actorIdx, otherActorIdx, strengthOfHit, engine->_scene->getActor(otherActorIdx)->_angle);
+	engine->_actor->hitObj(ctx.actorIdx, otherActorIdx, strengthOfHit, engine->_scene->getActor(otherActorIdx)->_beta);
 	return 0;
 }
 
@@ -1556,7 +1556,7 @@ static int32 lFULL_POINT(TwinEEngine *engine, LifeScriptContext &ctx) {
 static int32 lBETA(TwinEEngine *engine, LifeScriptContext &ctx) {
 	const int32 newAngle = ctx.stream.readSint16LE();
 	debugC(3, kDebugLevels::kDebugScripts, "LIFE::BETA(%i)", (int)newAngle);
-	ctx.actor->_angle = ToAngle(newAngle);
+	ctx.actor->_beta = ToAngle(newAngle);
 	engine->_movements->clearRealAngle(ctx.actor);
 	return 0;
 }
@@ -1810,7 +1810,7 @@ static int32 lTHE_END(TwinEEngine *engine, LifeScriptContext &ctx) {
 	engine->_scene->_currentSceneIdx = LBA1SceneId::Polar_Island_Final_Battle;
 	engine->_actor->_heroBehaviour = engine->_actor->_previousHeroBehaviour;
 	engine->_scene->_newHeroPos.x = -1;
-	engine->_scene->_sceneHero->_angle = engine->_actor->_previousHeroAngle;
+	engine->_scene->_sceneHero->_beta = engine->_actor->_previousHeroAngle;
 	engine->autoSave();
 	return 1; // break;
 }
diff --git a/engines/twine/script/script_move_v1.cpp b/engines/twine/script/script_move_v1.cpp
index 578333db552..aecc38e5f4d 100644
--- a/engines/twine/script/script_move_v1.cpp
+++ b/engines/twine/script/script_move_v1.cpp
@@ -123,9 +123,9 @@ static int32 mGOTO_POINT(TwinEEngine *engine, MoveScriptContext &ctx) {
 	const int32 newAngle = engine->_movements->getAngleAndSetTargetActorDistance(ctx.actor->_pos.x, ctx.actor->_pos.z, sp.x, sp.z);
 
 	if (ctx.actor->_staticFlags.bIsSpriteActor) {
-		ctx.actor->_angle = newAngle;
+		ctx.actor->_beta = newAngle;
 	} else {
-		engine->_movements->initRealAngleConst(ctx.actor->_angle, newAngle, ctx.actor->_speed, &ctx.actor->_move);
+		engine->_movements->initRealAngleConst(ctx.actor->_beta, newAngle, ctx.actor->_speed, &ctx.actor->_moveAngle);
 	}
 
 	if (engine->_movements->_targetActorDistance > 500) {
@@ -172,10 +172,10 @@ static int32 mANGLE(TwinEEngine *engine, MoveScriptContext &ctx) {
 		return 0;
 	}
 	engine->_scene->_currentScriptValue = angle;
-	if (ctx.actor->_move.numOfStep == 0) {
-		engine->_movements->initRealAngleConst(ctx.actor->_angle, angle, ctx.actor->_speed, &ctx.actor->_move);
+	if (ctx.actor->_moveAngle.numOfStep == 0) {
+		engine->_movements->initRealAngleConst(ctx.actor->_beta, angle, ctx.actor->_speed, &ctx.actor->_moveAngle);
 	}
-	if (ctx.actor->_angle == angle) {
+	if (ctx.actor->_beta == angle) {
 		engine->_movements->clearRealAngle(ctx.actor);
 		return 0;
 	}
@@ -253,9 +253,9 @@ static int32 mGOTO_SYM_POINT(TwinEEngine *engine, MoveScriptContext &ctx) {
 	const int32 newAngle = ANGLE_180 + engine->_movements->getAngleAndSetTargetActorDistance(ctx.actor->_pos, sp);
 
 	if (ctx.actor->_staticFlags.bIsSpriteActor) {
-		ctx.actor->_angle = newAngle;
+		ctx.actor->_beta = newAngle;
 	} else {
-		engine->_movements->initRealAngleConst(ctx.actor->_angle, newAngle, ctx.actor->_speed, &ctx.actor->_move);
+		engine->_movements->initRealAngleConst(ctx.actor->_beta, newAngle, ctx.actor->_speed, &ctx.actor->_moveAngle);
 	}
 
 	if (engine->_movements->_targetActorDistance > 500) {
@@ -322,7 +322,7 @@ static int32 mGOTO_POINT_3D(TwinEEngine *engine, MoveScriptContext &ctx) {
 	engine->_scene->_currentScriptValue = trackId;
 
 	const IVec3 &sp = engine->_scene->_sceneTracks[engine->_scene->_currentScriptValue];
-	ctx.actor->_angle = engine->_movements->getAngleAndSetTargetActorDistance(ctx.actor->_pos.x, ctx.actor->_pos.z, sp.x, sp.z);
+	ctx.actor->_beta = engine->_movements->getAngleAndSetTargetActorDistance(ctx.actor->_pos.x, ctx.actor->_pos.z, sp.x, sp.z);
 	ctx.actor->_spriteActorRotation = engine->_movements->getAngleAndSetTargetActorDistance(ctx.actor->_pos.y, 0, sp.y, engine->_movements->_targetActorDistance);
 
 	if (engine->_movements->_targetActorDistance > 100) {
@@ -343,7 +343,7 @@ static int32 mSPEED(TwinEEngine *engine, MoveScriptContext &ctx) {
 	debugC(3, kDebugLevels::kDebugScripts, "MOVE::SPEED(%i)", (int)ctx.actor->_speed);
 
 	if (ctx.actor->_staticFlags.bIsSpriteActor) {
-		engine->_movements->setActorAngle(ANGLE_0, ctx.actor->_speed, ANGLE_17, &ctx.actor->_move);
+		engine->_movements->setActorAngle(ANGLE_0, ctx.actor->_speed, ANGLE_17, &ctx.actor->_moveAngle);
 	}
 
 	return 0;
@@ -419,7 +419,7 @@ static int32 mBETA(TwinEEngine *engine, MoveScriptContext &ctx) {
 	const int16 beta = ctx.stream.readSint16LE();
 	debugC(3, kDebugLevels::kDebugScripts, "MOVE::BETA(%i)", (int)beta);
 
-	ctx.actor->_angle = beta;
+	ctx.actor->_beta = beta;
 
 	if (!ctx.actor->_staticFlags.bIsSpriteActor) {
 		engine->_movements->clearRealAngle(ctx.actor);
@@ -432,11 +432,11 @@ static int32 mOPEN_GENERIC(TwinEEngine *engine, MoveScriptContext &ctx, int32 an
 	const int16 doorStatus = ctx.stream.readSint16LE();
 	debugC(3, kDebugLevels::kDebugScripts, "MOVE::OPEN(%i, %i)", (int)doorStatus, angle);
 	if (ctx.actor->_staticFlags.bIsSpriteActor && ctx.actor->_staticFlags.bUsesClipping) {
-		ctx.actor->_angle = angle;
+		ctx.actor->_beta = angle;
 		ctx.actor->_doorWidth = doorStatus;
 		ctx.actor->_dynamicFlags.bIsSpriteMoving = 1;
 		ctx.actor->_speed = 1000;
-		engine->_movements->setActorAngle(ANGLE_0, ANGLE_351, ANGLE_17, &ctx.actor->_move);
+		engine->_movements->setActorAngle(ANGLE_0, ANGLE_351, ANGLE_17, &ctx.actor->_moveAngle);
 	}
 	if (engine->_scene->_currentSceneIdx == LBA1SceneId::Proxima_Island_Museum && ctx.actor->_actorIdx == 16) {
 		engine->unlockAchievement("LBA_ACH_009");
@@ -488,7 +488,7 @@ static int32 mCLOSE(TwinEEngine *engine, MoveScriptContext &ctx) {
 		ctx.actor->_doorWidth = 0;
 		ctx.actor->_dynamicFlags.bIsSpriteMoving = 1;
 		ctx.actor->_speed = -1000;
-		engine->_movements->setActorAngle(ANGLE_0, -ANGLE_351, ANGLE_17, &ctx.actor->_move);
+		engine->_movements->setActorAngle(ANGLE_0, -ANGLE_351, ANGLE_17, &ctx.actor->_moveAngle);
 	}
 	return 0;
 }
@@ -601,14 +601,14 @@ static int32 mFACE_HERO(TwinEEngine *engine, MoveScriptContext &ctx) {
 		return 0;
 	}
 	engine->_scene->_currentScriptValue = angle;
-	if (engine->_scene->_currentScriptValue == -1 && ctx.actor->_move.numOfStep == 0) {
+	if (engine->_scene->_currentScriptValue == -1 && ctx.actor->_moveAngle.numOfStep == 0) {
 		engine->_scene->_currentScriptValue = engine->_movements->getAngleAndSetTargetActorDistance(ctx.actor->posObj(), engine->_scene->_sceneHero->posObj());
-		engine->_movements->initRealAngleConst(ctx.actor->_angle, engine->_scene->_currentScriptValue, ctx.actor->_speed, &ctx.actor->_move);
+		engine->_movements->initRealAngleConst(ctx.actor->_beta, engine->_scene->_currentScriptValue, ctx.actor->_speed, &ctx.actor->_moveAngle);
 		ctx.stream.rewind(2);
 		ctx.stream.writeSint16LE(engine->_scene->_currentScriptValue);
 	}
 
-	if (ctx.actor->_angle != engine->_scene->_currentScriptValue) {
+	if (ctx.actor->_beta != engine->_scene->_currentScriptValue) {
 		ctx.undo(2);
 		return 1;
 	}
@@ -632,21 +632,21 @@ static int32 mANGLE_RND(TwinEEngine *engine, MoveScriptContext &ctx) {
 
 	engine->_scene->_currentScriptValue = val2;
 
-	if (engine->_scene->_currentScriptValue == -1 && ctx.actor->_move.numOfStep == 0) {
+	if (engine->_scene->_currentScriptValue == -1 && ctx.actor->_moveAngle.numOfStep == 0) {
 		if (engine->getRandomNumber() & 1) {
-			const int32 newAngle = ctx.actor->_angle + ANGLE_90 + (ABS(val1) >> 1);
+			const int32 newAngle = ctx.actor->_beta + ANGLE_90 + (ABS(val1) >> 1);
 			engine->_scene->_currentScriptValue = ClampAngle(newAngle - engine->getRandomNumber(val1));
 		} else {
-			const int32 newAngle = ctx.actor->_angle - ANGLE_90 + (ABS(val1) >> 1);
+			const int32 newAngle = ctx.actor->_beta - ANGLE_90 + (ABS(val1) >> 1);
 			engine->_scene->_currentScriptValue = ClampAngle(newAngle - engine->getRandomNumber(val1));
 		}
 
-		engine->_movements->initRealAngleConst(ctx.actor->_angle, engine->_scene->_currentScriptValue, ctx.actor->_speed, &ctx.actor->_move);
+		engine->_movements->initRealAngleConst(ctx.actor->_beta, engine->_scene->_currentScriptValue, ctx.actor->_speed, &ctx.actor->_moveAngle);
 		ctx.stream.rewind(2);
 		ctx.stream.writeSint16LE(engine->_scene->_currentScriptValue);
 	}
 
-	if (ctx.actor->_angle != engine->_scene->_currentScriptValue) {
+	if (ctx.actor->_beta != engine->_scene->_currentScriptValue) {
 		ctx.undo(4);
 		return 1;
 	}
diff --git a/engines/twine/twine.cpp b/engines/twine/twine.cpp
index f2be59a211c..6415fcdd40f 100644
--- a/engines/twine/twine.cpp
+++ b/engines/twine/twine.cpp
@@ -707,13 +707,13 @@ void TwinEEngine::processInventoryAction() {
 	case kiPenguin: {
 		ActorStruct *penguin = _scene->getActor(_scene->_mecaPenguinIdx);
 
-		const IVec3 &destPos = _movements->rotateActor(0, 800, _scene->_sceneHero->_angle);
+		const IVec3 &destPos = _movements->rotate(0, 800, _scene->_sceneHero->_beta);
 
 		penguin->_pos = _scene->_sceneHero->_pos;
 		penguin->_pos.x += destPos.x;
 		penguin->_pos.z += destPos.z;
 
-		penguin->_angle = _scene->_sceneHero->_angle;
+		penguin->_beta = _scene->_sceneHero->_beta;
 
 		if (_collision->checkValidObjPos(_scene->_mecaPenguinIdx)) {
 			penguin->setLife(kActorMaxLife);
@@ -721,7 +721,7 @@ void TwinEEngine::processInventoryAction() {
 			_actor->initModelActor(BodyType::btNormal, _scene->_mecaPenguinIdx);
 			penguin->_dynamicFlags.bIsDead = 0;
 			penguin->setBrickShape(ShapeType::kNone);
-			_movements->initRealAngleConst(penguin->_angle, penguin->_angle, penguin->_speed, &penguin->_move);
+			_movements->initRealAngleConst(penguin->_beta, penguin->_beta, penguin->_speed, &penguin->_moveAngle);
 			_gameState->removeItem(InventoryItems::kiPenguin);
 			penguin->_delayInMillis = _lbaTime + TO_SECONDS(30);
 		}
@@ -733,7 +733,7 @@ void TwinEEngine::processInventoryAction() {
 		break;
 	}
 	case kiCloverLeaf:
-		if (_scene->_sceneHero->_life < kActorMaxLife) {
+		if (_scene->_sceneHero->_lifePoint < kActorMaxLife) {
 			if (_gameState->_inventoryNumLeafs > 0) {
 				_scene->_sceneHero->setLife(kActorMaxLife);
 				_gameState->setMagicPoints(_gameState->_magicLevelIdx * 20);
@@ -794,7 +794,7 @@ bool TwinEEngine::runGameEngine() { // mainLoopInteration
 		}
 	} else {
 		// Process give up menu - Press ESC
-		if (_input->toggleAbortAction() && _scene->_sceneHero->_life > 0 && _scene->_sceneHero->_body != -1 && !_scene->_sceneHero->_staticFlags.bIsHidden) {
+		if (_input->toggleAbortAction() && _scene->_sceneHero->_lifePoint > 0 && _scene->_sceneHero->_body != -1 && !_scene->_sceneHero->_staticFlags.bIsHidden) {
 			ScopedEngineFreeze scopedFreeze(this);
 			exitSceneryView();
 			const int giveUp = _menu->giveupMenu();
@@ -928,7 +928,7 @@ bool TwinEEngine::runGameEngine() { // mainLoopInteration
 			continue;
 		}
 
-		if (actor->_life == 0) {
+		if (actor->_lifePoint == 0) {
 			if (IS_HERO(a)) {
 				_animations->initAnim(AnimationTypes::kLandDeath, AnimType::kAnimationSet, AnimationTypes::kStanding, OWN_ACTOR_SCENE_INDEX);
 				actor->_controlMode = ControlMode::kNoMove;
@@ -998,7 +998,7 @@ bool TwinEEngine::runGameEngine() { // mainLoopInteration
 			}
 		}
 
-		if (actor->_life <= 0) {
+		if (actor->_lifePoint <= 0) {
 			if (IS_HERO(a)) {
 				if (actor->_dynamicFlags.bAnimEnded) {
 					if (_gameState->_inventoryNumLeafs > 0) { // use clover leaf automaticaly
@@ -1021,7 +1021,7 @@ bool TwinEEngine::runGameEngine() { // mainLoopInteration
 						_gameState->setLeafs(1);
 						_gameState->setMaxMagicPoints();
 						_actor->_heroBehaviour = _actor->_previousHeroBehaviour;
-						actor->_angle = _actor->_previousHeroAngle;
+						actor->_beta = _actor->_previousHeroAngle;
 						actor->setLife(kActorMaxLife);
 
 						if (_scene->_previousSceneIdx != _scene->_currentSceneIdx) {


Commit: 3cdd458428a9ece98730efeff76aa2e390981c4c
    https://github.com/scummvm/scummvm/commit/3cdd458428a9ece98730efeff76aa2e390981c4c
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2023-01-15T11:28:58+01:00

Commit Message:
TWINE: simplified checkValidObjPos

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


diff --git a/engines/twine/scene/collision.cpp b/engines/twine/scene/collision.cpp
index 140717aa422..84503984bae 100644
--- a/engines/twine/scene/collision.cpp
+++ b/engines/twine/scene/collision.cpp
@@ -234,51 +234,42 @@ void Collision::handlePushing(const IVec3 &minsTest, const IVec3 &maxsTest, Acto
 bool Collision::checkValidObjPos(int32 actorIdx) {
 	const ActorStruct *actor = _engine->_scene->getActor(actorIdx);
 
-	const int16 x0 = actor->posObj().x + actor->_boundingBox.mins.x;
-	const int16 x1 = actor->posObj().x + actor->_boundingBox.maxs.x;
-	const int16 y0 = actor->posObj().y + actor->_boundingBox.mins.y;
-	const int16 y1 = actor->posObj().y + actor->_boundingBox.maxs.y;
-	const int16 z0 = actor->posObj().z + actor->_boundingBox.mins.z;
-	const int16 z1 = actor->posObj().z + actor->_boundingBox.maxs.z;
-
-	if (x0 < 0 || x0 > SIZE_BRICK_XZ * 63) {
+	const IVec3 m0 = actor->posObj() + actor->_boundingBox.mins;
+	const IVec3 m1 = actor->posObj() + actor->_boundingBox.maxs;
+
+	if (m0.x < 0 || m0.x > SIZE_BRICK_XZ * 63) {
 		return false;
 	}
-	if (x1 < 0 || x1 > SIZE_BRICK_XZ * 63) {
+	if (m1.x < 0 || m1.x > SIZE_BRICK_XZ * 63) {
 		return false;
 	}
-	if (z0 < 0 || z0 > SIZE_BRICK_XZ * 63) {
+	if (m0.z < 0 || m0.z > SIZE_BRICK_XZ * 63) {
 		return false;
 	}
-	if (z1 < 0 || z1 > SIZE_BRICK_XZ * 63) {
+	if (m1.z < 0 || m1.z > SIZE_BRICK_XZ * 63) {
 		return false;
 	}
 
 	Grid *grid = _engine->_grid;
-	if (grid->worldColBrickFull(x0, y0, z0, actor->_boundingBox.maxs.y, actorIdx) != ShapeType::kNone) {
+	if (grid->worldColBrickFull(m0.x, m0.y, m0.z, actor->_boundingBox.maxs.y, actorIdx) != ShapeType::kNone) {
 		return false;
 	}
-	if (grid->worldColBrickFull(x1, y0, z0, actor->_boundingBox.maxs.y, actorIdx) != ShapeType::kNone) {
+	if (grid->worldColBrickFull(m1.x, m0.y, m0.z, actor->_boundingBox.maxs.y, actorIdx) != ShapeType::kNone) {
 		return false;
 	}
-	if (grid->worldColBrickFull(x1, y0, z1, actor->_boundingBox.maxs.y, actorIdx) != ShapeType::kNone) {
+	if (grid->worldColBrickFull(m1.x, m0.y, m1.z, actor->_boundingBox.maxs.y, actorIdx) != ShapeType::kNone) {
 		return false;
 	}
-	if (grid->worldColBrickFull(x0, y0, z1, actor->_boundingBox.maxs.y, actorIdx) != ShapeType::kNone) {
+	if (grid->worldColBrickFull(m0.x, m0.y, m1.z, actor->_boundingBox.maxs.y, actorIdx) != ShapeType::kNone) {
 		return false;
 	}
 
 	for (int32 n = 0; n < _engine->_scene->_sceneNumActors; ++n) {
 		const ActorStruct *actorTest = _engine->_scene->getActor(n);
 		if (n != actorIdx && actorTest->_body != -1 && !actor->_staticFlags.bIsHidden && actorTest->_carryBy != actorIdx) {
-			const int16 xt0 = actorTest->posObj().x + actorTest->_boundingBox.mins.x;
-			const int16 xt1 = actorTest->posObj().x + actorTest->_boundingBox.maxs.x;
-			const int16 yt0 = actorTest->posObj().y + actorTest->_boundingBox.mins.y;
-			const int16 yt1 = actorTest->posObj().y + actorTest->_boundingBox.maxs.y;
-			const int16 zt0 = actorTest->posObj().z + actorTest->_boundingBox.mins.z;
-			const int16 zt1 = actorTest->posObj().z + actorTest->_boundingBox.maxs.z;
-
-			if (x0 < xt1 && x1 > xt0 && y0 < yt1 && y1 > yt0 && z0 < zt1 && z1 > zt0) {
+			const IVec3 &t0 = actorTest->posObj() + actorTest->_boundingBox.mins;
+			const IVec3 &t1 = actorTest->posObj() + actorTest->_boundingBox.maxs;
+			if (m0.x < t1.x && m1.x > t0.x && m0.y < t1.y && m1.y > t0.y && m0.z < t1.z && m1.z > t0.z) {
 				return false;
 			}
 		}


Commit: b5eb958d8d1fc04b4ca94767a1e70e80e8327b9a
    https://github.com/scummvm/scummvm/commit/b5eb958d8d1fc04b4ca94767a1e70e80e8327b9a
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2023-01-15T11:28:58+01:00

Commit Message:
TWINE: renamed methods to match original sources

Changed paths:
    engines/twine/scene/actor.cpp
    engines/twine/scene/actor.h
    engines/twine/scene/movements.cpp
    engines/twine/script/script_life_v1.cpp
    engines/twine/script/script_move_v1.cpp
    engines/twine/twine.cpp


diff --git a/engines/twine/scene/actor.cpp b/engines/twine/scene/actor.cpp
index 1e193a7b0cb..29758f3c4cd 100644
--- a/engines/twine/scene/actor.cpp
+++ b/engines/twine/scene/actor.cpp
@@ -123,7 +123,7 @@ void Actor::setBehaviour(HeroBehaviourType behaviour) {
 	sceneHero->_body = -1;
 	sceneHero->_genBody = BodyType::btNone;
 
-	initModelActor(bodyIdx, OWN_ACTOR_SCENE_INDEX);
+	initBody(bodyIdx, OWN_ACTOR_SCENE_INDEX);
 
 	sceneHero->_genAnim = AnimationTypes::kAnimNone;
 	sceneHero->_flagAnim = AnimType::kAnimationTypeLoop;
@@ -149,7 +149,7 @@ TextId Actor::getTextIdForBehaviour() const {
 	return (TextId)(int32)_heroBehaviour;
 }
 
-int32 Actor::initBody(BodyType bodyIdx, int32 actorIdx, ActorBoundingBox &actorBoundingBox) {
+int32 Actor::searchBody(BodyType bodyIdx, int32 actorIdx, ActorBoundingBox &actorBoundingBox) {
 	if (bodyIdx == BodyType::btNone) {
 		return -1;
 	}
@@ -163,7 +163,7 @@ int32 Actor::initBody(BodyType bodyIdx, int32 actorIdx, ActorBoundingBox &actorB
 	return body->hqrBodyIndex;
 }
 
-void Actor::initModelActor(BodyType bodyIdx, int16 actorIdx) {
+void Actor::initBody(BodyType bodyIdx, int16 actorIdx) {
 	ActorStruct *localActor = _engine->_scene->getActor(actorIdx);
 	if (localActor->_staticFlags.bIsSpriteActor) {
 		return;
@@ -176,7 +176,7 @@ void Actor::initModelActor(BodyType bodyIdx, int16 actorIdx) {
 	}
 
 	ActorBoundingBox actorBoundingBox;
-	const int32 newBody = initBody(bodyIdx, actorIdx, actorBoundingBox);
+	const int32 newBody = searchBody(bodyIdx, actorIdx, actorBoundingBox);
 	if (newBody == -1) {
 		localActor->_genBody = BodyType::btNone;
 		localActor->_body = -1;
@@ -217,6 +217,11 @@ void Actor::initModelActor(BodyType bodyIdx, int16 actorIdx) {
 		localActor->_boundingBox.mins.z = -size;
 		localActor->_boundingBox.maxs.z = size;
 	}
+#if 0
+	if (oldbody != -1 && localActor->_anim != -1) {
+		copyInterAnim(_engine->_resources->_bodyData[oldbody], _engine->_resources->_bodyData[localActor->_body]);
+	}
+#endif
 }
 
 void Actor::initActor(int16 actorIdx) {
@@ -240,7 +245,7 @@ void Actor::initActor(int16 actorIdx) {
 		actor->_body = -1;
 
 		debug(1, "Init actor %i with model %i", actorIdx, (int)actor->_genBody);
-		initModelActor(actor->_genBody, actorIdx);
+		initBody(actor->_genBody, actorIdx);
 
 		actor->_anim = -1;
 		actor->_flagAnim = AnimType::kAnimationTypeLoop;
diff --git a/engines/twine/scene/actor.h b/engines/twine/scene/actor.h
index 181a5adff5c..bd3dd10f735 100644
--- a/engines/twine/scene/actor.h
+++ b/engines/twine/scene/actor.h
@@ -275,7 +275,7 @@ private:
 	 * @param bodyIdx 3D actor body index
 	 * @param actorIdx 3D actor index
 	 */
-	int32 initBody(BodyType bodyIdx, int32 actorIdx, ActorBoundingBox &actorBoundingBox);
+	int32 searchBody(BodyType bodyIdx, int32 actorIdx, ActorBoundingBox &actorBoundingBox);
 
 	void loadBehaviourEntity(ActorStruct *actor, EntityData &entityData, int16 &bodyAnimIndex, int32 index);
 
@@ -327,7 +327,7 @@ public:
 	 * @param bodyIdx 3D actor body index
 	 * @param actorIdx 3D actor index
 	 */
-	void initModelActor(BodyType bodyIdx, int16 actorIdx);
+	void initBody(BodyType bodyIdx, int16 actorIdx);
 
 	/**
 	 * Initialize actors
diff --git a/engines/twine/scene/movements.cpp b/engines/twine/scene/movements.cpp
index f03da4f81d7..4dcc07ed635 100644
--- a/engines/twine/scene/movements.cpp
+++ b/engines/twine/scene/movements.cpp
@@ -279,7 +279,7 @@ bool Movements::processAttackExecution(int actorIdx) {
 		}
 	} else if (_engine->_gameState->hasItem(InventoryItems::kiUseSabre)) {
 		if (actor->_genBody != BodyType::btSabre) {
-			_engine->_actor->initModelActor(BodyType::btSabre, actorIdx);
+			_engine->_actor->initBody(BodyType::btSabre, actorIdx);
 		}
 
 		_engine->_animations->initAnim(AnimationTypes::kSabreAttack, AnimType::kAnimationThen, AnimationTypes::kStanding, actorIdx);
diff --git a/engines/twine/script/script_life_v1.cpp b/engines/twine/script/script_life_v1.cpp
index 936acd53a29..36c8c02c4f8 100644
--- a/engines/twine/script/script_life_v1.cpp
+++ b/engines/twine/script/script_life_v1.cpp
@@ -634,7 +634,7 @@ static int32 lELSE(TwinEEngine *engine, LifeScriptContext &ctx) {
 static int32 lBODY(TwinEEngine *engine, LifeScriptContext &ctx) {
 	const BodyType bodyIdx = (BodyType)ctx.stream.readByte();
 	debugC(3, kDebugLevels::kDebugScripts, "LIFE::BODY(%i)", (int)bodyIdx);
-	engine->_actor->initModelActor(bodyIdx, ctx.actorIdx);
+	engine->_actor->initBody(bodyIdx, ctx.actorIdx);
 	return 0;
 }
 
@@ -646,7 +646,7 @@ static int32 lBODY_OBJ(TwinEEngine *engine, LifeScriptContext &ctx) {
 	const int32 otherActorIdx = ctx.stream.readByte();
 	const BodyType otherBodyIdx = (BodyType)ctx.stream.readByte();
 	debugC(3, kDebugLevels::kDebugScripts, "LIFE::BODY_OBJ(%i, %i)", (int)otherActorIdx, (int)otherBodyIdx);
-	engine->_actor->initModelActor(otherBodyIdx, otherActorIdx);
+	engine->_actor->initBody(otherBodyIdx, otherActorIdx);
 	return 0;
 }
 
diff --git a/engines/twine/script/script_move_v1.cpp b/engines/twine/script/script_move_v1.cpp
index aecc38e5f4d..4e677c0da2f 100644
--- a/engines/twine/script/script_move_v1.cpp
+++ b/engines/twine/script/script_move_v1.cpp
@@ -92,7 +92,7 @@ static int32 mNOP(TwinEEngine *engine, MoveScriptContext &ctx) {
  */
 static int32 mBODY(TwinEEngine *engine, MoveScriptContext &ctx) {
 	BodyType bodyIdx = (BodyType)ctx.stream.readByte();
-	engine->_actor->initModelActor(bodyIdx, ctx.actorIdx);
+	engine->_actor->initBody(bodyIdx, ctx.actorIdx);
 	debugC(3, kDebugLevels::kDebugScripts, "MOVE::BODY(%i)", (int)bodyIdx);
 	return 0;
 }
@@ -407,7 +407,7 @@ static int32 mWAIT_NUM_SECOND(TwinEEngine *engine, MoveScriptContext &ctx) {
  */
 static int32 mNO_BODY(TwinEEngine *engine, MoveScriptContext &ctx) {
 	debugC(3, kDebugLevels::kDebugScripts, "MOVE::NO_BODY()");
-	engine->_actor->initModelActor(BodyType::btNone, ctx.actorIdx);
+	engine->_actor->initBody(BodyType::btNone, ctx.actorIdx);
 	return 0;
 }
 
diff --git a/engines/twine/twine.cpp b/engines/twine/twine.cpp
index 6415fcdd40f..5cb3f4eba08 100644
--- a/engines/twine/twine.cpp
+++ b/engines/twine/twine.cpp
@@ -672,7 +672,7 @@ void TwinEEngine::processInventoryAction() {
 		break;
 	case kiMagicBall:
 		if (_gameState->_usingSabre) {
-			_actor->initModelActor(BodyType::btNormal, OWN_ACTOR_SCENE_INDEX);
+			_actor->initBody(BodyType::btNormal, OWN_ACTOR_SCENE_INDEX);
 		}
 		_gameState->_usingSabre = false;
 		break;
@@ -681,7 +681,7 @@ void TwinEEngine::processInventoryAction() {
 			if (_actor->_heroBehaviour == HeroBehaviourType::kProtoPack) {
 				_actor->setBehaviour(HeroBehaviourType::kNormal);
 			}
-			_actor->initModelActor(BodyType::btSabre, OWN_ACTOR_SCENE_INDEX);
+			_actor->initBody(BodyType::btSabre, OWN_ACTOR_SCENE_INDEX);
 			_animations->initAnim(AnimationTypes::kSabreUnknown, AnimType::kAnimationThen, AnimationTypes::kStanding, OWN_ACTOR_SCENE_INDEX);
 
 			_gameState->_usingSabre = true;
@@ -718,7 +718,7 @@ void TwinEEngine::processInventoryAction() {
 		if (_collision->checkValidObjPos(_scene->_mecaPenguinIdx)) {
 			penguin->setLife(kActorMaxLife);
 			penguin->_genBody = BodyType::btNone;
-			_actor->initModelActor(BodyType::btNormal, _scene->_mecaPenguinIdx);
+			_actor->initBody(BodyType::btNormal, _scene->_mecaPenguinIdx);
 			penguin->_dynamicFlags.bIsDead = 0;
 			penguin->setBrickShape(ShapeType::kNone);
 			_movements->initRealAngleConst(penguin->_beta, penguin->_beta, penguin->_speed, &penguin->_moveAngle);


Commit: 81011c936c1629c69d148c58cf1a0375d255e0f2
    https://github.com/scummvm/scummvm/commit/81011c936c1629c69d148c58cf1a0375d255e0f2
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2023-01-15T11:28:58+01:00

Commit Message:
TWINE: fixed parsing lba2 scene

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


diff --git a/engines/twine/scene/scene.cpp b/engines/twine/scene/scene.cpp
index dd71644fd11..55b0417809f 100644
--- a/engines/twine/scene/scene.cpp
+++ b/engines/twine/scene/scene.cpp
@@ -151,15 +151,18 @@ void Scene::setBonusParameterFlags(ActorStruct *act, uint16 bonusFlags) {
 bool Scene::loadSceneLBA2() {
 	Common::MemoryReadStream stream(_currentScene, _currentSceneSize);
 	_sceneTextBank = (TextBankId)stream.readByte();
-	_currentGameOverScene = stream.readByte();
-	stream.skip(4);
+	/*int8 currentCubeX =*/ stream.readSByte();
+	/*int8 currentCubeY =*/ stream.readSByte();
+	/*int8 shadowLevel =*/ stream.readSByte();
+	/*int8 modeLabyrinthe =*/ stream.readSByte();
+	_isOutsideScene = stream.readByte();
+
+	/*uint8 n =*/ stream.readByte();
 
 	_alphaLight = ClampAngle((int16)stream.readUint16LE());
 	_betaLight = ClampAngle((int16)stream.readUint16LE());
 	debug(2, "Using %i and %i as light vectors", _alphaLight, _betaLight);
 
-	_isOutsideScene = stream.readByte();
-
 	for (int i = 0; i < 4; ++i) {
 		_sampleAmbiance[i] = stream.readUint16LE();
 		_sampleRepeat[i] = stream.readUint16LE();
@@ -186,6 +189,8 @@ bool Scene::loadSceneLBA2() {
 	_sceneHero->_lifeScript = _currentScene + stream.pos();
 	stream.skip(_sceneHero->_lifeScriptSize);
 
+	/*uint32 checksum =*/ stream.readUint32LE();
+
 	_sceneNumActors = (int16)stream.readUint16LE();
 	int cnt = 1;
 	for (int32 a = 1; a < _sceneNumActors; a++, cnt++) {




More information about the Scummvm-git-logs mailing list