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

neuromancer noreply at scummvm.org
Sun Aug 25 20:41:53 UTC 2024


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

Summary:
8d0a6784f7 FREESCAPE: added more UI elements for castle
a9083ab9a1 FREESCAPE: added strength indicators for castle dos (ega)
b27fd58ca7 FREESCAPE: refactor indicator loading for castle dos
d135d1aae0 FREESCAPE: unified some more code for castle dos


Commit: 8d0a6784f7acc13a13dc630536932e7672036b2b
    https://github.com/scummvm/scummvm/commit/8d0a6784f7acc13a13dc630536932e7672036b2b
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-08-25T22:43:20+02:00

Commit Message:
FREESCAPE: added more UI elements for castle

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


diff --git a/engines/freescape/games/castle/castle.cpp b/engines/freescape/games/castle/castle.cpp
index 2aa1839d486..f0ca98b43f0 100644
--- a/engines/freescape/games/castle/castle.cpp
+++ b/engines/freescape/games/castle/castle.cpp
@@ -61,6 +61,8 @@ CastleEngine::CastleEngine(OSystem *syst, const ADGameDescription *gd) : Freesca
 	_optionTexture = nullptr;
 	_keysFrame = nullptr;
 	_spiritsMeterIndicatorFrame = nullptr;
+	_strenghtBackgroundFrame = nullptr;
+	_strenghtBarFrame = nullptr;
 	_menu = nullptr;
 
 	_numberKeys = 0;
@@ -78,6 +80,13 @@ CastleEngine::~CastleEngine() {
 		_option->free();
 		delete _option;
 	}
