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

sev- noreply at scummvm.org
Mon Sep 2 22:50:33 UTC 2024


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:
a733f6b107 QDENGINE: Proper computation of ScaleArray


Commit: a733f6b1073e31f16abf84f515eb6445b6066578
    https://github.com/scummvm/scummvm/commit/a733f6b1073e31f16abf84f515eb6445b6066578
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2024-09-03T00:50:18+02:00

Commit Message:
QDENGINE: Proper computation of ScaleArray

Changed paths:
    engines/qdengine/system/graphics/gr_tile_animation.cpp
    engines/qdengine/system/graphics/gr_tile_animation.h


diff --git a/engines/qdengine/system/graphics/gr_tile_animation.cpp b/engines/qdengine/system/graphics/gr_tile_animation.cpp
index 5ae6716b392..e76358ad45f 100644
--- a/engines/qdengine/system/graphics/gr_tile_animation.cpp
+++ b/engines/qdengine/system/graphics/gr_tile_animation.cpp
@@ -211,8 +211,21 @@ bool grTileAnimation::load(Common::SeekableReadStream *fh, int version) {
 		debugCN(3, kDebugLoad, "   ");
 
 		for (uint i = 0; i < size; i++) {
-			_scaleArray[i] = fh->readFloatLE();
-			debugCN(3, kDebugLoad, " %f ", _scaleArray[i]);
+			float scale = fh->readFloatLE();
+
+			_scaleArray[i]._scale = scale;
+			_scaleArray[i]._frameSize.x = (int)((float)_frameSize.x * scale);
+			_scaleArray[i]._frameSize.y = (int)((float)_frameSize.y * scale);
+			_scaleArray[i]._pitch.x = (_scaleArray[i]._frameSize.x + 15) / 16;
+			_scaleArray[i]._pitch.y = (_scaleArray[i]._frameSize.y + 15) / 16;
+
+			if (i == 0)
+				_scaleArray[i]._numTiles = _frameTileSize.x * _frameTileSize.y * _frameCount;
+			else
+				_scaleArray[i]._numTiles = _scaleArray[i - 1]._numTiles
+	                 + _frameCount * _scaleArray[i - 1]._pitch.y * _scaleArray[i - 1]._pitch.x;
+
+			debugCN(3, kDebugLoad, " %f ", _scaleArray[i]._scale);
 		}
 		debugCN(3, kDebugLoad, "\n");
 	}
diff --git a/engines/qdengine/system/graphics/gr_tile_animation.h b/engines/qdengine/system/graphics/gr_tile_animation.h
index 6754402eec1..8f8f8aa45ca 100644
--- a/engines/qdengine/system/graphics/gr_tile_animation.h
+++ b/engines/qdengine/system/graphics/gr_tile_animation.h
@@ -95,7 +95,15 @@ private:
 	int _frameCount;
 
 	typedef Std::vector<uint32> FrameIndex;
-	Std::vector<float> _scaleArray;
+
+	struct ScaleArray {
+		float _scale;
+		Vect2i _frameSize;
+		Vect2i _pitch;
+		int _numTiles;
+	};
+
+	Std::vector<ScaleArray> _scaleArray;
 
 	/// индекс кадров - номера тайлов, из которых состоят кадры
 	/// _frameTileSize.x * _frameTileSize.y на кадр




More information about the Scummvm-git-logs mailing list