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

neuromancer noreply at scummvm.org
Tue Sep 3 06:44:16 UTC 2024


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

Summary:
3a265882a9 FREESCAPE: use managed surfaces for the rest of the castle images in different releases
d093ce816e FREESCAPE: add a few unimplemented group opcodes to castle


Commit: 3a265882a9181311f9b513ce25b65f5a21862cfc
    https://github.com/scummvm/scummvm/commit/3a265882a9181311f9b513ce25b65f5a21862cfc
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-09-03T08:45:15+02:00

Commit Message:
FREESCAPE: use managed surfaces for the rest of the castle images in different releases

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


diff --git a/engines/freescape/freescape.cpp b/engines/freescape/freescape.cpp
index af7cd79b6fd..bd263c9f51b 100644
--- a/engines/freescape/freescape.cpp
+++ b/engines/freescape/freescape.cpp
@@ -403,7 +403,7 @@ void FreescapeEngine::drawBackground() {
 
 	if (isCastle() && _background) {
 		if (!_skyTexture)
-			_skyTexture = _gfx->createTexture(_background);
+			_skyTexture = _gfx->createTexture(_background->surfacePtr());
 		_gfx->drawSkybox(_skyTexture, _position);
 	}
 }
diff --git a/engines/freescape/freescape.h b/engines/freescape/freescape.h
index ca0a6096496..d9e3202ff04 100644
--- a/engines/freescape/freescape.h
+++ b/engines/freescape/freescape.h
@@ -195,7 +195,7 @@ public:
 	virtual void drawCrossair(Graphics::Surface *surface);
 	Graphics::ManagedSurface *_border;
 	Graphics::ManagedSurface *_title;
-	Graphics::Surface *_background;
+	Graphics::ManagedSurface *_background;
 
 	Texture *_borderTexture;
 	Texture *_titleTexture;
diff --git a/engines/freescape/games/castle/castle.cpp b/engines/freescape/games/castle/castle.cpp
index ee0401748be..03778b46c50 100644
--- a/engines/freescape/games/castle/castle.cpp
+++ b/engines/freescape/games/castle/castle.cpp
@@ -446,24 +446,6 @@ void CastleEngine::loadAssets() {
 
 		_areaMap[1]->addFloor();
 		_areaMap[2]->addFloor();
-
-		_strenghtBackgroundFrame = loadBundledImage("castle_strength_background");
-		_strenghtBackgroundFrame->convertToInPlace(_gfx->_texturePixelFormat);
-
-		_strenghtBarFrame = loadBundledImage("castle_strength_bar");
-		_strenghtBarFrame->convertToInPlace(_gfx->_texturePixelFormat);
-
-		_strenghtWeightsFrames.push_back(loadBundledImage("castle_strength_weight_0"));
-		_strenghtWeightsFrames[0]->convertToInPlace(_gfx->_texturePixelFormat);
-
-		_strenghtWeightsFrames.push_back(loadBundledImage("castle_strength_weight_1"));
-		_strenghtWeightsFrames[1]->convertToInPlace(_gfx->_texturePixelFormat);
-
-		_strenghtWeightsFrames.push_back(loadBundledImage("castle_strength_weight_2"));
-		_strenghtWeightsFrames[2]->convertToInPlace(_gfx->_texturePixelFormat);
-
-		_strenghtWeightsFrames.push_back(loadBundledImage("castle_strength_weight_3"));
-		_strenghtWeightsFrames[3]->convertToInPlace(_gfx->_texturePixelFormat);
 	}
 }
 
diff --git a/engines/freescape/games/castle/castle.h b/engines/freescape/games/castle/castle.h
index c839f6cf744..741cb8a3b3b 100644
--- a/engines/freescape/games/castle/castle.h
+++ b/engines/freescape/games/castle/castle.h
@@ -75,19 +75,19 @@ public:
 
 	void drawStringInSurface(const Common::String &str, int x, int y, uint32 fontColor, uint32 backColor, Graphics::Surface *surface, int offset = 0) override;
 	//void drawStringInSurface(const Common::String &str, int x, int y, uint32 primaryFontColor, uint32 secondaryFontColor, uint32 backColor, Graphics::Surface *surface, int offset = 0) override;
