[Scummvm-git-logs] scummvm master -> 42d33ec1517db948a0c8b13bb2a9cef01d599fb6

bluegr bluegr at gmail.com
Tue Jun 8 23:52:39 UTC 2021


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

Summary:
42d33ec151 TRECISION: Split the Pathfinding3D and Renderer3D classes


Commit: 42d33ec1517db948a0c8b13bb2a9cef01d599fb6
    https://github.com/scummvm/scummvm/commit/42d33ec1517db948a0c8b13bb2a9cef01d599fb6
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2021-06-09T02:52:21+03:00

Commit Message:
TRECISION: Split the Pathfinding3D and Renderer3D classes

Changed paths:
  A engines/trecision/pathfinding3d.cpp
  A engines/trecision/pathfinding3d.h
  A engines/trecision/renderer3d.cpp
  A engines/trecision/renderer3d.h
  R engines/trecision/3d.cpp
  R engines/trecision/3d.h
    engines/trecision/actor.cpp
    engines/trecision/anim.cpp
    engines/trecision/dialog.cpp
    engines/trecision/graphics.cpp
    engines/trecision/inventory.cpp
    engines/trecision/logic.cpp
    engines/trecision/module.mk
    engines/trecision/resource.cpp
    engines/trecision/saveload.cpp
    engines/trecision/script.cpp
    engines/trecision/trecision.cpp


diff --git a/engines/trecision/actor.cpp b/engines/trecision/actor.cpp
index 7bde30f35b..08879658cd 100644
--- a/engines/trecision/actor.cpp
+++ b/engines/trecision/actor.cpp
@@ -20,11 +20,9 @@
  *
  */
 
-#include "trecision/3d.h"
 #include "trecision/actor.h"
-
-
 #include "trecision/sound.h"
+#include "trecision/pathfinding3d.h"
 #include "trecision/scheduler.h"
 #include "trecision/defines.h"
 #include "trecision/graphics.h"
diff --git a/engines/trecision/anim.cpp b/engines/trecision/anim.cpp
index c0a0821bc9..bfa5601bdd 100644
--- a/engines/trecision/anim.cpp
+++ b/engines/trecision/anim.cpp
@@ -21,9 +21,9 @@
  */
 
 #include "trecision/anim.h"
-#include "trecision/logic.h"
-#include "trecision/3d.h"
 #include "trecision/dialog.h"
+#include "trecision/logic.h"
+#include "trecision/pathfinding3d.h"
 #include "trecision/scheduler.h"
 #include "trecision/text.h"
 #include "trecision/trecision.h"
diff --git a/engines/trecision/dialog.cpp b/engines/trecision/dialog.cpp
index 7bc3fcd3ab..15a0a4edc0 100644
--- a/engines/trecision/dialog.cpp
+++ b/engines/trecision/dialog.cpp
@@ -20,12 +20,12 @@
  *
  */
 
-#include "trecision/3d.h"
 #include "trecision/actor.h"
 #include "trecision/defines.h"
 #include "trecision/dialog.h"
-#include "trecision/logic.h"
 #include "trecision/graphics.h"
+#include "trecision/logic.h"
+#include "trecision/pathfinding3d.h"
 #include "trecision/text.h"
 #include "trecision/trecision.h"
 #include "trecision/video.h"
diff --git a/engines/trecision/graphics.cpp b/engines/trecision/graphics.cpp
index c074e4d7d1..11531dab90 100644
--- a/engines/trecision/graphics.cpp
+++ b/engines/trecision/graphics.cpp
@@ -27,11 +27,12 @@
 #include "graphics/pixelformat.h"
 #include "graphics/surface.h"
 
-#include "trecision/3d.h"
 #include "trecision/actor.h"
 #include "trecision/anim.h"
 #include "trecision/defines.h"
 #include "trecision/graphics.h"
+#include "trecision/pathfinding3d.h"
+#include "trecision/renderer3d.h"
 #include "trecision/text.h"
 #include "trecision/trecision.h"
 #include "trecision/video.h"
diff --git a/engines/trecision/inventory.cpp b/engines/trecision/inventory.cpp
index dbe9a1eb93..2aa49b4bcd 100644
--- a/engines/trecision/inventory.cpp
+++ b/engines/trecision/inventory.cpp
@@ -20,11 +20,11 @@
  *
  */
 
-#include "trecision/3d.h"
 #include "trecision/actor.h"
 #include "trecision/defines.h"
 #include "trecision/graphics.h"
 #include "trecision/logic.h"
+#include "trecision/pathfinding3d.h"
 #include "trecision/text.h"
 #include "trecision/trecision.h"
 #include "trecision/video.h"
diff --git a/engines/trecision/logic.cpp b/engines/trecision/logic.cpp
index b71d17e958..9684020c92 100644
--- a/engines/trecision/logic.cpp
+++ b/engines/trecision/logic.cpp
@@ -22,14 +22,14 @@
 
 #include "common/config-manager.h"
 
-#include "trecision/struct.h"
-#include "trecision/3d.h"
 #include "trecision/actor.h"
 #include "trecision/defines.h"
 #include "trecision/dialog.h"
 #include "trecision/graphics.h"
 #include "trecision/logic.h"
-
+#include "trecision/pathfinding3d.h"
+#include "trecision/renderer3d.h"
+#include "trecision/struct.h"
 #include "trecision/scheduler.h"
 #include "trecision/sound.h"
 #include "trecision/text.h"
diff --git a/engines/trecision/module.mk b/engines/trecision/module.mk
index ed195e8357..e149ef9727 100644
--- a/engines/trecision/module.mk
+++ b/engines/trecision/module.mk
@@ -10,6 +10,8 @@ MODULE_OBJS = \
 	inventory.o \
 	logic.o \
 	metaengine.o \
+	pathfinding3d.o \
+	renderer3d.o \
 	resource.o \
 	sound.o \
 	saveload.o \
@@ -19,7 +21,6 @@ MODULE_OBJS = \
 	text.o \
 	trecision.o \
 	utils.o \
-	3d.o \
 	video.o
 
 # This module can be built as a plugin
diff --git a/engines/trecision/3d.cpp b/engines/trecision/pathfinding3d.cpp
similarity index 71%
rename from engines/trecision/3d.cpp
rename to engines/trecision/pathfinding3d.cpp
index ad696f7d05..dfee7ee891 100644
--- a/engines/trecision/3d.cpp
+++ b/engines/trecision/pathfinding3d.cpp
@@ -20,7 +20,7 @@
  *
  */
 
-#include "trecision/3d.h"
+#include "trecision/pathfinding3d.h"
 #include "trecision/anim.h"
 #include "trecision/sound.h"
 #include "trecision/text.h"
