[Scummvm-git-logs] scummvm master -> 91c6a0864a6b505c683d663ebcb0ea4a5c39d8f2

SupSuper supsuper at gmail.com
Fri Jun 4 22:03:37 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:
91c6a0864a TRECISION: Read 3D texture into Graphics::Surface


Commit: 91c6a0864a6b505c683d663ebcb0ea4a5c39d8f2
    https://github.com/scummvm/scummvm/commit/91c6a0864a6b505c683d663ebcb0ea4a5c39d8f2
Author: SupSuper (supsuper at gmail.com)
Date: 2021-06-04T23:02:53+01:00

Commit Message:
TRECISION: Read 3D texture into Graphics::Surface

Changed paths:
    engines/trecision/3d.cpp
    engines/trecision/actor.cpp
    engines/trecision/actor.h


diff --git a/engines/trecision/3d.cpp b/engines/trecision/3d.cpp
index f02b552714..e80a73c2cb 100644
--- a/engines/trecision/3d.cpp
+++ b/engines/trecision/3d.cpp
@@ -201,7 +201,7 @@ void Renderer3D::textureTriangle(int32 x1, int32 y1, int32 z1, int32 c1, int32 t
 			while (dx) {
 				sl = zl >> 16;
 				if (*z > sl) {
-					*screenPtr = (uint16)(_vm->_actor->_textureMat[texture[(olx >> 16) + t->_dx * (oly >> 16)]][cl >> 9]);
+					*screenPtr = (uint16)_vm->_actor->_textureMat.getPixel(cl >> 9, texture[(olx >> 16) + t->_dx * (oly >> 16)]);
 					*z = (int16)sl;
 				}
 				++screenPtr; // increase screen x
diff --git a/engines/trecision/actor.cpp b/engines/trecision/actor.cpp
index c13ef28612..6de09ab7ce 100644
--- a/engines/trecision/actor.cpp
+++ b/engines/trecision/actor.cpp
@@ -54,11 +54,6 @@ Actor::Actor(TrecisionEngine *vm) : _vm(vm) {
 	_curFrame = 0;
 	_curAction = 0;
 
-	for (uint16 i = 0; i < 256; ++i) {
-		for (int j = 0; j < 91; ++j)
-			_textureMat[i][j] = 0;
-	}
-
 	for (uint16 i = 0; i < MAXFACE; ++i) {
 		for (uint8 j = 0; j < 3; ++j) {
 			_textureCoord[i][j][0] = 0;
@@ -85,6 +80,7 @@ Actor::~Actor() {
 	delete[] _characterArea;
 	delete[] _face;
 	delete[] _textureData;
+	_textureMat.free();
 }
 
 void Actor::initTextures() {
@@ -333,12 +329,7 @@ void Actor::readModel(const char *filename) {
 	if (ff == nullptr)
 		error("readModel - Error opening file mat.tex");
 
-	for (uint16 i = 0; i < 256; ++i) {
-		for (uint16 j = 0; j < 91; ++j)
-			_textureMat[i][j] = ff->readUint16();
-	}
-
-	_vm->_graphicsMgr->updatePixelFormat((uint16 *)_textureMat, 91 * 256);
+	_vm->_graphicsMgr->readSurface(ff, &_textureMat, 91, 256);
 
 	for (uint16 i = 0; i < MAXFACE; ++i) {
 		for (uint16 j = 0; j < 3; ++j) {
diff --git a/engines/trecision/actor.h b/engines/trecision/actor.h
index 6b5d2ebfbb..ea3041dbe3 100644
--- a/engines/trecision/actor.h
+++ b/engines/trecision/actor.h
@@ -57,7 +57,7 @@ public:
 	SCamera *_camera;
 	STexture *_textures;
 
-	uint16 _textureMat[256][91];
+	Graphics::Surface _textureMat;
 	int16  _textureCoord[MAXFACE][3][2];
 
 	uint32 _vertexNum;




More information about the Scummvm-git-logs mailing list