-	Common::Array<Graphics::Surface *> loadFramesWithHeader(Common::SeekableReadStream *file, int pos, int numFrames, uint32 front, uint32 back);
-	Graphics::Surface *loadFrameWithHeader(Common::SeekableReadStream *file, int pos, uint32 front, uint32 back);
-	Graphics::Surface *loadFrame(Common::SeekableReadStream *file, Graphics::Surface *surface, int width, int height, uint32 back);
+	Common::Array<Graphics::ManagedSurface *> loadFramesWithHeader(Common::SeekableReadStream *file, int pos, int numFrames, uint32 front, uint32 back);
+	Graphics::ManagedSurface *loadFrameWithHeader(Common::SeekableReadStream *file, int pos, uint32 front, uint32 back);
+	Graphics::ManagedSurface *loadFrame(Common::SeekableReadStream *file, Graphics::ManagedSurface *surface, int width, int height, uint32 back);
 	Graphics::ManagedSurface *loadFrameFromPlanes(Common::SeekableReadStream *file, int widthInBytes, int height);
 	Graphics::ManagedSurface *loadFrameFromPlanesInternal(Common::SeekableReadStream *file, Graphics::ManagedSurface *surface, int width, int height);
 
-	Graphics::Surface *_keysFrame;
-	Graphics::Surface *_spiritsMeterIndicatorFrame;
-	Graphics::Surface *_strenghtBackgroundFrame;
-	Graphics::Surface *_strenghtBarFrame;
-	Common::Array<Graphics::Surface *> _strenghtWeightsFrames;
+	Graphics::ManagedSurface *_keysFrame;
+	Graphics::ManagedSurface *_spiritsMeterIndicatorFrame;
+	Graphics::ManagedSurface *_strenghtBackgroundFrame;
+	Graphics::ManagedSurface *_strenghtBarFrame;
+	Common::Array<Graphics::ManagedSurface *> _strenghtWeightsFrames;
 	Graphics::ManagedSurface *_flagFrames[4];
-	Graphics::Surface *_thunderFrame;
+	Graphics::ManagedSurface *_thunderFrame;
 
 	int _numberKeys;
 	bool _useRockTravel;