+
+	for (int i = 0; i < int(_strenghtWeightsFrames.size()); i++) {
+		if (_strenghtWeightsFrames[i]) {
+			_strenghtWeightsFrames[i]->free();
+			delete _strenghtWeightsFrames[i];
+		}
+	}
 }
 
 void CastleEngine::initKeymaps(Common::Keymap *engineKeyMap, Common::Keymap *infoScreenKeyMap, const char *target) {
@@ -629,21 +638,57 @@ void CastleEngine::drawStringInSurface(const Common::String &str, int x, int y,
 }
 
 void CastleEngine::drawEnergyMeter(Graphics::Surface *surface) {
-	uint32 back = 0;
+	/*uint32 back = 0;
 	uint32 black = _gfx->_texturePixelFormat.ARGBToColor(0xFF, 0x00, 0x00, 0x00);
 	Common::Rect weightRect;
 	Common::Rect barRect;
-	Common::Rect backRect;
+	Common::Rect backRect;*/
+	Common::Point origin;
 
 	if (isDOS()) {
-		back = _gfx->_texturePixelFormat.ARGBToColor(0xFF, 0xA7, 0x00, 0x00);
+		/*back = _gfx->_texturePixelFormat.ARGBToColor(0xFF, 0xA7, 0x00, 0x00);
 		barRect = Common::Rect(45, 164, 110, 166);
 		weightRect = Common::Rect(57, 158, 59, 172);
 		backRect = Common::Rect(45, 157, 112, 173);
 		if (_gameStateVars[k8bitVariableShield] > 16)
-			weightRect.translate(3, 0);
+			weightRect.translate(3, 0);*/
+	} if (isSpectrum()) {
+		origin = Common::Point(63, 154);
+		surface->copyRectToSurface((const Graphics::Surface)*_strenghtBackgroundFrame, origin.x, origin.y, Common::Rect(0, 0, _strenghtBackgroundFrame->w, _strenghtBackgroundFrame->h));
+		surface->copyRectToSurface((const Graphics::Surface)*_strenghtBarFrame, origin.x, origin.y + 6, Common::Rect(0, 0, _strenghtBarFrame->w, _strenghtBarFrame->h));
+
+		Common::Point weightPoint;
+		int frameIdx = -1;
+
+		weightPoint = Common::Point(origin.x + 5, origin.y + 1);
+		frameIdx = 3 - _gameStateVars[k8bitVariableShield] % 4;
+		frameIdx++;
+		frameIdx = frameIdx % 4;
+
+		surface->copyRectToSurface((const Graphics::Surface)*_strenghtWeightsFrames[frameIdx], weightPoint.x, weightPoint.y, Common::Rect(0, 0, 3, _strenghtWeightsFrames[frameIdx]->h));
+		weightPoint += Common::Point(3, 0);
+
+		for (int i = 0; i < _gameStateVars[k8bitVariableShield] / 4 - 1; i++) {
+			surface->copyRectToSurface((const Graphics::Surface)*_strenghtWeightsFrames[0], weightPoint.x, weightPoint.y, Common::Rect(0, 0, 3, _strenghtWeightsFrames[0]->h));
+			weightPoint += Common::Point(3, 0);
+		}
+
+		weightPoint = Common::Point(origin.x + 64, origin.y + 1);
+		frameIdx = 3 - _gameStateVars[k8bitVariableShield] % 4;
+		frameIdx++;
+		frameIdx = frameIdx % 4;
+
+		surface->copyRectToSurface((const Graphics::Surface)*_strenghtWeightsFrames[frameIdx], weightPoint.x, weightPoint.y, Common::Rect(0, 0, 3, _strenghtWeightsFrames[frameIdx]->h));
+		weightPoint += Common::Point(-3, 0);
+
+		for (int i = 0; i < _gameStateVars[k8bitVariableShield] / 4 - 1; i++) {
+			surface->copyRectToSurface((const Graphics::Surface)*_strenghtWeightsFrames[0], weightPoint.x, weightPoint.y, Common::Rect(0, 0, 3, _strenghtWeightsFrames[0]->h));
+			weightPoint += Common::Point(-3, 0);
+		}
+		return;
 	}
-	surface->fillRect(backRect, black);
+
+	/*surface->fillRect(backRect, black);
 	surface->fillRect(barRect, back);
 
 	for (int i = 0; i < _gameStateVars[k8bitVariableShield] / 4; i++) {
@@ -656,7 +701,7 @@ void CastleEngine::drawEnergyMeter(Graphics::Surface *surface) {
 		weightRect.translate(0, remainder / 2);
 		weightRect.setHeight(weightRect.height() - remainder);
 		surface->fillRect(weightRect, back);
-	}
+	}*/
 }
 
 void CastleEngine::addGhosts() {
diff --git a/engines/freescape/games/castle/castle.h b/engines/freescape/games/castle/castle.h
index 5818880b9d6..f14162f0c0d 100644
--- a/engines/freescape/games/castle/castle.h
+++ b/engines/freescape/games/castle/castle.h
@@ -66,11 +66,16 @@ 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;
-	Graphics::Surface *loadFramesWithHeader(Common::SeekableReadStream *file, int pos, int numFrames, uint32 back);
-	Graphics::Surface *loadFrames(Common::SeekableReadStream *file, Graphics::Surface *surface, int width, int height, uint32 back);
+	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);
 
 	Graphics::Surface *_keysFrame;
 	Graphics::Surface *_spiritsMeterIndicatorFrame;
+	Graphics::Surface *_strenghtBackgroundFrame;
+	Graphics::Surface *_strenghtBarFrame;
+	Common::Array<Graphics::Surface *> _strenghtWeightsFrames;
+
 	int _numberKeys;
 	bool _useRockTravel;
 	int _spiritsDestroyed;
diff --git a/engines/freescape/games/castle/zx.cpp b/engines/freescape/games/castle/zx.cpp
index 6090feef52c..89ce9f888e2 100644
--- a/engines/freescape/games/castle/zx.cpp
+++ b/engines/freescape/games/castle/zx.cpp
@@ -41,7 +41,7 @@ void CastleEngine::initZX() {
 	_soundIndexAreaChange = 5;
 }
 
-Graphics::Surface *CastleEngine::loadFramesWithHeader(Common::SeekableReadStream *file, int pos, int numFrames, uint32 back) {
+Graphics::Surface *CastleEngine::loadFrameWithHeader(Common::SeekableReadStream *file, int pos, uint32 front, uint32 back) {
 	Graphics::Surface *surface = new Graphics::Surface();
 	file->seek(pos);
 	int16 width = file->readByte();
@@ -50,24 +50,39 @@ Graphics::Surface *CastleEngine::loadFramesWithHeader(Common::SeekableReadStream
 
 	/*byte mask =*/ file->readByte();
 
-	uint8 r, g, b;
-	_gfx->readFromPalette(7, r, g, b);
-	uint32 white = _gfx->_texturePixelFormat.ARGBToColor(0xFF, r, g, b);
+	surface->fillRect(Common::Rect(0, 0, width * 8, height), back);
+	/*int frameSize =*/ file->readUint16LE();
+	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;
+	file->seek(pos);
+	int16 width = file->readByte();
+	int16 height = file->readByte();
+	/*byte mask =*/ file->readByte();
 
-	surface->fillRect(Common::Rect(0, 0, width * 8, height), white);
 	/*int frameSize =*/ file->readUint16LE();
-	return loadFrames(file, surface, width, height, back);
+	Common::Array<Graphics::Surface *> frames;
+	for (int i = 0; i < numFrames; i++) {
+		surface = new Graphics::Surface();
+		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));
+	}
+
+	return frames;
 }
 
 
-Graphics::Surface *CastleEngine::loadFrames(Common::SeekableReadStream *file, Graphics::Surface *surface, int width, int height, uint32 back) {
+Graphics::Surface *CastleEngine::loadFrame(Common::SeekableReadStream *file, Graphics::Surface *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++) {
 			int y = i / width;
 			int x = (i % width) * 8 + (7 - n);
 			if ((color & (1 << n)))
-				surface->setPixel(x, y, back);
+				surface->setPixel(x, y, front);
 		}
 	}
 	return surface;
@@ -118,10 +133,14 @@ void CastleEngine::loadAssetsZXFullGame() {
 	loadColorPalette();
 	_gfx->readFromPalette(2, r, g, b);
 	uint32 red = _gfx->_texturePixelFormat.ARGBToColor(0xFF, r, g, b);
-	_keysFrame = loadFramesWithHeader(&file, 0xdf7, 1, red);
+
+	_gfx->readFromPalette(7, r, g, b);
+	uint32 white = _gfx->_texturePixelFormat.ARGBToColor(0xFF, r, g, b);
+
+	_keysFrame = loadFrameWithHeader(&file, 0xdf7, white, red);
 
 	uint32 green = _gfx->_texturePixelFormat.ARGBToColor(0xFF, 0, 0xff, 0);
-	_spiritsMeterIndicatorFrame = loadFramesWithHeader(&file, _language == Common::ES_ESP ? 0xe5e : 0xe4f, 1, green);
+	_spiritsMeterIndicatorFrame = loadFrameWithHeader(&file, _language == Common::ES_ESP ? 0xe5e : 0xe4f, green, white);
 
 	Graphics::Surface *background = new Graphics::Surface();
 
@@ -134,7 +153,15 @@ void CastleEngine::loadAssetsZXFullGame() {
 	background->fillRect(Common::Rect(0, 0, backgroundWidth * 8, backgroundHeight), 0);
 
 	file.seek(_language == Common::ES_ESP ? 0xfd3 : 0xfc4);
-	_background = loadFrames(&file, background, backgroundWidth, backgroundHeight, front);
+	_background = loadFrame(&file, background, backgroundWidth, backgroundHeight, front);
+
+	_gfx->readFromPalette(6, r, g, b);
+	uint32 yellow = _gfx->_texturePixelFormat.ARGBToColor(0xFF, r, g, b);
+	uint32 black = _gfx->_texturePixelFormat.ARGBToColor(0xFF, 0, 0, 0);
+	_strenghtBackgroundFrame = loadFrameWithHeader(&file, 0xed7, yellow, black);
+	_strenghtBarFrame = loadFrameWithHeader(&file, 0xf63, yellow, black);
+
+	_strenghtWeightsFrames = loadFramesWithHeader(&file, 0xf83, 4, yellow, black);
 
 	for (auto &it : _areaMap) {
 		it._value->addStructure(_areaMap[255]);
@@ -203,7 +230,7 @@ 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);
+	drawEnergyMeter(surface);
 }
 
 } // End of namespace Freescape


Commit: a9083ab9a147ab9def5c44240200974f065832ba
    https://github.com/scummvm/scummvm/commit/a9083ab9a147ab9def5c44240200974f065832ba
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-08-25T22:43:20+02:00

Commit Message:
FREESCAPE: added strength indicators for castle dos (ega)

Changed paths:
  A devtools/create_freescape/castle_strength_background_ega.bmp
  A devtools/create_freescape/castle_strength_bar_ega.bmp
  A devtools/create_freescape/castle_strength_weight_0_ega.bmp
  A devtools/create_freescape/castle_strength_weight_1_ega.bmp
  A devtools/create_freescape/castle_strength_weight_2_ega.bmp
  A devtools/create_freescape/castle_strength_weight_3_ega.bmp
    dists/engine-data/freescape.dat
    engines/freescape/games/castle/castle.cpp
    engines/freescape/games/castle/dos.cpp


diff --git a/devtools/create_freescape/castle_strength_background_ega.bmp b/devtools/create_freescape/castle_strength_background_ega.bmp
new file mode 100644
index 00000000000..13a590d3522
Binary files /dev/null and b/devtools/create_freescape/castle_strength_background_ega.bmp differ
diff --git a/devtools/create_freescape/castle_strength_bar_ega.bmp b/devtools/create_freescape/castle_strength_bar_ega.bmp
new file mode 100644
index 00000000000..96162e7d920
Binary files /dev/null and b/devtools/create_freescape/castle_strength_bar_ega.bmp differ
diff --git a/devtools/create_freescape/castle_strength_weight_0_ega.bmp b/devtools/create_freescape/castle_strength_weight_0_ega.bmp
new file mode 100644
index 00000000000..a81a9833eaa
Binary files /dev/null and b/devtools/create_freescape/castle_strength_weight_0_ega.bmp differ
diff --git a/devtools/create_freescape/castle_strength_weight_1_ega.bmp b/devtools/create_freescape/castle_strength_weight_1_ega.bmp
new file mode 100644
index 00000000000..1502311bf68
Binary files /dev/null and b/devtools/create_freescape/castle_strength_weight_1_ega.bmp differ
diff --git a/devtools/create_freescape/castle_strength_weight_2_ega.bmp b/devtools/create_freescape/castle_strength_weight_2_ega.bmp
new file mode 100644
index 00000000000..527a235c125
Binary files /dev/null and b/devtools/create_freescape/castle_strength_weight_2_ega.bmp differ
diff --git a/devtools/create_freescape/castle_strength_weight_3_ega.bmp b/devtools/create_freescape/castle_strength_weight_3_ega.bmp
new file mode 100644
index 00000000000..527a235c125
Binary files /dev/null and b/devtools/create_freescape/castle_strength_weight_3_ega.bmp differ
diff --git a/dists/engine-data/freescape.dat b/dists/engine-data/freescape.dat
index c97d5ed18e1..5312702e978 100644
Binary files a/dists/engine-data/freescape.dat and b/dists/engine-data/freescape.dat differ
diff --git a/engines/freescape/games/castle/castle.cpp b/engines/freescape/games/castle/castle.cpp
index f0ca98b43f0..dade73b0519 100644
--- a/engines/freescape/games/castle/castle.cpp
+++ b/engines/freescape/games/castle/castle.cpp
@@ -638,70 +638,47 @@ void CastleEngine::drawStringInSurface(const Common::String &str, int x, int y,
 }
 
 void CastleEngine::drawEnergyMeter(Graphics::Surface *surface) {
-	/*uint32 back = 0;
-	uint32 black = _gfx->_texturePixelFormat.ARGBToColor(0xFF, 0x00, 0x00, 0x00);
-	Common::Rect weightRect;
-	Common::Rect barRect;
-	Common::Rect backRect;*/
 	Common::Point origin;
 
-	if (isDOS()) {
-		/*back = _gfx->_texturePixelFormat.ARGBToColor(0xFF, 0xA7, 0x00, 0x00);
-		barRect = Common::Rect(45, 164, 110, 166);
-		weightRect = Common::Rect(57, 158, 59, 172);
-		backRect = Common::Rect(45, 157, 112, 173);
-		if (_gameStateVars[k8bitVariableShield] > 16)
-			weightRect.translate(3, 0);*/
-	} if (isSpectrum()) {
+	if (isDOS())
+		origin = Common::Point(43, 157);
+	if (isSpectrum())
 		origin = Common::Point(63, 154);
-		surface->copyRectToSurface((const Graphics::Surface)*_strenghtBackgroundFrame, origin.x, origin.y, Common::Rect(0, 0, _strenghtBackgroundFrame->w, _strenghtBackgroundFrame->h));
-		surface->copyRectToSurface((const Graphics::Surface)*_strenghtBarFrame, origin.x, origin.y + 6, Common::Rect(0, 0, _strenghtBarFrame->w, _strenghtBarFrame->h));
-
-		Common::Point weightPoint;
-		int frameIdx = -1;
 
-		weightPoint = Common::Point(origin.x + 5, origin.y + 1);
-		frameIdx = 3 - _gameStateVars[k8bitVariableShield] % 4;
-		frameIdx++;
-		frameIdx = frameIdx % 4;
+	if (!_strenghtBackgroundFrame)
+		return;
 
-		surface->copyRectToSurface((const Graphics::Surface)*_strenghtWeightsFrames[frameIdx], weightPoint.x, weightPoint.y, Common::Rect(0, 0, 3, _strenghtWeightsFrames[frameIdx]->h));
-		weightPoint += Common::Point(3, 0);
+	surface->copyRectToSurface((const Graphics::Surface)*_strenghtBackgroundFrame, origin.x, origin.y, Common::Rect(0, 0, _strenghtBackgroundFrame->w, _strenghtBackgroundFrame->h));
+	surface->copyRectToSurface((const Graphics::Surface)*_strenghtBarFrame, origin.x, origin.y + 8, Common::Rect(0, 0, _strenghtBarFrame->w, _strenghtBarFrame->h));
 
-		for (int i = 0; i < _gameStateVars[k8bitVariableShield] / 4 - 1; i++) {
-			surface->copyRectToSurface((const Graphics::Surface)*_strenghtWeightsFrames[0], weightPoint.x, weightPoint.y, Common::Rect(0, 0, 3, _strenghtWeightsFrames[0]->h));
-			weightPoint += Common::Point(3, 0);
-		}
+	Common::Point weightPoint;
+	int frameIdx = -1;
 
-		weightPoint = Common::Point(origin.x + 64, origin.y + 1);
-		frameIdx = 3 - _gameStateVars[k8bitVariableShield] % 4;
-		frameIdx++;
-		frameIdx = frameIdx % 4;
+	weightPoint = Common::Point(origin.x + 5, origin.y);
+	frameIdx = 3 - _gameStateVars[k8bitVariableShield] % 4;
+	frameIdx++;
+	frameIdx = frameIdx % 4;
 
-		surface->copyRectToSurface((const Graphics::Surface)*_strenghtWeightsFrames[frameIdx], weightPoint.x, weightPoint.y, Common::Rect(0, 0, 3, _strenghtWeightsFrames[frameIdx]->h));
-		weightPoint += Common::Point(-3, 0);
+	surface->copyRectToSurface((const Graphics::Surface)*_strenghtWeightsFrames[frameIdx], weightPoint.x, weightPoint.y, Common::Rect(0, 0, 3, _strenghtWeightsFrames[frameIdx]->h));
+	weightPoint += Common::Point(3, 0);
 
-		for (int i = 0; i < _gameStateVars[k8bitVariableShield] / 4 - 1; i++) {
-			surface->copyRectToSurface((const Graphics::Surface)*_strenghtWeightsFrames[0], weightPoint.x, weightPoint.y, Common::Rect(0, 0, 3, _strenghtWeightsFrames[0]->h));
-			weightPoint += Common::Point(-3, 0);
-		}
-		return;
+	for (int i = 0; i < _gameStateVars[k8bitVariableShield] / 4 - 1; i++) {
+		surface->copyRectToSurface((const Graphics::Surface)*_strenghtWeightsFrames[0], weightPoint.x, weightPoint.y, Common::Rect(0, 0, 3, _strenghtWeightsFrames[0]->h));
+		weightPoint += Common::Point(3, 0);
 	}
 
-	/*surface->fillRect(backRect, black);
-	surface->fillRect(barRect, back);
+	weightPoint = Common::Point(origin.x + 62, origin.y);
+	frameIdx = 3 - _gameStateVars[k8bitVariableShield] % 4;
+	frameIdx++;
+	frameIdx = frameIdx % 4;
 
-	for (int i = 0; i < _gameStateVars[k8bitVariableShield] / 4; i++) {
-		surface->fillRect(weightRect, back);
-		weightRect.translate(-3, 0);
-	}
+	surface->copyRectToSurface((const Graphics::Surface)*_strenghtWeightsFrames[frameIdx], weightPoint.x, weightPoint.y, Common::Rect(0, 0, 3, _strenghtWeightsFrames[frameIdx]->h));
+	weightPoint += Common::Point(-3, 0);
 
-	uint8 remainder = 3 - _gameStateVars[k8bitVariableShield] % 4;
-	if (remainder < 3) {
-		weightRect.translate(0, remainder / 2);
-		weightRect.setHeight(weightRect.height() - remainder);
-		surface->fillRect(weightRect, back);
-	}*/
+	for (int i = 0; i < _gameStateVars[k8bitVariableShield] / 4 - 1; i++) {
+		surface->copyRectToSurface((const Graphics::Surface)*_strenghtWeightsFrames[0], weightPoint.x, weightPoint.y, Common::Rect(0, 0, 3, _strenghtWeightsFrames[0]->h));
+		weightPoint += Common::Point(-3, 0);
+	}
 }
 
 void CastleEngine::addGhosts() {
diff --git a/engines/freescape/games/castle/dos.cpp b/engines/freescape/games/castle/dos.cpp
index e0b1aa7366f..7278d8507e8 100644
--- a/engines/freescape/games/castle/dos.cpp
+++ b/engines/freescape/games/castle/dos.cpp
@@ -152,6 +152,24 @@ void CastleEngine::loadAssetsDOSFullGame() {
 		_menu = loadBundledImage("castle_menu");
 		assert(_menu);
 		_menu->convertToInPlace(_gfx->_texturePixelFormat);
+
+		_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);
 	} else
 		error("Not implemented yet");
 


Commit: b27fd58ca7a6456a596de37e162fb0f7fe5b7017
    https://github.com/scummvm/scummvm/commit/b27fd58ca7a6456a596de37e162fb0f7fe5b7017
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-08-25T22:43:20+02:00

Commit Message:
FREESCAPE: refactor indicator loading for castle dos

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


diff --git a/engines/freescape/games/castle/castle.cpp b/engines/freescape/games/castle/castle.cpp
index dade73b0519..30dbd2a5403 100644
--- a/engines/freescape/games/castle/castle.cpp
+++ b/engines/freescape/games/castle/castle.cpp
@@ -425,6 +425,33 @@ void CastleEngine::executePrint(FCLInstruction &instruction) {
 }
 
 
+void CastleEngine::loadAssets() {
+	FreescapeEngine::loadAssets();
+	if (isDOS()) {
+		_menu = loadBundledImage("castle_menu");
+		assert(_menu);
+		_menu->convertToInPlace(_gfx->_texturePixelFormat);
+
+		_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);
+	}
+}
+
 void CastleEngine::loadRiddles(Common::SeekableReadStream *file, int offset, int number) {
 	file->seek(offset);
 	debugC(1, kFreescapeDebugParser, "Riddle table:");
diff --git a/engines/freescape/games/castle/castle.h b/engines/freescape/games/castle/castle.h
index f14162f0c0d..52e874b1452 100644
--- a/engines/freescape/games/castle/castle.h
+++ b/engines/freescape/games/castle/castle.h
@@ -34,6 +34,7 @@ public:
 	void endGame() override;
 
 	void drawInfoMenu() override;
+	void loadAssets() override;
 	void loadAssetsDOSFullGame() override;
 	void loadAssetsDOSDemo() override;
 	void loadAssetsAmigaDemo() override;
diff --git a/engines/freescape/games/castle/dos.cpp b/engines/freescape/games/castle/dos.cpp
index 7278d8507e8..41578517808 100644
--- a/engines/freescape/games/castle/dos.cpp
+++ b/engines/freescape/games/castle/dos.cpp
@@ -148,28 +148,6 @@ void CastleEngine::loadAssetsDOSFullGame() {
 		_areaMap[1]->addFloor();
 		_areaMap[2]->addFloor();
 		delete stream;
-
-		_menu = loadBundledImage("castle_menu");
-		assert(_menu);
-		_menu->convertToInPlace(_gfx->_texturePixelFormat);
-
-		_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);
 	} else
 		error("Not implemented yet");
 
@@ -226,9 +204,6 @@ void CastleEngine::loadAssetsDOSDemo() {
 		_areaMap[1]->addFloor();
 		_areaMap[2]->addFloor();
 		delete stream;
-		_menu = loadBundledImage("castle_menu");
-		assert(_menu);
-		_menu->convertToInPlace(_gfx->_texturePixelFormat);
 	} else
 		error("Not implemented yet");
 }


