[Scummvm-git-logs] scummvm master -> 8d6f6b1054601c25e33e83188db6aff19ee79014

neuromancer noreply at scummvm.org
Thu Sep 19 19:42:58 UTC 2024


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

Summary:
5490e3dbd7 FREESCAPE: load more images from castle for zx
fda44f61a1 FREESCAPE: avoid decrypting the first two bytes in castle for dos
54301898b4 FREESCAPE: fixed background texture size for castle
8ca3c78efe FREESCAPE: clear depth buffer before re-enabling depth testing
783681c0ef FREESCAPE: UI fixes in castle
8d6f6b1054 FREESCAPE: parse more fields in groups


Commit: 5490e3dbd78af3573f46cbcaac5a766741729b23
    https://github.com/scummvm/scummvm/commit/5490e3dbd78af3573f46cbcaac5a766741729b23
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-09-19T21:44:16+02:00

Commit Message:
FREESCAPE: load more images from castle for zx

Changed paths:
    engines/freescape/games/castle/zx.cpp


diff --git a/engines/freescape/games/castle/zx.cpp b/engines/freescape/games/castle/zx.cpp
index c073b899378..7588607d2b0 100644
--- a/engines/freescape/games/castle/zx.cpp
+++ b/engines/freescape/games/castle/zx.cpp
@@ -142,13 +142,12 @@ void CastleEngine::loadAssetsZXFullGame() {
 	uint32 green = _gfx->_texturePixelFormat.ARGBToColor(0xFF, 0, 0xff, 0);
 	_spiritsMeterIndicatorFrame = loadFrameWithHeader(&file, _language == Common::ES_ESP ? 0xe5e : 0xe4f, green, white);
 
-	Graphics::ManagedSurface *background = new Graphics::ManagedSurface();
-
 	_gfx->readFromPalette(4, r, g, b);
 	uint32 front = _gfx->_texturePixelFormat.ARGBToColor(0xFF, r, g, b);
 
 	int backgroundWidth = 16;
 	int backgroundHeight = 18;
+	Graphics::ManagedSurface *background = new Graphics::ManagedSurface();
 	background->create(backgroundWidth * 8, backgroundHeight, _gfx->_texturePixelFormat);
 	background->fillRect(Common::Rect(0, 0, backgroundWidth * 8, backgroundHeight), 0);
 
@@ -163,6 +162,15 @@ void CastleEngine::loadAssetsZXFullGame() {
 
 	_strenghtWeightsFrames = loadFramesWithHeader(&file, _language == Common::ES_ESP ? 0xf92 : 0xf83, 4, yellow, black);
 
+	_flagFrames = loadFramesWithHeader(&file, 0x10e4, 4, green, black);
+
+	int thunderWidth = 4;
+	int thunderHeight = 43;
+	_thunderFrame = new Graphics::ManagedSurface();
+	_thunderFrame->create(thunderWidth * 8, thunderHeight, _gfx->_texturePixelFormat);
+	_thunderFrame->fillRect(Common::Rect(0, 0, thunderWidth * 8, thunderHeight), 0);
+	_thunderFrame = loadFrame(&file, _thunderFrame, thunderWidth, thunderHeight, front);
+
 	for (auto &it : _areaMap) {
 		it._value->addStructure(_areaMap[255]);
 
@@ -231,6 +239,9 @@ void CastleEngine::drawZXUI(Graphics::Surface *surface) {
 	surface->fillRect(Common::Rect(152, 156, 216, 164), green);
 	surface->copyRectToSurface((const Graphics::Surface)*_spiritsMeterIndicatorFrame, 140 + _spiritsMeterPosition, 156, Common::Rect(0, 0, 15, 8));
 	drawEnergyMeter(surface, Common::Point(63, 154));
+
+	int flagFrameIndex = (_ticks / 10) % 4;
+	surface->copyRectToSurface(*_flagFrames[flagFrameIndex], 264, 9, Common::Rect(0, 0, _flagFrames[flagFrameIndex]->w, _flagFrames[flagFrameIndex]->h));
 }
 
 } // End of namespace Freescape


Commit: fda44f61a18d8978dc8b94c70f82d81edfc44471
    https://github.com/scummvm/scummvm/commit/fda44f61a18d8978dc8b94c70f82d81edfc44471
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-09-19T21:44:16+02:00

Commit Message:
FREESCAPE: avoid decrypting the first two bytes in castle for dos

Changed paths:
    engines/freescape/games/castle/dos.cpp
    engines/freescape/loaders/8bitBinaryLoader.cpp


diff --git a/engines/freescape/games/castle/dos.cpp b/engines/freescape/games/castle/dos.cpp
index 3b5a3962fe9..3c41cc85129 100644
--- a/engines/freescape/games/castle/dos.cpp
+++ b/engines/freescape/games/castle/dos.cpp
@@ -41,7 +41,8 @@ Common::SeekableReadStream *CastleEngine::decryptFile(const Common::Path &filena
 
 	int seed = 24;
 	for (int i = 0; i < size; i++) {
-		encryptedBuffer[i] ^= seed;
+		if (i > 1)
+			encryptedBuffer[i] ^= seed;
 		seed = (seed + 1) & 0xff;
 	}
 
diff --git a/engines/freescape/loaders/8bitBinaryLoader.cpp b/engines/freescape/loaders/8bitBinaryLoader.cpp
index cfc00cd6442..fa2dff82e03 100644
--- a/engines/freescape/loaders/8bitBinaryLoader.cpp
+++ b/engines/freescape/loaders/8bitBinaryLoader.cpp
@@ -722,14 +722,6 @@ void FreescapeEngine::load8bitBinary(Common::SeekableReadStream *file, int offse
 	uint8 numberOfAreas = readField(file, 8);
 	debugC(1, kFreescapeDebugParser, "Number of areas: %d", numberOfAreas);
 
-	// Castle Master seems to have invalid number of areas?
-	if (isCastle()) {
-		if (isDOS())
-			numberOfAreas = isDemo() ? 31 : 104;
-		else if (isAmiga())
-			numberOfAreas = isDemo() ? 87 : 104;
-	}
-
 	uint32 dbSize = readPtr(file);
 	debugC(1, kFreescapeDebugParser, "Database ends at %x", dbSize);
 


Commit: 54301898b4c8990145ab129152275147954d4642
    https://github.com/scummvm/scummvm/commit/54301898b4c8990145ab129152275147954d4642
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-09-19T21:44:16+02:00

Commit Message:
FREESCAPE: fixed background texture size for castle

Changed paths:
    engines/freescape/games/castle/dos.cpp
    engines/freescape/gfx_opengl.cpp
    engines/freescape/gfx_opengl.h


diff --git a/engines/freescape/games/castle/dos.cpp b/engines/freescape/games/castle/dos.cpp
index 3c41cc85129..c22adf1d289 100644
--- a/engines/freescape/games/castle/dos.cpp
+++ b/engines/freescape/games/castle/dos.cpp
@@ -176,7 +176,7 @@ void CastleEngine::loadAssetsDOSFullGame() {
 			_endGameBackgroundFrame = loadFrameFromPlanes(stream, 112, 108);
 			_endGameBackgroundFrame->convertToInPlace(_gfx->_texturePixelFormat, (byte *)&kEGADefaultPalette, 16);
 
-			_background = loadFrameFromPlanes(stream, 504, 42);
+			_background = loadFrameFromPlanes(stream, 504, 18);
 			_background->convertToInPlace(_gfx->_texturePixelFormat, (byte *)&kEGADefaultPalette, 16);
 			debug("%lx", stream->pos());
 			// Eye widget is next to 0x1f058
diff --git a/engines/freescape/gfx_opengl.cpp b/engines/freescape/gfx_opengl.cpp
index f426d1ebb91..99d7da077e6 100644
--- a/engines/freescape/gfx_opengl.cpp
+++ b/engines/freescape/gfx_opengl.cpp
@@ -169,11 +169,11 @@ void OpenGLRenderer::drawSkybox(Texture *texture, Math::Vector3d camera) {
 	glBindTexture(GL_TEXTURE_2D, glTexture->_id);
 	glVertexPointer(3, GL_FLOAT, 0, _skyVertices);
 	glNormalPointer(GL_FLOAT, 0, _skyNormals);
-	if (texture->_height == 18) {
-		glTexCoordPointer(2, GL_FLOAT, 0, _skyUvs18);
-	} else if (texture->_height == 42) {
-		glTexCoordPointer(2, GL_FLOAT, 0, _skyUvs42);
-	} else
+	if (texture->_width == 1008)
+		glTexCoordPointer(2, GL_FLOAT, 0, _skyUvs1008);
+	else if (texture->_width == 128)
+		glTexCoordPointer(2, GL_FLOAT, 0, _skyUvs128);
+	else
 		error("Unsupported skybox texture width %d", texture->_width);
 
 	glEnableClientState(GL_VERTEX_ARRAY);
diff --git a/engines/freescape/gfx_opengl.h b/engines/freescape/gfx_opengl.h
index 28770efe0bb..c8f163282e7 100644
--- a/engines/freescape/gfx_opengl.h
+++ b/engines/freescape/gfx_opengl.h
@@ -133,48 +133,48 @@ public:
 		{ 1.0, 0.0, 0.0 }
 	};
 
-	GLfloat _skyUvs18[16][2] = {
+	GLfloat _skyUvs1008[16][2] = {
 		{ 0.0f, 0.0f }, //1
 		{ 0.0f, 2.0f }, //2
-		{ 2.5f, 2.0f }, //3
-		{ 2.5f, 0.0f }, //front //4
+		{ 0.4f, 2.0f }, //3
+		{ 0.4f, 0.0f }, //front //4
 
 		{ 0.0f, 2.0f }, //back //1
-		{ 2.5f, 2.0f }, //2
-		{ 2.5f, 0.0f }, //3
+		{ 0.4f, 2.0f }, //2
+		{ 0.4f, 0.0f }, //3
 		{ 0.0f, 0.0f }, //4
 
 		{ 0.0f, 0.0f }, //left //1
-		{ 2.5f, 0.0f }, //2
-		{ 2.5f, 2.0f }, //3
+		{ 0.4f, 0.0f }, //2
+		{ 0.4f, 2.0f }, //3
 		{ 0.0f, 2.0f }, //4
 
-		{ 2.5f, 0.0f }, //right //1
+		{ 0.4f, 0.0f }, //right //1
 		{ 0.0f, 0.0f }, //2
 		{ 0.0f, 2.0f }, //3
-		{ 2.5f, 2.0f }, //4
+		{ 0.4f, 2.0f }, //4
 	};
 
-	GLfloat _skyUvs42[16][2] = {
+	GLfloat _skyUvs128[16][2] = {
 		{ 0.0f, 0.0f }, //1
-		{ 0.0f, 0.95f }, //2
-		{ 0.4f, 0.95f }, //3
-		{ 0.4f, 0.0f }, //front //4
+		{ 0.0f, 2.0f }, //2
+		{ 2.5f, 2.0f }, //3
+		{ 2.5f, 0.0f }, //front //4
 
-		{ 0.0f, 0.95f }, //back //1
-		{ 0.4f, 0.95f }, //2
-		{ 0.4f, 0.0f }, //3
+		{ 0.0f, 2.0f }, //back //1
+		{ 2.5f, 2.0f }, //2
+		{ 2.5f, 0.0f }, //3
 		{ 0.0f, 0.0f }, //4
 
 		{ 0.0f, 0.0f }, //left //1
-		{ 0.4f, 0.0f }, //2
-		{ 0.4f, 0.95f }, //3
-		{ 0.0f, 0.95f }, //4
+		{ 2.5f, 0.0f }, //2
+		{ 2.5f, 2.0f }, //3
+		{ 0.0f, 2.0f }, //4
 
-		{ 0.4f, 0.0f }, //right //1
+		{ 2.5f, 0.0f }, //right //1
 		{ 0.0f, 0.0f }, //2
-		{ 0.0f, 0.95f }, //3
-		{ 0.4f, 0.95f }, //4
+		{ 0.0f, 2.0f }, //3
+		{ 2.5f, 2.0f }, //4
 	};
 
 	GLfloat _skyVertices[16][3] = {


Commit: 8ca3c78efe1746cddcb90efd70e3c70d7ddb65f5
    https://github.com/scummvm/scummvm/commit/8ca3c78efe1746cddcb90efd70e3c70d7ddb65f5
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-09-19T21:44:16+02:00

Commit Message:
FREESCAPE: clear depth buffer before re-enabling depth testing

Changed paths:
    engines/freescape/gfx_opengl.cpp
    engines/freescape/gfx_opengl_shaders.cpp


diff --git a/engines/freescape/gfx_opengl.cpp b/engines/freescape/gfx_opengl.cpp
index 99d7da077e6..07be58fbb12 100644
--- a/engines/freescape/gfx_opengl.cpp
+++ b/engines/freescape/gfx_opengl.cpp
@@ -480,6 +480,8 @@ void OpenGLRenderer::renderFace(const Common::Array<Math::Vector3d> &vertices) {
 
 void OpenGLRenderer::depthTesting(bool enabled) {
 	if (enabled) {
+		// If we re-enable depth testing, we need to clear the depth buffer
+		glClear(GL_DEPTH_BUFFER_BIT);
 		glEnable(GL_DEPTH_TEST);
 	} else {
 		glDisable(GL_DEPTH_TEST);
diff --git a/engines/freescape/gfx_opengl_shaders.cpp b/engines/freescape/gfx_opengl_shaders.cpp
index 0f5c20f5ef2..6907bc2a28f 100644
--- a/engines/freescape/gfx_opengl_shaders.cpp
+++ b/engines/freescape/gfx_opengl_shaders.cpp
@@ -433,6 +433,8 @@ void OpenGLShaderRenderer::renderFace(const Common::Array<Math::Vector3d> &verti
 
 void OpenGLShaderRenderer::depthTesting(bool enabled) {
 	if (enabled) {
+		// If we re-enable depth testing, we need to clear the depth buffer
+		glClear(GL_DEPTH_BUFFER_BIT);
 		glEnable(GL_DEPTH_TEST);
 	} else {
 		glDisable(GL_DEPTH_TEST);


Commit: 783681c0ef5e6492ba48604a45a9a412a258a937
    https://github.com/scummvm/scummvm/commit/783681c0ef5e6492ba48604a45a9a412a258a937
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-09-19T21:44:16+02:00

Commit Message:
FREESCAPE: UI fixes in castle

Changed paths:
    engines/freescape/games/castle/castle.cpp
    engines/freescape/games/castle/dos.cpp
    engines/freescape/games/castle/zx.cpp


diff --git a/engines/freescape/games/castle/castle.cpp b/engines/freescape/games/castle/castle.cpp
index f29076b07c3..311e5ec3a58 100644
--- a/engines/freescape/games/castle/castle.cpp
+++ b/engines/freescape/games/castle/castle.cpp
@@ -868,12 +868,13 @@ void CastleEngine::drawEnergyMeter(Graphics::Surface *surface, Common::Point ori
 	if (!_strenghtBarFrame)
 		return;
 
-	surface->copyRectToSurface((const Graphics::Surface)*_strenghtBarFrame, origin.x, origin.y + 8, Common::Rect(0, 0, _strenghtBarFrame->w, _strenghtBarFrame->h));
+	uint32 black = _gfx->_texturePixelFormat.ARGBToColor(0xFF, 0x00, 0x00, 0x00);
+	surface->copyRectToSurfaceWithKey((const Graphics::Surface)*_strenghtBarFrame, origin.x + 5, origin.y + 8, Common::Rect(0, 0, _strenghtBarFrame->w, _strenghtBarFrame->h), black);
 
 	Common::Point weightPoint;
 	int frameIdx = -1;
 
-	weightPoint = Common::Point(origin.x + 5, origin.y);
+	weightPoint = Common::Point(origin.x + 10, origin.y);
 	frameIdx = 3 - _gameStateVars[k8bitVariableShield] % 4;
 	frameIdx++;
 	frameIdx = frameIdx % 4;
diff --git a/engines/freescape/games/castle/dos.cpp b/engines/freescape/games/castle/dos.cpp
index c22adf1d289..6f3496fff6f 100644
--- a/engines/freescape/games/castle/dos.cpp
+++ b/engines/freescape/games/castle/dos.cpp
@@ -324,7 +324,7 @@ void CastleEngine::loadAssetsDOSDemo() {
 			_endGameBackgroundFrame = loadFrameFromPlanes(stream, 112, 108);
 			_endGameBackgroundFrame->convertToInPlace(_gfx->_texturePixelFormat, (byte *)&kEGADefaultPalette, 16);
 
-			_background = loadFrameFromPlanes(stream, 504, 42);
+			_background = loadFrameFromPlanes(stream, 504, 18);
 			_background->convertToInPlace(_gfx->_texturePixelFormat, (byte *)&kEGADefaultPalette, 16);
 
 			stream->seek(0x1f4e3 - 0x2a0);
diff --git a/engines/freescape/games/castle/zx.cpp b/engines/freescape/games/castle/zx.cpp
index 7588607d2b0..3eb5402abd8 100644
--- a/engines/freescape/games/castle/zx.cpp
+++ b/engines/freescape/games/castle/zx.cpp
@@ -160,6 +160,13 @@ void CastleEngine::loadAssetsZXFullGame() {
 	_strenghtBackgroundFrame = loadFrameWithHeader(&file, _language == Common::ES_ESP ? 0xee6 : 0xed7, yellow, black);
 	_strenghtBarFrame = loadFrameWithHeader(&file, _language == Common::ES_ESP ? 0xf72 : 0xf63, yellow, black);
 
+	Graphics::ManagedSurface *bar = new Graphics::ManagedSurface();
+	bar->create(_strenghtBarFrame->w - 4, _strenghtBarFrame->h, _gfx->_texturePixelFormat);
+	_strenghtBarFrame->copyRectToSurface(*bar, 4, 0, Common::Rect(4, 0, _strenghtBarFrame->w - 4, _strenghtBarFrame->h));
+	_strenghtBarFrame->free();
+	delete _strenghtBarFrame;
+	_strenghtBarFrame = bar;
+
 	_strenghtWeightsFrames = loadFramesWithHeader(&file, _language == Common::ES_ESP ? 0xf92 : 0xf83, 4, yellow, black);
 
 	_flagFrames = loadFramesWithHeader(&file, 0x10e4, 4, green, black);


Commit: 8d6f6b1054601c25e33e83188db6aff19ee79014
    https://github.com/scummvm/scummvm/commit/8d6f6b1054601c25e33e83188db6aff19ee79014
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-09-19T21:44:16+02:00

Commit Message:
FREESCAPE: parse more fields in groups

Changed paths:
    engines/freescape/loaders/8bitBinaryLoader.cpp
    engines/freescape/objects/group.cpp
    engines/freescape/objects/group.h


diff --git a/engines/freescape/loaders/8bitBinaryLoader.cpp b/engines/freescape/loaders/8bitBinaryLoader.cpp
index fa2dff82e03..780e92b54d6 100644
--- a/engines/freescape/loaders/8bitBinaryLoader.cpp
+++ b/engines/freescape/loaders/8bitBinaryLoader.cpp
@@ -95,7 +95,23 @@ Group *FreescapeEngine::load8bitGroup(Common::SeekableReadStream *file, byte raw
 Group *FreescapeEngine::load8bitGroupV1(Common::SeekableReadStream *file, byte rawFlagsAndType) {
 	debugC(1, kFreescapeDebugParser, "Object of type 'group'");
 	Common::Array<AnimationOpcode *> animation;
-	Common::Array<uint16> groupObjects = readArray(file, 6);
+	Common::Array<uint16> groupObjects = readArray(file, 3);
+	Math::Vector3d offset1;
+	Math::Vector3d offset2;
+
+	for (int i = 0; i < 3; i++) {
+		uint16 value = 0;
+		if (isAmiga() || isAtariST())
+			value = readField(file, 16);
+		else
+			value = readField(file, 8);
+
+		if (value > 127)
+			value = value - 255;
+
+		debugC(1, kFreescapeDebugParser, "Group offset[1][%d] = %d", i, value);
+		offset1.setValue(i, value);
+	}
 
 	// object ID
 	uint16 objectID = readField(file, 8);
@@ -117,11 +133,15 @@ Group *FreescapeEngine::load8bitGroupV1(Common::SeekableReadStream *file, byte r
 		else
 			value = readField(file, 8);
 
-		groupObjects.push_back(value);
+		if (value > 127)
+			value = value - 255;
+
+		debugC(1, kFreescapeDebugParser, "Group offset[2][%d] = %d", i, value);
+		offset2.setValue(i, value);
 	}
 
 	byteSizeOfObject = byteSizeOfObject - 3;
-	for (int i = 0; i < 9; i++)
+	for (int i = 0; i < 3; i++)
 		debugC(1, kFreescapeDebugParser, "Group object[%d] = %d", i, groupObjects[i]);
 
 	Common::Array<uint16> groupOperations;
@@ -172,6 +192,8 @@ Group *FreescapeEngine::load8bitGroupV1(Common::SeekableReadStream *file, byte r
 		objectID,
 		rawFlagsAndType,
 		groupObjects,
+		offset1,
+		offset2,
 		animation);
 }
 
@@ -179,7 +201,23 @@ Group *FreescapeEngine::load8bitGroupV1(Common::SeekableReadStream *file, byte r
 Group *FreescapeEngine::load8bitGroupV2(Common::SeekableReadStream *file, byte rawFlagsAndType) {
 	debugC(1, kFreescapeDebugParser, "Object of type 'group'");
 	Common::Array<AnimationOpcode *> animation;
-	Common::Array<uint16> groupObjects = readArray(file, 6);
+	Common::Array<uint16> groupObjects = readArray(file, 3);
+	Math::Vector3d offset1;
+	Math::Vector3d offset2;
+
+	for (int i = 0; i < 3; i++) {
+		int16 value = 0;
+		if (isAmiga() || isAtariST())
+			value = readField(file, 16);
+		else
+			value = readField(file, 8);
+
+		if (value > 127)
+			value = value - 255;
+
+		debugC(1, kFreescapeDebugParser, "Group offset[1][%d] = %d", i, value);
+		offset1.setValue(i, value);
+	}
 
 	// object ID
 	uint16 objectID = readField(file, 8);
@@ -196,16 +234,21 @@ Group *FreescapeEngine::load8bitGroupV2(Common::SeekableReadStream *file, byte r
 	byteSizeOfObject = byteSizeOfObject - 9;
 
 	for (int i = 0; i < 3; i++) {
-		uint16 value = 0;
+		int16 value = 0;
 		if (isAmiga() || isAtariST())
 			value = readField(file, 16);
 		else
 			value = readField(file, 8);
-		groupObjects.push_back(value);
+
+		if (value > 127)
+			value = value - 255;
+
+		debugC(1, kFreescapeDebugParser, "Group offset[2][%d] = %d", i, value);
+		offset2.setValue(i, value);
 	}
 
 	byteSizeOfObject = byteSizeOfObject - 3;
-	for (int i = 0; i < 9; i++)
+	for (int i = 0; i < 3; i++)
 		debugC(1, kFreescapeDebugParser, "Group object[%d] = %d", i, groupObjects[i]);
 
 	Common::Array<uint16> groupOperations;
@@ -254,6 +297,8 @@ Group *FreescapeEngine::load8bitGroupV2(Common::SeekableReadStream *file, byte r
 		objectID,
 		rawFlagsAndType,
 		groupObjects,
+		offset1,
+		offset2,
 		animation);
 }
 
diff --git a/engines/freescape/objects/group.cpp b/engines/freescape/objects/group.cpp
index b73567afa85..f7d720f7e08 100644
--- a/engines/freescape/objects/group.cpp
+++ b/engines/freescape/objects/group.cpp
@@ -27,14 +27,18 @@ namespace Freescape {
 
 Group::Group(uint16 objectID_, uint16 flags_,
 const Common::Array<uint16> objectIds_,
+const Math::Vector3d offset1_,
+const Math::Vector3d offset2_,
 const Common::Array<AnimationOpcode *> operations_) {
 	_objectID = objectID_;
 	_flags = flags_;
 	_scale = 0;
 	_active = true;
 	_step = 0;
+	_offset1 = offset1_;
+	_offset2 = offset2_;
 
-	for (int i = 0; i < int(objectIds_.size()); i++) {
+	for (int i = 0; i < 3; i++) { // three is the maximum number of objects in a group
 		if (objectIds_[i] == 0 || objectIds_[i] == 0xffff)
 			break;
 		_objectIds.push_back(objectIds_[i]);
@@ -59,6 +63,8 @@ Object *Group::duplicate() {
 		_objectID,
 		_flags,
 		_objectIds,
+		_offset1,
+		_offset2,
 		_operations
 		);
 }
@@ -88,6 +94,16 @@ void Group::assemble(int index) {
 	//gobj->makeVisible();
 	Math::Vector3d position = _operations[_step]->position;
 	Math::Vector3d offset = _origins[index] - _origins[0];
+	/*if (index == 0)
+		; // offset is always zero
+	else if (index == 1)
+		offset = _offset1;
+	else if (index == 2)
+		offset = _offset2;
+	else
+		error("Invalid index: %d", index);
+
+	offset = 32 * offset / _scale;*/
 	position = 32 * position / _scale;
 
 	debugC(1, kFreescapeDebugCode, "Group %d: Assembling object %d originally at %f, %f, %f", _objectID, gobj->getObjectID(), gobj->getOrigin().x(), gobj->getOrigin().y(), gobj->getOrigin().z());
diff --git a/engines/freescape/objects/group.h b/engines/freescape/objects/group.h
index 3e652f62612..8d6a7b5fe14 100644
--- a/engines/freescape/objects/group.h
+++ b/engines/freescape/objects/group.h
@@ -41,6 +41,8 @@ class Group : public Object {
 public:
 	Group(uint16 objectID_, uint16 flags_,
 		const Common::Array<uint16> objectIds_,
+		const Math::Vector3d offset1_,
+		const Math::Vector3d offset2_,
 		const Common::Array<AnimationOpcode *> operations);
 	~Group();
 	void linkObject(Object *obj);
@@ -52,6 +54,8 @@ public:
 
 	Common::Array<Object *> _objects;
 	Common::Array<Math::Vector3d> _origins;
+	Math::Vector3d _offset1;
+	Math::Vector3d _offset2;
 	Common::Array<AnimationOpcode *> _operations;
 	Common::Array<uint16> _objectIds;
 	int _scale;




More information about the Scummvm-git-logs mailing list