diff --git a/engines/freescape/games/castle/dos.cpp b/engines/freescape/games/castle/dos.cpp
index bf407010223..22c45b840fa 100644
--- a/engines/freescape/games/castle/dos.cpp
+++ b/engines/freescape/games/castle/dos.cpp
@@ -132,9 +132,9 @@ void CastleEngine::loadAssetsDOSFullGame() {
 			loadSpeakerFxDOS(stream, 0x636d + 0x200, 0x63ed + 0x200);
 			loadDOSFonts(stream, 0x29696);
 
-			//stream->seek(0x1c700);
-			//_background = loadFrameFromPlanes(stream, 252, 42);
-			//_background->convertToInPlace(_gfx->_texturePixelFormat, (byte *)&kEGADefaultPalette, 16);
+			stream->seek(0x1c700);
+			_background = loadFrameFromPlanes(stream, 252, 42);
+			_background->convertToInPlace(_gfx->_texturePixelFormat, (byte *)&kEGADefaultPalette, 16);
 
 			stream->seek(0x221ae);
 			_menu = loadFrameFromPlanes(stream, 112, 114);
diff --git a/engines/freescape/games/castle/zx.cpp b/engines/freescape/games/castle/zx.cpp
index 89ce9f888e2..7d42c37bc75 100644
--- a/engines/freescape/games/castle/zx.cpp
+++ b/engines/freescape/games/castle/zx.cpp
@@ -41,8 +41,8 @@ void CastleEngine::initZX() {
 	_soundIndexAreaChange = 5;
 }
 
-Graphics::Surface *CastleEngine::loadFrameWithHeader(Common::SeekableReadStream *file, int pos, uint32 front, uint32 back) {
-	Graphics::Surface *surface = new Graphics::Surface();
+Graphics::ManagedSurface *CastleEngine::loadFrameWithHeader(Common::SeekableReadStream *file, int pos, uint32 front, uint32 back) {
+	Graphics::ManagedSurface *surface = new Graphics::ManagedSurface();
 	file->seek(pos);
 	int16 width = file->readByte();
 	int16 height = file->readByte();
@@ -55,17 +55,17 @@ Graphics::Surface *CastleEngine::loadFrameWithHeader(Common::SeekableReadStream
 	return loadFrame(file, surface, width, height, front);
 }
 
-Common::Array<Graphics::Surface *> CastleEngine::loadFramesWithHeader(Common::SeekableReadStream *file, int pos, int numFrames, uint32 front, uint32 back) {
-	Graphics::Surface *surface = nullptr;
+Common::Array<Graphics::ManagedSurface *> CastleEngine::loadFramesWithHeader(Common::SeekableReadStream *file, int pos, int numFrames, uint32 front, uint32 back) {
+	Graphics::ManagedSurface *surface = nullptr;
 	file->seek(pos);
 	int16 width = file->readByte();
 	int16 height = file->readByte();
 	/*byte mask =*/ file->readByte();
 
 	/*int frameSize =*/ file->readUint16LE();
-	Common::Array<Graphics::Surface *> frames;
+	Common::Array<Graphics::ManagedSurface *> frames;
 	for (int i = 0; i < numFrames; i++) {
-		surface = new Graphics::Surface();
+		surface = new Graphics::ManagedSurface();
 		surface->create(width * 8, height, _gfx->_texturePixelFormat);
 		surface->fillRect(Common::Rect(0, 0, width * 8, height), back);
 		frames.push_back(loadFrame(file, surface, width, height, front));
@@ -75,7 +75,7 @@ Common::Array<Graphics::Surface *> CastleEngine::loadFramesWithHeader(Common::Se
 }
 
 
-Graphics::Surface *CastleEngine::loadFrame(Common::SeekableReadStream *file, Graphics::Surface *surface, int width, int height, uint32 front) {
+Graphics::ManagedSurface *CastleEngine::loadFrame(Common::SeekableReadStream *file, Graphics::ManagedSurface *surface, int width, int height, uint32 front) {
 	for (int i = 0; i < width * height; i++) {
 		byte color = file->readByte();
 		for (int n = 0; n < 8; n++) {
@@ -142,7 +142,7 @@ void CastleEngine::loadAssetsZXFullGame() {
 	uint32 green = _gfx->_texturePixelFormat.ARGBToColor(0xFF, 0, 0xff, 0);
 	_spiritsMeterIndicatorFrame = loadFrameWithHeader(&file, _language == Common::ES_ESP ? 0xe5e : 0xe4f, green, white);
 
-	Graphics::Surface *background = new Graphics::Surface();
+	Graphics::ManagedSurface *background = new Graphics::ManagedSurface();
 
 	_gfx->readFromPalette(4, r, g, b);
 	uint32 front = _gfx->_texturePixelFormat.ARGBToColor(0xFF, r, g, b);


Commit: d093ce816eccd13c23bd139383a30cba7b5419f3
    https://github.com/scummvm/scummvm/commit/d093ce816eccd13c23bd139383a30cba7b5419f3
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-09-03T08:45:15+02:00

Commit Message:
FREESCAPE: add a few unimplemented group opcodes to castle

Changed paths:
    engines/freescape/objects/group.cpp


diff --git a/engines/freescape/objects/group.cpp b/engines/freescape/objects/group.cpp
index 8569d312a1c..d6d8e08cb2a 100644
--- a/engines/freescape/objects/group.cpp
+++ b/engines/freescape/objects/group.cpp
@@ -110,19 +110,26 @@ void Group::run() {
 		debugC(1, kFreescapeDebugCode, "Executing group condition %s", _operations[_step]->conditionSource.c_str());
 		g_freescape->executeCode(_operations[_step]->condition, false, true, false, false);
 	} else if (opcode == 0x04) {
-		debugC(1, kFreescapeDebugCode, "Ignoring unknown opcode");
+		debugC(1, kFreescapeDebugCode, "Ignoring unknown opcode 0x04");
 	} else if (opcode == 0x10) {
 		uint32 groupSize = _objects.size();
 		for (uint32 i = 0; i < groupSize ; i++)
 			assemble(i);
 		_active = false;
 		_step++;
+	} else if (opcode == 0x48) {
+		// TODO: not sure the difference with 0x6e
+		uint32 groupSize = _objects.size();
+		for (uint32 i = 0; i < groupSize ; i++)
+			_objects[i]->makeInvisible();
 	} else if (opcode == 0x6e) {
 		uint32 groupSize = _objects.size();
 		for (uint32 i = 0; i < groupSize ; i++)
 			_objects[i]->makeInvisible();
+	} else if (opcode == 0x6c) {
+		debugC(1, kFreescapeDebugCode, "Ignoring unknown opcode 0x6c");
 	} else if (opcode == 0x68) {
-		debugC(1, kFreescapeDebugCode, "Ignoring unknown opcode");
+		debugC(1, kFreescapeDebugCode, "Ignoring unknown opcode 0x68");
 	} else if (opcode == 0x0) {
 		debugC(1, kFreescapeDebugCode, "Executing group assemble");
 		uint32 groupSize = _objects.size();




More information about the Scummvm-git-logs mailing list