Commit: d135d1aae0a07293a48675cbe2863deaac48bcc1
    https://github.com/scummvm/scummvm/commit/d135d1aae0a07293a48675cbe2863deaac48bcc1
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-08-25T22:43:20+02:00

Commit Message:
FREESCAPE: unified some more code for castle dos

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


diff --git a/engines/freescape/games/castle/castle.cpp b/engines/freescape/games/castle/castle.cpp
index 30dbd2a5403..44e6fbfd5c9 100644
--- a/engines/freescape/games/castle/castle.cpp
+++ b/engines/freescape/games/castle/castle.cpp
@@ -428,6 +428,12 @@ void CastleEngine::executePrint(FCLInstruction &instruction) {
 void CastleEngine::loadAssets() {
 	FreescapeEngine::loadAssets();
 	if (isDOS()) {
+		for (auto &it : _areaMap)
+			it._value->addStructure(_areaMap[255]);
+
+		_areaMap[1]->addFloor();
+		_areaMap[2]->addFloor();
+
 		_menu = loadBundledImage("castle_menu");
 		assert(_menu);
 		_menu->convertToInPlace(_gfx->_texturePixelFormat);
diff --git a/engines/freescape/games/castle/dos.cpp b/engines/freescape/games/castle/dos.cpp
index 41578517808..46a3a06bf1e 100644
--- a/engines/freescape/games/castle/dos.cpp
+++ b/engines/freescape/games/castle/dos.cpp
@@ -72,7 +72,7 @@ void CastleEngine::loadDOSFonts(Common::SeekableReadStream *file, int pos) {
 		}
 		//debugN("\n");
 	}
-	debug("%" PRIx64, file->pos());
+	//debug("%" PRIx64, file->pos());
 	_fontPlane1.set_size(64 * 59);
 	_fontPlane1.set_bits(bufferPlane1);
 
@@ -142,11 +142,6 @@ void CastleEngine::loadAssetsDOSFullGame() {
 
 		stream = decryptFile("CMEDF");
 		load8bitBinary(stream, 0, 16);
-		for (auto &it : _areaMap)
-			it._value->addStructure(_areaMap[255]);
-
-		_areaMap[1]->addFloor();
-		_areaMap[2]->addFloor();
 		delete stream;
 	} else
 		error("Not implemented yet");
@@ -198,11 +193,6 @@ void CastleEngine::loadAssetsDOSDemo() {
 
 		stream = decryptFile("CDEDF");
 		load8bitBinary(stream, 0, 16);
-		for (auto &it : _areaMap)
-			it._value->addStructure(_areaMap[255]);
-
-		_areaMap[1]->addFloor();
-		_areaMap[2]->addFloor();
 		delete stream;
 	} else
 		error("Not implemented yet");




More information about the Scummvm-git-logs mailing list