@@ -30,803 +30,7 @@
 #include "trecision/video.h"
 
 namespace Trecision {
-#define SHADOWVERTSNUM 42
-
-static const int16 _shadowVerts[SHADOWVERTSNUM] = {
-	6, 15, 23,
-	24, 32, 78,
-	80, 81, 83,
-	86, 90, 99,
-	107, 108, 116,
-	155, 157, 158,
-	160, 164, 168,
-	169, 173, 174,
-	187, 188, 192,
-	193, 213, 215,
-	227, 229, 235,
-	238, 249, 250,
-	252, 253, 299,
-	306, 330, 336
-};
-#define SHADOWFACESNUM 48
-
-const int16 _shadowFaces[SHADOWFACESNUM][3] = {
-	{22, 21, 5}, {7, 5, 22},
-	{7, 19, 5}, {5, 2, 19},
-	{27, 24, 16}, {27, 16, 18},
-	{18, 16, 9}, {18, 13, 9},
-	{13, 9, 2}, {3, 19, 12},
-	{25, 26, 17}, {17, 15, 25},
-	{17, 19, 15}, {15, 12, 19},
-	{20, 23, 8}, {8, 6, 20},
-	{6, 9, 3}, {3, 8, 6},
-	{12, 3, 4}, {4, 11, 12},
-	{35, 4, 11}, {13, 2, 1},
-	{1, 14, 13}, {14, 37, 1},
-	{1, 34, 37}, {31, 36, 37},
-	{37, 30, 31}, {29, 34, 35},
-	{35, 29, 28}, {36, 11, 31},
-	{30, 37, 14}, {29, 1, 34},
-	{28, 4, 35}, {36, 10, 35},
-	{35, 32, 10}, {37, 0, 34},
-	{37, 33, 0}, {0, 33, 39},
-	{39, 40, 0}, {10, 38, 32},
-	{32, 41, 38}, {36, 35, 34},
-	{36, 37, 35}, {11, 36, 35},
-	{38, 40, 41}, {41, 38, 39},
-	{2, 19, 13}, {3, 9, 12}
-};
-
-Renderer3D::Renderer3D(TrecisionEngine *vm) : _vm(vm) {
-	_zBuffer = new int16[ZBUFFERSIZE / 2];
-
-	_minXClip = 0;
-	_minYClip = 0;
-	_maxXClip = 0;
-	_maxYClip = 0;
-	_zBufStartX = 0;
-	_zBufStartY = 0;
-	_zBufWid = 0;
-	_shadowLightNum = 0;
-	_totalShadowVerts = 0;
-
-	// data for the triangle routines
-	for (int i = 0; i < 480; ++i) {
-		_lEdge[i] = 0;
-		_rEdge[i] = 0;
-		_lColor[i] = 0;
-		_rColor[i] = 0;
-		_lZ[i] = 0;
-		_rZ[i] = 0;
-		_lTextX[i] = 0;
-		_rTextX[i] = 0;
-		_lTextY[i] = 0;
-		_rTextY[i] = 0;
-	}
-
-	for (int i = 0; i < 10; ++i)
-		_shadowIntens[i] = 0;
-
-	for (int i = 0; i < MAXVERTEX; ++i) {
-		_vVertex[i].clear();
-		_shVertex[i].clear();
-	}
-}
-
-Renderer3D::~Renderer3D() {
-	delete[] _zBuffer;
-}
-
-void Renderer3D::textureTriangle(int32 x1, int32 y1, int32 z1, int32 c1, int32 tx1, int32 ty1,
-								 int32 x2, int32 y2, int32 z2, int32 c2, int32 tx2, int32 ty2,
-								 int32 x3, int32 y3, int32 z3, int32 c3, int32 tx3, int32 ty3,
-								 const STexture *t) {
-	int32 cl;  // color of left edge of horizontal scanline
-	int32 zl;  // zbuffer of left edge of horizontal scanline
-	int32 olx; // texture x of left edge of horizontal scanline
-	int32 oly; // texture y of left edge of horizontal scanline
-	int16 y;   // looping variable
-
-	if (y1 > _maxYClip)
-		y1 = _maxYClip;
-	if (y1 < _minYClip)
-		y1 = _minYClip;
-
-	int16 yBottom = y1;
-	int16 yTop = y1;
-	const uint8 *texture = t->_texture;
-
-	if (yBottom > y2) {
-		if (y2 < _minYClip)
-			y2 = _minYClip;
-		yBottom = y2;
-	}
-	if (yTop < y2) {
-		if (y2 > _maxYClip)
-			y2 = _maxYClip;
-		yTop = y2;
-	}
-	if (yBottom > y3) {
-		if (y3 < _minYClip)
-			y3 = _minYClip;
-		yBottom = y3;
-	}
-	if (yTop < y3) {
-		if (y3 > _maxYClip)
-			y3 = _maxYClip;
-		yTop = y3;
-	}
-	for (y = yBottom; y < yTop; ++y) {
-		_lEdge[y] = _maxXClip;
-		_rEdge[y] = _minXClip;
-	}
-
-	// scan the edges of the triangle
-	textureScanEdge(x1, y1, z1, c1, tx1, ty1, x2, y2, z2, c2, tx2, ty2);
-	textureScanEdge(x2, y2, z2, c2, tx2, ty2, x3, y3, z3, c3, tx3, ty3);
-	textureScanEdge(x3, y3, z3, c3, tx3, ty3, x1, y1, z1, c1, tx1, ty1);
-
-	// Gouraud fill the horizontal scanlines
-	for (y = yBottom; y < yTop; ++y) {
-		int32 el = _lEdge[y];
-		if (el < _minXClip)
-			el = _minXClip;
-		int32 er = _rEdge[y];
-		if (er > _maxXClip)
-			er = _maxXClip;
-
-		// edge right - edge left
-		int16 dx = er - el;
-
-		if (dx > 0) {
-			// slope dc/_dx
-			int32 mc = ((int16)(_rColor[y] - (cl = _lColor[y])) << 8) / dx;
-			// slope _dz/_dx
-			int32 mz = ((int32)(_rZ[y] - (zl = _lZ[y])) << 16) / dx;
-			// slope dty/_dx
-			int32 mtx = ((int32)(_rTextX[y] - (olx = _lTextX[y])) << 16) / dx;
-			// slope dty/_dx
-			int32 mty = ((int32)(_rTextY[y] - (oly = _lTextY[y])) << 16) / dx;
-			// pointer to zbuffer
-			int16 *z = _zBuffer + (y - _zBufStartY) * _zBufWid + (el - _zBufStartX);
-			uint16 x = el;
-
-			zl <<= 16;
-			cl <<= 8;
-			olx <<= 16;
-			oly <<= 16;
-			// loop through every pixel in horizontal scanline
-			while (dx) {
-				const int32 screenOffset = zl >> 16;
-				if (*z > screenOffset) {
-					const uint16 textureX = (uint16)(cl >> 9);
-					const uint16 textureY = texture[(olx >> 16) + t->_dx * (oly >> 16)];
-					_vm->_graphicsMgr->drawTexturePixel(textureX, textureY, x, y);
-					*z = (int16)screenOffset;
-				}
-				++x;         // increase screen x
-				++z;         // increase zbuffer
-				zl += mz;    // increase the zbuffer by _dz/_dx
-				cl += mc;    // increase the color by dc/_dx
-				olx += mtx;
-				oly += mty;
-				--dx; // pixel to do --
-			}
-		}
-	}
-}
-
-void Renderer3D::textureScanEdge(int32 x1, int32 y1, int32 z1, int32 c1, int32 tx1, int32 ty1, int32 x2, int32 y2, int32 z2, int32 c2, int32 tx2, int32 ty2) {
-	// make sure that edge goes from top to bottom
-	int16 dy = y2 - y1;
-	if (dy < 0) {
-		SWAP(y1, y2);
-		SWAP(x1, x2);
-		SWAP(c1, c2);
-		SWAP(z1, z2);
-		SWAP(tx1, tx2);
-		SWAP(ty1, ty2);
-
-		dy = -dy;
-	}
-
-	if (dy == 0)
-		dy = 1;
-
-	// initialize for stepping
-	int32 mx = ((x2 - x1) << 16) / dy; // dx/dy
-	int32 mz = ((z2 - z1) << 16) / dy; // dz/dy
-	int32 mc = ((c2 - c1) << 8) / dy;  // dc/dy
-	int32 mtx = ((tx2 - tx1) << 16) / dy;
-	int32 mty = ((ty2 - ty1) << 16) / dy;
-
-	x1 <<= 16; // starting x coordinate
-	z1 <<= 16; // starting z coordinate
-	c1 <<= 8;  // starting c color
-
-	tx1 <<= 16;
-	ty1 <<= 16;
-
-	// step through edge and record color values along the way
-	for (int32 count = y1; count < y2; ++count) {
-		int16 x = (uint16)(x1 >> 16);
-		if (x < _lEdge[count]) {
-			_lEdge[count] = x;
-			_lZ[count] = (int16)(z1 >> 16);
-			_lTextX[count] = (uint16)(tx1 >> 16);
-			_lTextY[count] = (uint16)(ty1 >> 16);
-			_lColor[count] = (uint8)(c1 >> 8);
-		}
-		if (x > _rEdge[count]) {
-			_rEdge[count] = x;
-			_rZ[count] = (int16)(z1 >> 16);
-			_rTextX[count] = (uint16)(tx1 >> 16);
-			_rTextY[count] = (uint16)(ty1 >> 16);
-			_rColor[count] = (uint8)(c1 >> 8);
-		}
-
-		x1 += mx; // x = x + dx/dy
-		c1 += mc; // c = c + dc/dy
-		z1 += mz; // z = z + dz/dy
-
-		tx1 += mtx;
-		ty1 += mty;
-	}
-}
-
-void Renderer3D::shadowTriangle(int32 x1, int32 y1, int32 x2, int32 y2,
-								int32 x3, int32 y3, uint8 cv, int32 zv) {
-	if (y1 > _maxYClip)
-		y1 = _maxYClip;
-	if (y1 < _minYClip)
-		y1 = _minYClip;
-
-	int16 yBottom = y1;
-	int16 yTop = y1;
-
-	if (yBottom > y2) {
-		if (y2 < _minYClip)
-			y2 = _minYClip;
-		yBottom = y2;
-	}
-	if (yTop < y2) {
-		if (y2 > _maxYClip)
-			y2 = _maxYClip;
-		yTop = y2;
-	}
-	if (yBottom > y3) {
-		if (y3 < _minYClip)
-			y3 = _minYClip;
-		yBottom = y3;
-	}
-	if (yTop < y3) {
-		if (y3 > _maxYClip)
-			y3 = _maxYClip;
-		yTop = y3;
-	}
-
-	for (int16 y = yBottom; y < yTop; ++y) {
-		_lEdge[y] = _maxXClip;
-		_rEdge[y] = _minXClip;
-	}
-
-	// scan the edges of the triangle
-	shadowScanEdge(x1, y1, x2, y2);
-	shadowScanEdge(x2, y2, x3, y3);
-	shadowScanEdge(x3, y3, x1, y1);
-
-	// gouraud fill the horizontal scanlines
-	for (int16 y = yBottom; y < yTop; ++y) {
-		// coordinate of left edge of horizontal scanline
-		int32 el = _lEdge[y];
-		if (el < _minXClip)
-			el = _minXClip;
-		// coordinate of right edge of horizontal scanline
-		int32 er = _rEdge[y];
-		if (er > _maxXClip)
-			er = _maxXClip;
-
-		// edge right - edge left
-		int16 dx = er - el;
-
-		if (dx > 0) {
-			// screen offset
-			int16 x = el;
-			int16 *zBufferPtr = _zBuffer + (y - _zBufStartY) * _zBufWid + (el - _zBufStartX);
-		
-			// loop through every pixel in horizontal scanline
-			while (dx) {
-				if (*zBufferPtr != zv) {
-					_vm->_graphicsMgr->shadow(x, y, cv);
-					*zBufferPtr = zv;
-				}
-				++x;          // increase screen x
-				++zBufferPtr; // increase zbuffer
-				--dx;         // pixel to do --
-			}
-		}
-	}
-}
-
-void Renderer3D::shadowScanEdge(int32 x1, int32 y1, int32 x2, int32 y2) {
-	// make sure that edge goes from top to bottom
-	int16 dy = y2 - y1;
-	if (dy < 0) {
-		SWAP(y1, y2);
-		SWAP(x1, x2);
-
-		dy = -dy;
-	}
-
-	if (dy == 0)
-		dy = 1;
-
-	// initialize for stepping
-	int32 mx = ((x2 - x1) << 16) / dy; // slope dx/dy
-
-	x1 <<= 16; // starting x coordinate
-
-	// step through edge and record color values along the way
-	for (int32 count = y1; count < y2; ++count) {
-		int16 x = (int16)(x1 >> 16);
-		if (x < _lEdge[count])
-			_lEdge[count] = x;
-
-		if (x > _rEdge[count])
-			_rEdge[count] = x;
-
-		x1 += mx; // x = x + dx/dy
-	}
-}
-
-/**
- *	Initialize a 3D Room
- */
-void Renderer3D::init3DRoom() {
-	_vm->_cx = (MAXX - 1) / 2;
-	_vm->_cy = (MAXY - 1) / 2;
-
-	for (int c = 0; c < ZBUFFERSIZE / 2; ++c)
-		_zBuffer[c] = 0x7FFF;
-}
-
-void Renderer3D::resetZBuffer(int x1, int y1, int x2, int y2) {
-	if (x1 > x2 || y1 > y2)
-		return;
-
-	int size = (x2 - x1) * (y2 - y1);
-	if (size * 2 > ZBUFFERSIZE)
-		warning("Warning: _zBuffer size %d!\n", size * 2);
-
-	int16 *d = _zBuffer;
-	for (int i = 0; i < size; ++i)
-		*d++ = 0x7FFF;
-}
-
-/**
- *	Change the clipping area
- */
-void Renderer3D::setClipping(int16 x1, int16 y1, int16 x2, int16 y2) {
-	_minXClip = x1;
-	_minYClip = y1;
-	_maxXClip = x2;
-	_maxYClip = y2;
-}
-
-void Renderer3D::setZBufferRegion(int16 sx, int16 sy, int16 dx) {
-	_zBufStartX = sx;
-	_zBufStartY = sy;
-	_zBufWid = dx;
-}
-
-/**
- *	Determines whether a triangle has clockwise
- *	or counterclockwise vertices
- */
-int8 Renderer3D::clockWise(int16 x1, int16 y1, int16 x2, int16 y2, int16 x3, int16 y3) {
-	x2 -= x1;
-	y2 -= y1;
-
-	x3 -= x1;
-	y3 -= y1;
-
-	int32 a1 = ((int32)x2) * y3;
-	int32 a2 = ((int32)y2) * x3;
-
-	if (a1 > a2)
-		return 1; // clockwise
-	if (a1 < a2)
-		return -1; // counterclockwise
-
-	a1 = ((int32)x2) * x3;
-	a2 = ((int32)y2) * y3;
-	if (a1 < 0 || a2 < 0)
-		return -1;
-
-	a1 = ((int32)x2) * x2 + ((int32)y2) * y2;
-	a2 = ((int32)x3) * x3 + ((int32)y3) * y3;
-	if (a1 < a2)
-		return 1;
-
-	return 0;
-}
-
-void Renderer3D::calcCharacterPoints() {
-	Actor *actor = _vm->_actor;
-	SCamera *camera = actor->_camera;
-	SLight *light = actor->_light;
-	int vertexNum = actor->_vertexNum;
-
-	if (actor->_curAction > hLAST)
-		error("Error in drawCharacter() - _curAction > hLAST");
-
-	int cfp = 0;
-	int cur = 0;
-	while (cur < actor->_curAction)
-		cfp += _vm->_defActionLen[cur++];
-
-	if (actor->_curAction == hWALKOUT)
-		cfp = 1;
-
-	cfp += actor->_curFrame;
-
-	if (actor->_curAction == hLAST)
-		cfp = 0;
-
-	actor->_vertex = &actor->_characterArea[cfp * actor->_vertexNum];
-
-	_shadowLightNum = 0;
-	_totalShadowVerts = 0;
-
-	// camera matrix
-	float e10 = camera->_e1[0];
-	float e11 = camera->_e1[1];
-	float e12 = camera->_e1[2];
-
-	float e20 = camera->_e2[0];
-	float e21 = camera->_e2[1];
-	float e22 = camera->_e2[2];
-
-	float e30 = camera->_e3[0];
-	float e31 = camera->_e3[1];
-	float e32 = camera->_e3[2];
-
-	// Light directions
-	float l0 = 0.0f;
-	float l1 = 0.0f;
-	float l2 = 0.0f;
-
-	actor->_lim[0] = 32000;
-	actor->_lim[1] = -32000;
-	actor->_lim[2] = 32000;
-	actor->_lim[3] = -32000;
-	actor->_lim[4] = 32000;
-	actor->_lim[5] = -32000;
-
-	float t = (actor->_theta * PI2) / 360.0;
-	float cost = cos(t);
-	float sint = sin(t);
-
-	// Put all vertices in dark color
-	for (int i = 0; i < MAXVERTEX; ++i)
-		_vVertex[i]._angle = 180;
-
-	float dist;
-	float tx = 0.0f;
-	float ty = 0.0f;
-	float tz = 0.0f;
-	float pa0, pa1, pa2;
-
-	for (uint32 b = 0; b < actor->_lightNum; ++b) {
-		// if off                lint == 0
-		// if it has a shadow    lint & 0x80
-
-		int lint = light->_inten & 0x7F;
-		if (lint) {                                   // if it's not turned off
-			tx = light->_x - actor->_px - actor->_dx; // computes direction vector
-			tz = light->_z - actor->_pz - actor->_dz; // between light and actor
-			ty = light->_y;
-
-			if (light->_position) {                       // if it's attenuated
-				dist = sqrt(tx * tx + ty * ty + tz * tz); // Distance light <--> actor
-
-				// adjust light intensity due to the distance
-				if (_vm->floatComp(dist, light->_outr) == 1) // if it's out of range it's off
-					lint = 0;
-				else if (_vm->floatComp(dist, light->_inr) == 1) // if it's inside the circle it's decreased
-					lint = (int)((float)lint * (light->_outr - dist) / (light->_outr - light->_inr));
-			}
-		}
-
-		if (lint) { // If it's still on
-			// Light rotates around the actor
-			l0 = tx * cost - tz * sint;
-			l2 = tx * sint + tz * cost;
-			l1 = ty;
-			t = sqrt(l0 * l0 + l1 * l1 + l2 * l2);
-			l0 /= t;
-			l1 /= t;
-			l2 /= t;
-
-			// Adjust light intensity according to the spot
-			tx = (float)light->_fallOff;
-			if (light->_fallOff) { // for light spot only
-				ty = (float)light->_hotspot;
-
-				pa0 = light->_dx * cost - light->_dz * sint;
-				pa1 = light->_dy;
-				pa2 = light->_dx * sint + light->_dz * cost;
-
-				t = sqrt(pa0 * pa0 + pa1 * pa1 + pa2 * pa2);
-				pa0 /= t;
-				pa1 /= t;
-				pa2 /= t;
-
-				tz = acos((pa0 * l0) + (pa1 * l1) + (pa2 * l2)) * 360.0 / PI2;
-				tz = CLIP(tz, 0.f, 180.f);
-
-				// tx falloff
-				// ty hotspot
-				// tz current angle
-
-				_shadowIntens[_shadowLightNum] = SHADOWAMBIENT;
-
-				if (_vm->floatComp(tz, tx) == 1) { // tz > tx - if it's out of the falloff
-					lint = 0;
-					_shadowIntens[_shadowLightNum] = 0;
-				} else if (_vm->floatComp(tz, ty) == 1) { // tz > ty - if it's between the falloff and the hotspot
-					lint = (int)((float)lint * (tx - tz) / (tx - ty));
-					_shadowIntens[_shadowLightNum] = (int)((float)_shadowIntens[_shadowLightNum] * (tx - tz) / (tx - ty));
-				}
-			}
-		}
-
-		if ((light->_inten & 0x80) && lint) { // if it's shadowed and still on
-
-			// casts shadow vertices
-			for (int a = 0; a < SHADOWVERTSNUM; ++a) {
-				pa0 = actor->_vertex[_shadowVerts[a]]._x;
-				pa1 = actor->_vertex[_shadowVerts[a]]._y;
-				pa2 = actor->_vertex[_shadowVerts[a]]._z;
-
-				_shVertex[vertexNum + _totalShadowVerts + a]._x = pa0 - (pa1 * l0);
-				_shVertex[vertexNum + _totalShadowVerts + a]._z = pa2 - (pa1 * l2);
-				_shVertex[vertexNum + _totalShadowVerts + a]._y = 0;
-			}
-
-			// per default all shadows are equally faint
-			// _shadowIntens[_shadowLightNum] = SHADOWAMBIENT;
-
-			++_shadowLightNum;
-			_totalShadowVerts += SHADOWVERTSNUM;
-		}
-
-		if (lint) { // if still on
-			// adapts the light vector o its intensity
-			t = (float)(lint) / 127.0;
-			l0 = l0 * t;
-			l1 = l1 * t;
-			l2 = l2 * t;
-
-			SVertex *curVertex = actor->_vertex;
-			for (int a = 0; a < vertexNum; ++a) {
-				pa0 = curVertex->_nx;
-				pa1 = curVertex->_ny;
-				pa2 = curVertex->_nz;
-
-				lint = (int)((acos(pa0 * l0 + pa1 * l1 + pa2 * l2) * 360.0) / PI);
-				lint = CLIP(lint, 0, 180);
-
-				_vVertex[a]._angle -= (180 - lint);
-				++curVertex;
-			}
-		}
-
-		++light;
-	}
-
-	// rearranged light values so they can be viewed
-	for (int a = 0; a < vertexNum; ++a)
-		_vVertex[a]._angle = CLIP<int32>(_vVertex[a]._angle, 0, 180);
-
-	// Calculate the distance of the character from the room
-	tx = camera->_ex - actor->_px;
-	ty = camera->_ey;
-	tz = camera->_ez - actor->_pz;
-
-	dist = tx * e30 + ty * e31 + tz * e32;
-
-	SVertex *curVertex = actor->_vertex;
-
-	for (int a = 0; a < vertexNum + _totalShadowVerts; ++a) {
-		if (a < vertexNum) {
-			l0 = curVertex->_x;
-			l1 = curVertex->_z;
-			pa1 = ty - curVertex->_y;
-		} else {
-			l0 = _shVertex[a]._x;
-			l1 = _shVertex[a]._z;
-			pa1 = ty - _shVertex[a]._y;
-		}
-
-		pa0 = tx - (l0 * cost + l1 * sint); // rotate _curVertex
-		pa2 = tz - (-l0 * sint + l1 * cost);
-
-		l0 = pa0 * e10 + pa1 * e11 + pa2 * e12; // project _curVertex
-		l1 = pa0 * e20 + pa1 * e21 + pa2 * e22;
-		l2 = pa0 * e30 + pa1 * e31 + pa2 * e32;
-
-		int x2d = _vm->_cx + (int)((l0 * camera->_fovX) / l2);
-		int y2d = _vm->_cy + (int)((l1 * camera->_fovY) / l2);
-
-		_vVertex[a]._x = x2d;
-		_vVertex[a]._y = y2d;
-		_vVertex[a]._z = (int32)((dist - l2) * 128.0);
-
-		actor->_lim[0] = MIN(x2d, actor->_lim[0]);
-		actor->_lim[1] = MAX(x2d, actor->_lim[1]);
-		actor->_lim[2] = MIN(y2d, actor->_lim[2]);
-		actor->_lim[3] = MAX(y2d, actor->_lim[3]);
-
-		actor->_lim[4] = MIN<int32>(_vVertex[a]._z, actor->_lim[4]);
-		actor->_lim[5] = MAX<int32>(_vVertex[a]._z, actor->_lim[5]);
-
-		++curVertex;
-	}
-	actor->_lim[4] = (int)dist;
-	actor->_lim[5] = (int)dist;
-
-	// vertex clipping
-	if (actor->_lim[0] <= _minXClip + 1) {
-		actor->_lim[0] = _minXClip;
-	} else {
-		--actor->_lim[0];
-	}
-
-	if (actor->_lim[1] >= _maxXClip - 1) {
-		actor->_lim[1] = _maxXClip;
-	} else {
-		++actor->_lim[1];
-	}
-
-	if (actor->_lim[2] <= _minYClip + 1) {
-		actor->_lim[2] = _minYClip;
-	} else {
-		--actor->_lim[2];
-	}
-
-	if (actor->_lim[3] >= _maxYClip - 1) {
-		actor->_lim[3] = _maxYClip;
-	} else {
-		++actor->_lim[3];
-	}
-
-	if (actor->_curAction == hLAST) // exit displacer
-		actor->_lim[2] = actor->_lim[3] - (((actor->_lim[3] - actor->_lim[2]) * actor->_curFrame) / _vm->_defActionLen[hLAST]);
-
-	// set zbuffer vars
-	setZBufferRegion(actor->_lim[0], actor->_lim[2], actor->_lim[1] - actor->_lim[0]);
-}
-
-void Renderer3D::drawCharacterFaces() {
-	Actor *actor = _vm->_actor;
-	STexture *textures = actor->_textures;
-	SFace *face = actor->_face;
-	int vertexNum = actor->_vertexNum;
-
-	if (actor->_curAction == hLAST)
-		setClipping(0, actor->_lim[2], MAXX, actor->_lim[3]);
-
-	for (int b = 0; b < _shadowLightNum; ++b) {
-		for (int a = 0; a < SHADOWFACESNUM; ++a) {
-			int p0 = _shadowFaces[a][0] + vertexNum + b * SHADOWVERTSNUM;
-			int p1 = _shadowFaces[a][1] + vertexNum + b * SHADOWVERTSNUM;
-			int p2 = _shadowFaces[a][2] + vertexNum + b * SHADOWVERTSNUM;
-
-			int px0 = _vVertex[p0]._x;
-			int py0 = _vVertex[p0]._y;
-			int px1 = _vVertex[p1]._x;
-			int py1 = _vVertex[p1]._y;
-			int px2 = _vVertex[p2]._x;
-			int py2 = _vVertex[p2]._y;
-
-			shadowTriangle(px0, py0, px1, py1, px2, py2, 127 - _shadowIntens[b], (int16)(0x7FF0 + b));
-		}
-	}
-
-	for (uint a = 0; a < actor->_faceNum; ++a) {
-		int p0 = face->_a;
-		int p1 = face->_b;
-		int p2 = face->_c;
-
-		int px0 = _vVertex[p0]._x;
-		int py0 = _vVertex[p0]._y;
-		int px1 = _vVertex[p1]._x;
-		int py1 = _vVertex[p1]._y;
-		int px2 = _vVertex[p2]._x;
-		int py2 = _vVertex[p2]._y;
-
-		if (clockWise(px0, py0, px1, py1, px2, py2) > 0) {
-			uint16 b = face->_mat;
-			if (b < MAXMAT && textures[b].isActive()) {
-				textureTriangle(px0, py0, _vVertex[p0]._z, _vVertex[p0]._angle, actor->_textureCoord[a][0][0], actor->_textureCoord[a][0][1],
-								px1, py1, _vVertex[p1]._z, _vVertex[p1]._angle, actor->_textureCoord[a][1][0], actor->_textureCoord[a][1][1],
-								px2, py2, _vVertex[p2]._z, _vVertex[p2]._angle, actor->_textureCoord[a][2][0], actor->_textureCoord[a][2][1],
-								&textures[b]);
-			}
-		}
-
-		++face;
-	}
-
-	int p0 = 0;
-	for (int b = _zBufStartY; b < actor->_lim[3]; ++b) {
-		for (int a = 1; a < _zBufWid; ++a) {
-			int py1 = (_zBuffer[p0] >= 0x7FF0) * 0x8000;
-			int py2 = (_zBuffer[p0 + 1] >= 0x7FF0) * 0x8000;
-
-			int p1 = _zBuffer[p0] < 0x7FFF;
-			int p2 = _zBuffer[p0 + 1] < 0x7FFF;
-
-			if (p1 != p2) {
-				_vm->_graphicsMgr->pixelAliasing(a + _zBufStartX, b);
-
-				// if the first is the character
-				if (p1)
-					_zBuffer[p0] = 0x00BF | py1;
-				else
-					_zBuffer[p0] = 0x003F | py2;
-
-				if (a + 1 < _zBufWid) {
-					++p0;
-					++a;
-
-					// if the second is the character
-					if (p2)
-						_zBuffer[p0] = 0x00BF | py2;
-					else
-						_zBuffer[p0] = 0x003F | py1;
-				}
-			} else {
-				// set value alpha max
-				if (p1)
-					_zBuffer[p0] = 0x00FF | py1;
-				else
-					_zBuffer[p0] = 0x0000 | py1;
-			}
-
-			++p0;
-
-			// if it's the last of the line
-			if (a == _zBufWid - 1) {
-				if (p2)
-					_zBuffer[p0] = 0x00FF | py2;
-				else
-					_zBuffer[p0] = 0x0000 | py2;
-			}
-		}
-		++p0;
-	}
-	if (actor->_curAction == hLAST)
-		setClipping(0, TOP, MAXX, AREA + TOP);
-}
-
-/**
- *	Draw the character
- */
-void Renderer3D::drawCharacter(uint8 flag) {
-	if (!_vm->_flagShowCharacter)
-		return;
-
-	// Compute pointer to frame
-	if (flag & CALCPOINTS)
-		calcCharacterPoints();
-
-	if (flag & DRAWFACES)
-		drawCharacterFaces();
-}
 
-// Path Finding
 PathFinding3D::PathFinding3D(TrecisionEngine *vm) : _vm(vm) {
 	_lookX = 0.0f;
 	_lookZ = 0.0f;
diff --git a/engines/trecision/3d.h b/engines/trecision/pathfinding3d.h
similarity index 65%
rename from engines/trecision/3d.h
rename to engines/trecision/pathfinding3d.h
index e708a8e6fa..778b97d010 100644
--- a/engines/trecision/3d.h
+++ b/engines/trecision/pathfinding3d.h
@@ -20,24 +20,14 @@
  *
  */
 
-#ifndef TRECISION_3D_H
-#define TRECISION_3D_H
+#ifndef TRECISION_PATHFINDING_H
+#define TRECISION_PATHFINDING_H
 
 #include "trecision/struct.h"
 #include "common/serializer.h"
 
 namespace Trecision {
 
-struct SVVertex {
-	int32 _x, _y, _z;
-	int32 _angle;
-
-	void clear() {
-		_x = _y = _z = 0;
-		_angle = 0;
-	}
-};
-
 struct SSortPan {
 	int _num;
 	float _min;
@@ -94,60 +84,8 @@ struct SStep {
 		_curPanel = 0;
 	}
 };
-class TrecisionEngine;
 
-class Renderer3D {
-private:
-	TrecisionEngine *_vm;
-
-	int16 _minXClip;
-	int16 _minYClip;
-	int16 _maxXClip;
-	int16 _maxYClip;
-
-	int16 *_zBuffer;
-
-	int16 _zBufStartX;
-	int16 _zBufStartY;
-	int16 _zBufWid;
-
-	int16 _shadowLightNum;
-	int16 _totalShadowVerts;
-	uint8 _shadowIntens[10];
-
-	SVVertex _vVertex[MAXVERTEX];
-	SVertex _shVertex[MAXVERTEX];
-
-	// data for the triangle routines
-	int16 _lEdge[480];
-	int16 _rEdge[480];
-	uint8 _lColor[480];
-	uint8 _rColor[480];
-	int16 _lZ[480];
-	int16 _rZ[480];
-	uint16 _lTextX[480];
-	uint16 _rTextX[480];
-	uint16 _lTextY[480];
-	uint16 _rTextY[480];
-
-	void setZBufferRegion(int16 sx, int16 sy, int16 dx);
-	int8 clockWise(int16 x1, int16 y1, int16 x2, int16 y2, int16 x3, int16 y3);
-	void textureTriangle(int32 x1, int32 y1, int32 z1, int32 c1, int32 tx1, int32 ty1, int32 x2, int32 y2, int32 z2, int32 c2, int32 tx2, int32 ty2, int32 x3, int32 y3, int32 z3, int32 c3, int32 tx3, int32 ty3, const STexture *t);
-	void textureScanEdge(int32 x1, int32 y1, int32 z1, int32 c1, int32 tx1, int32 ty1, int32 x2, int32 y2, int32 z2, int32 c2, int32 tx2, int32 ty2);
-	void shadowTriangle(int32 x1, int32 y1, int32 x2, int32 y2, int32 x3, int32 y3, uint8 cv, int32 zv);
-	void shadowScanEdge(int32 x1, int32 y1, int32 x2, int32 y2);
-	void calcCharacterPoints();
-	void drawCharacterFaces();
-
-public:
-	Renderer3D(TrecisionEngine *vm);
-	~Renderer3D();
-
-	void init3DRoom();
-	void resetZBuffer(int x1, int y1, int x2, int y2);
-	void setClipping(int16 x1, int16 y1, int16 x2, int16 y2);
-	void drawCharacter(uint8 flag);
-};
+class TrecisionEngine;
 
 class PathFinding3D {
 	TrecisionEngine *_vm;
diff --git a/engines/trecision/renderer3d.cpp b/engines/trecision/renderer3d.cpp
new file mode 100644
index 0000000000..fe9fca3d06
--- /dev/null
+++ b/engines/trecision/renderer3d.cpp
@@ -0,0 +1,828 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "trecision/renderer3d.h"
+#include "trecision/anim.h"
+#include "trecision/text.h"
+#include "trecision/actor.h"
+#include "trecision/graphics.h"
+#include "trecision/trecision.h"
+#include "trecision/video.h"
+
+namespace Trecision {
+#define SHADOWVERTSNUM 42
+
+static const int16 _shadowVerts[SHADOWVERTSNUM] = {
+	6, 15, 23,
+	24, 32, 78,
+	80, 81, 83,
+	86, 90, 99,
+	107, 108, 116,
+	155, 157, 158,
+	160, 164, 168,
+	169, 173, 174,
+	187, 188, 192,
+	193, 213, 215,
+	227, 229, 235,
+	238, 249, 250,
+	252, 253, 299,
+	306, 330, 336
+};
+#define SHADOWFACESNUM 48
+
+const int16 _shadowFaces[SHADOWFACESNUM][3] = {
+	{22, 21, 5}, {7, 5, 22},
+	{7, 19, 5}, {5, 2, 19},
+	{27, 24, 16}, {27, 16, 18},
+	{18, 16, 9}, {18, 13, 9},
+	{13, 9, 2}, {3, 19, 12},
+	{25, 26, 17}, {17, 15, 25},
+	{17, 19, 15}, {15, 12, 19},
+	{20, 23, 8}, {8, 6, 20},
+	{6, 9, 3}, {3, 8, 6},
+	{12, 3, 4}, {4, 11, 12},
+	{35, 4, 11}, {13, 2, 1},
+	{1, 14, 13}, {14, 37, 1},
+	{1, 34, 37}, {31, 36, 37},
+	{37, 30, 31}, {29, 34, 35},
+	{35, 29, 28}, {36, 11, 31},
+	{30, 37, 14}, {29, 1, 34},
+	{28, 4, 35}, {36, 10, 35},
+	{35, 32, 10}, {37, 0, 34},
+	{37, 33, 0}, {0, 33, 39},
+	{39, 40, 0}, {10, 38, 32},
+	{32, 41, 38}, {36, 35, 34},
+	{36, 37, 35}, {11, 36, 35},
+	{38, 40, 41}, {41, 38, 39},
+	{2, 19, 13}, {3, 9, 12}
+};
+
+Renderer3D::Renderer3D(TrecisionEngine *vm) : _vm(vm) {
+	_zBuffer = new int16[ZBUFFERSIZE / 2];
+
+	_minXClip = 0;
+	_minYClip = 0;
+	_maxXClip = 0;
+	_maxYClip = 0;
+	_zBufStartX = 0;
+	_zBufStartY = 0;
+	_zBufWid = 0;
+	_shadowLightNum = 0;
+	_totalShadowVerts = 0;
+
+	// data for the triangle routines
+	for (int i = 0; i < 480; ++i) {
+		_lEdge[i] = 0;
+		_rEdge[i] = 0;
+		_lColor[i] = 0;
+		_rColor[i] = 0;
+		_lZ[i] = 0;
+		_rZ[i] = 0;
+		_lTextX[i] = 0;
+		_rTextX[i] = 0;
+		_lTextY[i] = 0;
+		_rTextY[i] = 0;
+	}
+
+	for (int i = 0; i < 10; ++i)
+		_shadowIntens[i] = 0;
+
+	for (int i = 0; i < MAXVERTEX; ++i) {
+		_vVertex[i].clear();
+		_shVertex[i].clear();
+	}
+}
+
+Renderer3D::~Renderer3D() {
+	delete[] _zBuffer;
+}
+
+void Renderer3D::textureTriangle(int32 x1, int32 y1, int32 z1, int32 c1, int32 tx1, int32 ty1,
+								 int32 x2, int32 y2, int32 z2, int32 c2, int32 tx2, int32 ty2,
+								 int32 x3, int32 y3, int32 z3, int32 c3, int32 tx3, int32 ty3,
+								 const STexture *t) {
+	int32 cl;  // color of left edge of horizontal scanline
+	int32 zl;  // zbuffer of left edge of horizontal scanline
+	int32 olx; // texture x of left edge of horizontal scanline
+	int32 oly; // texture y of left edge of horizontal scanline
+	int16 y;   // looping variable
+
+	if (y1 > _maxYClip)
+		y1 = _maxYClip;
+	if (y1 < _minYClip)
+		y1 = _minYClip;
+
+	int16 yBottom = y1;
+	int16 yTop = y1;
+	const uint8 *texture = t->_texture;
+
+	if (yBottom > y2) {
+		if (y2 < _minYClip)
+			y2 = _minYClip;
+		yBottom = y2;
+	}
+	if (yTop < y2) {
+		if (y2 > _maxYClip)
+			y2 = _maxYClip;
+		yTop = y2;
+	}
+	if (yBottom > y3) {
+		if (y3 < _minYClip)
+			y3 = _minYClip;
+		yBottom = y3;
+	}
+	if (yTop < y3) {
+		if (y3 > _maxYClip)
+			y3 = _maxYClip;
+		yTop = y3;
+	}
+	for (y = yBottom; y < yTop; ++y) {
+		_lEdge[y] = _maxXClip;
+		_rEdge[y] = _minXClip;
+	}
+
+	// scan the edges of the triangle
+	textureScanEdge(x1, y1, z1, c1, tx1, ty1, x2, y2, z2, c2, tx2, ty2);
+	textureScanEdge(x2, y2, z2, c2, tx2, ty2, x3, y3, z3, c3, tx3, ty3);
+	textureScanEdge(x3, y3, z3, c3, tx3, ty3, x1, y1, z1, c1, tx1, ty1);
+
+	// Gouraud fill the horizontal scanlines
+	for (y = yBottom; y < yTop; ++y) {
+		int32 el = _lEdge[y];
+		if (el < _minXClip)
+			el = _minXClip;
+		int32 er = _rEdge[y];
+		if (er > _maxXClip)
+			er = _maxXClip;
+
+		// edge right - edge left
+		int16 dx = er - el;
+
+		if (dx > 0) {
+			// slope dc/_dx
+			int32 mc = ((int16)(_rColor[y] - (cl = _lColor[y])) << 8) / dx;
+			// slope _dz/_dx
+			int32 mz = ((int32)(_rZ[y] - (zl = _lZ[y])) << 16) / dx;
+			// slope dty/_dx
+			int32 mtx = ((int32)(_rTextX[y] - (olx = _lTextX[y])) << 16) / dx;
+			// slope dty/_dx
+			int32 mty = ((int32)(_rTextY[y] - (oly = _lTextY[y])) << 16) / dx;
+			// pointer to zbuffer
+			int16 *z = _zBuffer + (y - _zBufStartY) * _zBufWid + (el - _zBufStartX);
+			uint16 x = el;
+
+			zl <<= 16;
+			cl <<= 8;
+			olx <<= 16;
+			oly <<= 16;
+			// loop through every pixel in horizontal scanline
+			while (dx) {
+				const int32 screenOffset = zl >> 16;
+				if (*z > screenOffset) {
+					const uint16 textureX = (uint16)(cl >> 9);
+					const uint16 textureY = texture[(olx >> 16) + t->_dx * (oly >> 16)];
+					_vm->_graphicsMgr->drawTexturePixel(textureX, textureY, x, y);
+					*z = (int16)screenOffset;
+				}
+				++x;         // increase screen x
+				++z;         // increase zbuffer
+				zl += mz;    // increase the zbuffer by _dz/_dx
+				cl += mc;    // increase the color by dc/_dx
+				olx += mtx;
+				oly += mty;
+				--dx; // pixel to do --
+			}
+		}
+	}
+}
+
+void Renderer3D::textureScanEdge(int32 x1, int32 y1, int32 z1, int32 c1, int32 tx1, int32 ty1, int32 x2, int32 y2, int32 z2, int32 c2, int32 tx2, int32 ty2) {
+	// make sure that edge goes from top to bottom
+	int16 dy = y2 - y1;
+	if (dy < 0) {
+		SWAP(y1, y2);
+		SWAP(x1, x2);
+		SWAP(c1, c2);
+		SWAP(z1, z2);
+		SWAP(tx1, tx2);
+		SWAP(ty1, ty2);
+
+		dy = -dy;
+	}
+
+	if (dy == 0)
+		dy = 1;
+
+	// initialize for stepping
+	int32 mx = ((x2 - x1) << 16) / dy; // dx/dy
+	int32 mz = ((z2 - z1) << 16) / dy; // dz/dy
+	int32 mc = ((c2 - c1) << 8) / dy;  // dc/dy
+	int32 mtx = ((tx2 - tx1) << 16) / dy;
+	int32 mty = ((ty2 - ty1) << 16) / dy;
+
+	x1 <<= 16; // starting x coordinate
+	z1 <<= 16; // starting z coordinate
+	c1 <<= 8;  // starting c color
+
+	tx1 <<= 16;
+	ty1 <<= 16;
+
+	// step through edge and record color values along the way
+	for (int32 count = y1; count < y2; ++count) {
+		int16 x = (uint16)(x1 >> 16);
+		if (x < _lEdge[count]) {
+			_lEdge[count] = x;
+			_lZ[count] = (int16)(z1 >> 16);
+			_lTextX[count] = (uint16)(tx1 >> 16);
+			_lTextY[count] = (uint16)(ty1 >> 16);
+			_lColor[count] = (uint8)(c1 >> 8);
+		}
+		if (x > _rEdge[count]) {
+			_rEdge[count] = x;
+			_rZ[count] = (int16)(z1 >> 16);
+			_rTextX[count] = (uint16)(tx1 >> 16);
+			_rTextY[count] = (uint16)(ty1 >> 16);
+			_rColor[count] = (uint8)(c1 >> 8);
+		}
+
+		x1 += mx; // x = x + dx/dy
+		c1 += mc; // c = c + dc/dy
+		z1 += mz; // z = z + dz/dy
+
+		tx1 += mtx;
+		ty1 += mty;
+	}
+}
+
+void Renderer3D::shadowTriangle(int32 x1, int32 y1, int32 x2, int32 y2,
+								int32 x3, int32 y3, uint8 cv, int32 zv) {
+	if (y1 > _maxYClip)
+		y1 = _maxYClip;
+	if (y1 < _minYClip)
+		y1 = _minYClip;
+
+	int16 yBottom = y1;
+	int16 yTop = y1;
+
+	if (yBottom > y2) {
+		if (y2 < _minYClip)
+			y2 = _minYClip;
+		yBottom = y2;
+	}
+	if (yTop < y2) {
+		if (y2 > _maxYClip)
+			y2 = _maxYClip;
+		yTop = y2;
+	}
+	if (yBottom > y3) {
+		if (y3 < _minYClip)
+			y3 = _minYClip;
+		yBottom = y3;
+	}
+	if (yTop < y3) {
+		if (y3 > _maxYClip)
+			y3 = _maxYClip;
+		yTop = y3;
+	}
+
+	for (int16 y = yBottom; y < yTop; ++y) {
+		_lEdge[y] = _maxXClip;
+		_rEdge[y] = _minXClip;
+	}
+
+	// scan the edges of the triangle
+	shadowScanEdge(x1, y1, x2, y2);
+	shadowScanEdge(x2, y2, x3, y3);
+	shadowScanEdge(x3, y3, x1, y1);
+
+	// gouraud fill the horizontal scanlines
+	for (int16 y = yBottom; y < yTop; ++y) {
+		// coordinate of left edge of horizontal scanline
+		int32 el = _lEdge[y];
+		if (el < _minXClip)
+			el = _minXClip;
+		// coordinate of right edge of horizontal scanline
+		int32 er = _rEdge[y];
+		if (er > _maxXClip)
+			er = _maxXClip;
+
+		// edge right - edge left
+		int16 dx = er - el;
+
+		if (dx > 0) {
+			// screen offset
+			int16 x = el;
+			int16 *zBufferPtr = _zBuffer + (y - _zBufStartY) * _zBufWid + (el - _zBufStartX);
+		
+			// loop through every pixel in horizontal scanline
+			while (dx) {
+				if (*zBufferPtr != zv) {
+					_vm->_graphicsMgr->shadow(x, y, cv);
+					*zBufferPtr = zv;
+				}
+				++x;          // increase screen x
+				++zBufferPtr; // increase zbuffer
+				--dx;         // pixel to do --
+			}
+		}
+	}
+}
+
+void Renderer3D::shadowScanEdge(int32 x1, int32 y1, int32 x2, int32 y2) {
+	// make sure that edge goes from top to bottom
+	int16 dy = y2 - y1;
+	if (dy < 0) {
+		SWAP(y1, y2);
+		SWAP(x1, x2);
+
+		dy = -dy;
+	}
+
+	if (dy == 0)
+		dy = 1;
+
+	// initialize for stepping
+	int32 mx = ((x2 - x1) << 16) / dy; // slope dx/dy
+
+	x1 <<= 16; // starting x coordinate
+
+	// step through edge and record color values along the way
+	for (int32 count = y1; count < y2; ++count) {
+		int16 x = (int16)(x1 >> 16);
+		if (x < _lEdge[count])
+			_lEdge[count] = x;
+
+		if (x > _rEdge[count])
+			_rEdge[count] = x;
+
+		x1 += mx; // x = x + dx/dy
+	}
+}
+
+/**
+ *	Initialize a 3D Room
+ */
+void Renderer3D::init3DRoom() {
+	_vm->_cx = (MAXX - 1) / 2;
+	_vm->_cy = (MAXY - 1) / 2;
+
+	for (int c = 0; c < ZBUFFERSIZE / 2; ++c)
+		_zBuffer[c] = 0x7FFF;
+}
+
+void Renderer3D::resetZBuffer(int x1, int y1, int x2, int y2) {
+	if (x1 > x2 || y1 > y2)
+		return;
+
+	int size = (x2 - x1) * (y2 - y1);
+	if (size * 2 > ZBUFFERSIZE)
+		warning("Warning: _zBuffer size %d!\n", size * 2);
+
+	int16 *d = _zBuffer;
+	for (int i = 0; i < size; ++i)
+		*d++ = 0x7FFF;
+}
+
+/**
+ *	Change the clipping area
+ */
+void Renderer3D::setClipping(int16 x1, int16 y1, int16 x2, int16 y2) {
+	_minXClip = x1;
+	_minYClip = y1;
+	_maxXClip = x2;
+	_maxYClip = y2;
+}
+
+void Renderer3D::setZBufferRegion(int16 sx, int16 sy, int16 dx) {
+	_zBufStartX = sx;
+	_zBufStartY = sy;
+	_zBufWid = dx;
+}
+
+/**
+ *	Determines whether a triangle has clockwise
+ *	or counterclockwise vertices
+ */
+int8 Renderer3D::clockWise(int16 x1, int16 y1, int16 x2, int16 y2, int16 x3, int16 y3) {
+	x2 -= x1;
+	y2 -= y1;
+
+	x3 -= x1;
+	y3 -= y1;
+
+	int32 a1 = ((int32)x2) * y3;
+	int32 a2 = ((int32)y2) * x3;
+
+	if (a1 > a2)
+		return 1; // clockwise
+	if (a1 < a2)
+		return -1; // counterclockwise
+
+	a1 = ((int32)x2) * x3;
+	a2 = ((int32)y2) * y3;
+	if (a1 < 0 || a2 < 0)
+		return -1;
+
+	a1 = ((int32)x2) * x2 + ((int32)y2) * y2;
+	a2 = ((int32)x3) * x3 + ((int32)y3) * y3;
+	if (a1 < a2)
+		return 1;
+
+	return 0;
+}
+
+void Renderer3D::calcCharacterPoints() {
+	Actor *actor = _vm->_actor;
+	SCamera *camera = actor->_camera;
+	SLight *light = actor->_light;
+	int vertexNum = actor->_vertexNum;
+
+	if (actor->_curAction > hLAST)
+		error("Error in drawCharacter() - _curAction > hLAST");
+
+	int cfp = 0;
+	int cur = 0;
+	while (cur < actor->_curAction)
+		cfp += _vm->_defActionLen[cur++];
+
+	if (actor->_curAction == hWALKOUT)
+		cfp = 1;
+
+	cfp += actor->_curFrame;
+
+	if (actor->_curAction == hLAST)
+		cfp = 0;
+
+	actor->_vertex = &actor->_characterArea[cfp * actor->_vertexNum];
+
+	_shadowLightNum = 0;
+	_totalShadowVerts = 0;
+
+	// camera matrix
+	float e10 = camera->_e1[0];
+	float e11 = camera->_e1[1];
+	float e12 = camera->_e1[2];
+
+	float e20 = camera->_e2[0];
+	float e21 = camera->_e2[1];
+	float e22 = camera->_e2[2];
+
+	float e30 = camera->_e3[0];
+	float e31 = camera->_e3[1];
+	float e32 = camera->_e3[2];
+
+	// Light directions
+	float l0 = 0.0f;
+	float l1 = 0.0f;
+	float l2 = 0.0f;
+
+	actor->_lim[0] = 32000;
+	actor->_lim[1] = -32000;
+	actor->_lim[2] = 32000;
+	actor->_lim[3] = -32000;
+	actor->_lim[4] = 32000;
+	actor->_lim[5] = -32000;
+
+	float t = (actor->_theta * PI2) / 360.0;
+	float cost = cos(t);
+	float sint = sin(t);
+
+	// Put all vertices in dark color
+	for (int i = 0; i < MAXVERTEX; ++i)
+		_vVertex[i]._angle = 180;
+
+	float dist;
+	float tx = 0.0f;
+	float ty = 0.0f;
+	float tz = 0.0f;
+	float pa0, pa1, pa2;
+
+	for (uint32 b = 0; b < actor->_lightNum; ++b) {
+		// if off                lint == 0
+		// if it has a shadow    lint & 0x80
+
+		int lint = light->_inten & 0x7F;
+		if (lint) {                                   // if it's not turned off
+			tx = light->_x - actor->_px - actor->_dx; // computes direction vector
+			tz = light->_z - actor->_pz - actor->_dz; // between light and actor
+			ty = light->_y;
+
+			if (light->_position) {                       // if it's attenuated
+				dist = sqrt(tx * tx + ty * ty + tz * tz); // Distance light <--> actor
+
+				// adjust light intensity due to the distance
+				if (_vm->floatComp(dist, light->_outr) == 1) // if it's out of range it's off
+					lint = 0;
+				else if (_vm->floatComp(dist, light->_inr) == 1) // if it's inside the circle it's decreased
+					lint = (int)((float)lint * (light->_outr - dist) / (light->_outr - light->_inr));
+			}
+		}
+
+		if (lint) { // If it's still on
+			// Light rotates around the actor
+			l0 = tx * cost - tz * sint;
+			l2 = tx * sint + tz * cost;
+			l1 = ty;
+			t = sqrt(l0 * l0 + l1 * l1 + l2 * l2);
+			l0 /= t;
+			l1 /= t;
+			l2 /= t;
+
+			// Adjust light intensity according to the spot
+			tx = (float)light->_fallOff;
+			if (light->_fallOff) { // for light spot only
+				ty = (float)light->_hotspot;
+
+				pa0 = light->_dx * cost - light->_dz * sint;
+				pa1 = light->_dy;
+				pa2 = light->_dx * sint + light->_dz * cost;
+
+				t = sqrt(pa0 * pa0 + pa1 * pa1 + pa2 * pa2);
+				pa0 /= t;
+				pa1 /= t;
+				pa2 /= t;
+
+				tz = acos((pa0 * l0) + (pa1 * l1) + (pa2 * l2)) * 360.0 / PI2;
+				tz = CLIP(tz, 0.f, 180.f);
+
+				// tx falloff
+				// ty hotspot
+				// tz current angle
+
+				_shadowIntens[_shadowLightNum] = SHADOWAMBIENT;
+
+				if (_vm->floatComp(tz, tx) == 1) { // tz > tx - if it's out of the falloff
+					lint = 0;
+					_shadowIntens[_shadowLightNum] = 0;
+				} else if (_vm->floatComp(tz, ty) == 1) { // tz > ty - if it's between the falloff and the hotspot
+					lint = (int)((float)lint * (tx - tz) / (tx - ty));
+					_shadowIntens[_shadowLightNum] = (int)((float)_shadowIntens[_shadowLightNum] * (tx - tz) / (tx - ty));
+				}
+			}
+		}
+
+		if ((light->_inten & 0x80) && lint) { // if it's shadowed and still on
+
+			// casts shadow vertices
+			for (int a = 0; a < SHADOWVERTSNUM; ++a) {
+				pa0 = actor->_vertex[_shadowVerts[a]]._x;
+				pa1 = actor->_vertex[_shadowVerts[a]]._y;
+				pa2 = actor->_vertex[_shadowVerts[a]]._z;
+
+				_shVertex[vertexNum + _totalShadowVerts + a]._x = pa0 - (pa1 * l0);
+				_shVertex[vertexNum + _totalShadowVerts + a]._z = pa2 - (pa1 * l2);
+				_shVertex[vertexNum + _totalShadowVerts + a]._y = 0;
+			}
+
+			// per default all shadows are equally faint
+			// _shadowIntens[_shadowLightNum] = SHADOWAMBIENT;
+
+			++_shadowLightNum;
+			_totalShadowVerts += SHADOWVERTSNUM;
+		}
+
+		if (lint) { // if still on
+			// adapts the light vector o its intensity
+			t = (float)(lint) / 127.0;
+			l0 = l0 * t;
+			l1 = l1 * t;
+			l2 = l2 * t;
+
+			SVertex *curVertex = actor->_vertex;
+			for (int a = 0; a < vertexNum; ++a) {
+				pa0 = curVertex->_nx;
+				pa1 = curVertex->_ny;
+				pa2 = curVertex->_nz;
+
+				lint = (int)((acos(pa0 * l0 + pa1 * l1 + pa2 * l2) * 360.0) / PI);
+				lint = CLIP(lint, 0, 180);
+
+				_vVertex[a]._angle -= (180 - lint);
+				++curVertex;
+			}
+		}
+
+		++light;
+	}
+
+	// rearranged light values so they can be viewed
+	for (int a = 0; a < vertexNum; ++a)
+		_vVertex[a]._angle = CLIP<int32>(_vVertex[a]._angle, 0, 180);
+
+	// Calculate the distance of the character from the room
+	tx = camera->_ex - actor->_px;
+	ty = camera->_ey;
+	tz = camera->_ez - actor->_pz;
+
+	dist = tx * e30 + ty * e31 + tz * e32;
+
+	SVertex *curVertex = actor->_vertex;
+
+	for (int a = 0; a < vertexNum + _totalShadowVerts; ++a) {
+		if (a < vertexNum) {
+			l0 = curVertex->_x;
+			l1 = curVertex->_z;
+			pa1 = ty - curVertex->_y;
+		} else {
+			l0 = _shVertex[a]._x;
+			l1 = _shVertex[a]._z;
+			pa1 = ty - _shVertex[a]._y;
+		}
+
+		pa0 = tx - (l0 * cost + l1 * sint); // rotate _curVertex
+		pa2 = tz - (-l0 * sint + l1 * cost);
+
+		l0 = pa0 * e10 + pa1 * e11 + pa2 * e12; // project _curVertex
+		l1 = pa0 * e20 + pa1 * e21 + pa2 * e22;
+		l2 = pa0 * e30 + pa1 * e31 + pa2 * e32;
+
+		int x2d = _vm->_cx + (int)((l0 * camera->_fovX) / l2);
+		int y2d = _vm->_cy + (int)((l1 * camera->_fovY) / l2);
+
+		_vVertex[a]._x = x2d;
+		_vVertex[a]._y = y2d;
+		_vVertex[a]._z = (int32)((dist - l2) * 128.0);
+
+		actor->_lim[0] = MIN(x2d, actor->_lim[0]);
+		actor->_lim[1] = MAX(x2d, actor->_lim[1]);
+		actor->_lim[2] = MIN(y2d, actor->_lim[2]);
+		actor->_lim[3] = MAX(y2d, actor->_lim[3]);
+
+		actor->_lim[4] = MIN<int32>(_vVertex[a]._z, actor->_lim[4]);
+		actor->_lim[5] = MAX<int32>(_vVertex[a]._z, actor->_lim[5]);
+
+		++curVertex;
+	}
+	actor->_lim[4] = (int)dist;
+	actor->_lim[5] = (int)dist;
+
+	// vertex clipping
+	if (actor->_lim[0] <= _minXClip + 1) {
+		actor->_lim[0] = _minXClip;
+	} else {
+		--actor->_lim[0];
+	}
+
+	if (actor->_lim[1] >= _maxXClip - 1) {
+		actor->_lim[1] = _maxXClip;
+	} else {
+		++actor->_lim[1];
+	}
+
+	if (actor->_lim[2] <= _minYClip + 1) {
+		actor->_lim[2] = _minYClip;
+	} else {
+		--actor->_lim[2];
+	}
+
+	if (actor->_lim[3] >= _maxYClip - 1) {
+		actor->_lim[3] = _maxYClip;
+	} else {
+		++actor->_lim[3];
+	}
+
+	if (actor->_curAction == hLAST) // exit displacer
+		actor->_lim[2] = actor->_lim[3] - (((actor->_lim[3] - actor->_lim[2]) * actor->_curFrame) / _vm->_defActionLen[hLAST]);
+
+	// set zbuffer vars
+	setZBufferRegion(actor->_lim[0], actor->_lim[2], actor->_lim[1] - actor->_lim[0]);
+}
+
+void Renderer3D::drawCharacterFaces() {
+	Actor *actor = _vm->_actor;
+	STexture *textures = actor->_textures;
+	SFace *face = actor->_face;
+	int vertexNum = actor->_vertexNum;
+
+	if (actor->_curAction == hLAST)
+		setClipping(0, actor->_lim[2], MAXX, actor->_lim[3]);
+
+	for (int b = 0; b < _shadowLightNum; ++b) {
+		for (int a = 0; a < SHADOWFACESNUM; ++a) {
+			int p0 = _shadowFaces[a][0] + vertexNum + b * SHADOWVERTSNUM;
+			int p1 = _shadowFaces[a][1] + vertexNum + b * SHADOWVERTSNUM;
+			int p2 = _shadowFaces[a][2] + vertexNum + b * SHADOWVERTSNUM;
+
+			int px0 = _vVertex[p0]._x;
+			int py0 = _vVertex[p0]._y;
+			int px1 = _vVertex[p1]._x;
+			int py1 = _vVertex[p1]._y;
+			int px2 = _vVertex[p2]._x;
+			int py2 = _vVertex[p2]._y;
+
+			shadowTriangle(px0, py0, px1, py1, px2, py2, 127 - _shadowIntens[b], (int16)(0x7FF0 + b));
+		}
+	}
+
+	for (uint a = 0; a < actor->_faceNum; ++a) {
+		int p0 = face->_a;
+		int p1 = face->_b;
+		int p2 = face->_c;
+
+		int px0 = _vVertex[p0]._x;
+		int py0 = _vVertex[p0]._y;
+		int px1 = _vVertex[p1]._x;
+		int py1 = _vVertex[p1]._y;
+		int px2 = _vVertex[p2]._x;
+		int py2 = _vVertex[p2]._y;
+
+		if (clockWise(px0, py0, px1, py1, px2, py2) > 0) {
+			uint16 b = face->_mat;
+			if (b < MAXMAT && textures[b].isActive()) {
+				textureTriangle(px0, py0, _vVertex[p0]._z, _vVertex[p0]._angle, actor->_textureCoord[a][0][0], actor->_textureCoord[a][0][1],
+								px1, py1, _vVertex[p1]._z, _vVertex[p1]._angle, actor->_textureCoord[a][1][0], actor->_textureCoord[a][1][1],
+								px2, py2, _vVertex[p2]._z, _vVertex[p2]._angle, actor->_textureCoord[a][2][0], actor->_textureCoord[a][2][1],
+								&textures[b]);
+			}
+		}
+
+		++face;
+	}
+
+	int p0 = 0;
+	for (int b = _zBufStartY; b < actor->_lim[3]; ++b) {
+		for (int a = 1; a < _zBufWid; ++a) {
+			int py1 = (_zBuffer[p0] >= 0x7FF0) * 0x8000;
+			int py2 = (_zBuffer[p0 + 1] >= 0x7FF0) * 0x8000;
+
+			int p1 = _zBuffer[p0] < 0x7FFF;
+			int p2 = _zBuffer[p0 + 1] < 0x7FFF;
+
+			if (p1 != p2) {
+				_vm->_graphicsMgr->pixelAliasing(a + _zBufStartX, b);
+
+				// if the first is the character
+				if (p1)
+					_zBuffer[p0] = 0x00BF | py1;
+				else
+					_zBuffer[p0] = 0x003F | py2;
+
+				if (a + 1 < _zBufWid) {
+					++p0;
+					++a;
+
+					// if the second is the character
+					if (p2)
+						_zBuffer[p0] = 0x00BF | py2;
+					else
+						_zBuffer[p0] = 0x003F | py1;
+				}
+			} else {
+				// set value alpha max
+				if (p1)
+					_zBuffer[p0] = 0x00FF | py1;
+				else
+					_zBuffer[p0] = 0x0000 | py1;
+			}
+
+			++p0;
+
+			// if it's the last of the line
+			if (a == _zBufWid - 1) {
+				if (p2)
+					_zBuffer[p0] = 0x00FF | py2;
+				else
+					_zBuffer[p0] = 0x0000 | py2;
+			}
+		}
+		++p0;
+	}
+	if (actor->_curAction == hLAST)
+		setClipping(0, TOP, MAXX, AREA + TOP);
+}
+
+/**
+ *	Draw the character
+ */
+void Renderer3D::drawCharacter(uint8 flag) {
+	if (!_vm->_flagShowCharacter)
+		return;
+
+	// Compute pointer to frame
+	if (flag & CALCPOINTS)
+		calcCharacterPoints();
+
+	if (flag & DRAWFACES)
+		drawCharacterFaces();
+}
+
+} // End of namespace Trecision
diff --git a/engines/trecision/renderer3d.h b/engines/trecision/renderer3d.h
new file mode 100644
index 0000000000..16b99ca511
--- /dev/null
+++ b/engines/trecision/renderer3d.h
@@ -0,0 +1,96 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef TRECISION_RENDERER3D_H
+#define TRECISION_RENDERER3D_H
+
+#include "trecision/struct.h"
+
+namespace Trecision {
+
+struct SVVertex {
+	int32 _x, _y, _z;
+	int32 _angle;
+
+	void clear() {
+		_x = _y = _z = 0;
+		_angle = 0;
+	}
+};
+
+class TrecisionEngine;
+
+class Renderer3D {
+	TrecisionEngine *_vm;
+
+	int16 _minXClip;
+	int16 _minYClip;
+	int16 _maxXClip;
+	int16 _maxYClip;
+
+	int16 *_zBuffer;
+
+	int16 _zBufStartX;
+	int16 _zBufStartY;
+	int16 _zBufWid;
+
+	int16 _shadowLightNum;
+	int16 _totalShadowVerts;
+	uint8 _shadowIntens[10];
+
+	SVVertex _vVertex[MAXVERTEX];
+	SVertex _shVertex[MAXVERTEX];
+
+	// data for the triangle routines
+	int16 _lEdge[480];
+	int16 _rEdge[480];
+	uint8 _lColor[480];
+	uint8 _rColor[480];
+	int16 _lZ[480];
+	int16 _rZ[480];
+	uint16 _lTextX[480];
+	uint16 _rTextX[480];
+	uint16 _lTextY[480];
+	uint16 _rTextY[480];
+
+	void setZBufferRegion(int16 sx, int16 sy, int16 dx);
+	int8 clockWise(int16 x1, int16 y1, int16 x2, int16 y2, int16 x3, int16 y3);
+	void textureTriangle(int32 x1, int32 y1, int32 z1, int32 c1, int32 tx1, int32 ty1, int32 x2, int32 y2, int32 z2, int32 c2, int32 tx2, int32 ty2, int32 x3, int32 y3, int32 z3, int32 c3, int32 tx3, int32 ty3, const STexture *t);
+	void textureScanEdge(int32 x1, int32 y1, int32 z1, int32 c1, int32 tx1, int32 ty1, int32 x2, int32 y2, int32 z2, int32 c2, int32 tx2, int32 ty2);
+	void shadowTriangle(int32 x1, int32 y1, int32 x2, int32 y2, int32 x3, int32 y3, uint8 cv, int32 zv);
+	void shadowScanEdge(int32 x1, int32 y1, int32 x2, int32 y2);
+	void calcCharacterPoints();
+	void drawCharacterFaces();
+
+public:
+	Renderer3D(TrecisionEngine *vm);
+	~Renderer3D();
+
+	void init3DRoom();
+	void resetZBuffer(int x1, int y1, int x2, int y2);
+	void setClipping(int16 x1, int16 y1, int16 x2, int16 y2);
+	void drawCharacter(uint8 flag);
+};
+
+} // End of namespace Trecision
+#endif
+
diff --git a/engines/trecision/resource.cpp b/engines/trecision/resource.cpp
index cde422e954..dfbff39981 100644
--- a/engines/trecision/resource.cpp
+++ b/engines/trecision/resource.cpp
@@ -29,15 +29,15 @@
 #include "common/substream.h"
 #include "gui/saveload.h"
 
-#include "trecision/trecision.h"
-#include "trecision/anim.h"
 #include "trecision/actor.h"
-#include "trecision/3d.h"
 #include "trecision/defines.h"
 #include "trecision/dialog.h"
 #include "trecision/graphics.h"
-#include "trecision/video.h"
+#include "trecision/pathfinding3d.h"
+#include "trecision/renderer3d.h"
+#include "trecision/trecision.h"
 #include "trecision/sound.h"
+#include "trecision/video.h"
 
 namespace Trecision {
 
diff --git a/engines/trecision/saveload.cpp b/engines/trecision/saveload.cpp
index c875fbca97..a108afd603 100644
--- a/engines/trecision/saveload.cpp
+++ b/engines/trecision/saveload.cpp
@@ -25,12 +25,12 @@
 #include "common/savefile.h"
 #include "common/translation.h"
 
+#include "trecision/actor.h"
 #include "trecision/dialog.h"
+#include "trecision/graphics.h"
 #include "trecision/logic.h"
+#include "trecision/pathfinding3d.h"
 #include "trecision/sound.h"
-#include "trecision/3d.h"
-#include "trecision/actor.h"
-#include "trecision/graphics.h"
 #include "trecision/trecision.h"
 #include "trecision/video.h"
 
diff --git a/engines/trecision/script.cpp b/engines/trecision/script.cpp
index 3c84246fcb..7e016afd6c 100644
--- a/engines/trecision/script.cpp
+++ b/engines/trecision/script.cpp
@@ -23,14 +23,15 @@
 #include "common/scummsys.h"
 #include "graphics/scaler.h"
 
-#include "trecision/anim.h"
-#include "trecision/scheduler.h"
-#include "trecision/3d.h"
 #include "trecision/actor.h"
+#include "trecision/anim.h"
+#include "trecision/defines.h"
 #include "trecision/dialog.h"
-#include "trecision/logic.h"
 #include "trecision/graphics.h"
-#include "trecision/defines.h"
+#include "trecision/logic.h"
+#include "trecision/pathfinding3d.h"
+#include "trecision/renderer3d.h"
+#include "trecision/scheduler.h"
 #include "trecision/trecision.h"
 #include "trecision/text.h"
 #include "trecision/video.h"
diff --git a/engines/trecision/trecision.cpp b/engines/trecision/trecision.cpp
index e75d6da5b0..752ad36e2c 100644
--- a/engines/trecision/trecision.cpp
+++ b/engines/trecision/trecision.cpp
@@ -29,19 +29,20 @@
 #include "common/fs.h"
 #include "common/str.h"
 
-#include "trecision/trecision.h"
 #include "trecision/anim.h"
-#include "trecision/scheduler.h"
 #include "trecision/actor.h"
-#include "trecision/3d.h"
-#include "trecision/defines.h"
 #include "trecision/console.h"
+#include "trecision/defines.h"
 #include "trecision/dialog.h"
 #include "trecision/graphics.h"
-#include "trecision/video.h"
+#include "trecision/pathfinding3d.h"
+#include "trecision/renderer3d.h"
 #include "trecision/logic.h"
-#include "trecision/text.h"
+#include "trecision/scheduler.h"
 #include "trecision/sound.h"
+#include "trecision/trecision.h"
+#include "trecision/text.h"
+#include "trecision/video.h"
 
 namespace Common {
 class File;




More information about the Scummvm-git-logs mailing list