[Scummvm-git-logs] scummvm master -> 99c1cce8268d4baa30c0f65d07f850082d447090

neuromancer noreply at scummvm.org
Fri Jul 19 14:08:11 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:
5604db15ff FREESCAPE: fixed and improved background support for castle
17fb2fc91f FREESCAPE: initial implementation of info menu for castle in dos
747fa1c9e2 FREESCAPE: fixes for ghost handling in castle for zx
866340005d FREESCAPE: workaround for adding missing objects in castle
34252f8c53 FREESCAPE: more fixes and improvements for castle for zx
99c1cce826 FREESCAPE: change color for fullscreen messagges in castle for zx


Commit: 5604db15ffaf4dc99f0e8861f19a133fd1a561fe
    https://github.com/scummvm/scummvm/commit/5604db15ffaf4dc99f0e8861f19a133fd1a561fe
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-07-19T16:08:58+02:00

Commit Message:
FREESCAPE: fixed and improved background support for castle

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


diff --git a/engines/freescape/games/castle/castle.h b/engines/freescape/games/castle/castle.h
index 69c15e24c10..259e45ce3a3 100644
--- a/engines/freescape/games/castle/castle.h
+++ b/engines/freescape/games/castle/castle.h
@@ -58,7 +58,8 @@ 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 *loadFrames(Common::SeekableReadStream *file, int pos, int numFrames, uint32 back);
+	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);
 
 	Graphics::Surface *_keysFrame;
 	int _numberKeys;
diff --git a/engines/freescape/games/castle/zx.cpp b/engines/freescape/games/castle/zx.cpp
index 61cc6c48c2f..05ed554b288 100644
--- a/engines/freescape/games/castle/zx.cpp
+++ b/engines/freescape/games/castle/zx.cpp
@@ -33,7 +33,7 @@ void CastleEngine::initZX() {
 	_ymaxValue = 1;
 }
 
-Graphics::Surface *CastleEngine::loadFrames(Common::SeekableReadStream *file, int pos, int numFrames, uint32 back) {
+Graphics::Surface *CastleEngine::loadFramesWithHeader(Common::SeekableReadStream *file, int pos, int numFrames, uint32 back) {
 	Graphics::Surface *surface = new Graphics::Surface();
 	file->seek(pos);
 	int16 width = file->readByte();
@@ -48,7 +48,11 @@ Graphics::Surface *CastleEngine::loadFrames(Common::SeekableReadStream *file, in
 
 	surface->fillRect(Common::Rect(0, 0, width * 8, height), white);
 	/*int frameSize =*/ file->readUint16LE();
+	return loadFrames(file, surface, width, height, back);
+}
+
 
+Graphics::Surface *CastleEngine::loadFrames(Common::SeekableReadStream *file, Graphics::Surface *surface, int width, int height, uint32 back) {
 	for (int i = 0; i < width * height; i++) {
 		byte color = file->readByte();
 		for (int n = 0; n < 8; n++) {
@@ -94,7 +98,19 @@ void CastleEngine::loadAssetsZXFullGame() {
 	loadColorPalette();
 	_gfx->readFromPalette(2, r, g, b);
 	uint32 red = _gfx->_texturePixelFormat.ARGBToColor(0xFF, r, g, b);
-	_keysFrame = loadFrames(&file, 0xdf7, 1, red);
+	_keysFrame = loadFramesWithHeader(&file, 0xdf7, 1, red);
+	Graphics::Surface *background = new Graphics::Surface();
+
+	_gfx->readFromPalette(4, r, g, b);
+	uint32 front = _gfx->_texturePixelFormat.ARGBToColor(0xFF, r, g, b);
+
+	int backgroundWidth = 16;
+	int backgroundHeight = 18;
+	background->create(backgroundWidth * 8, backgroundHeight, _gfx->_texturePixelFormat);
+	background->fillRect(Common::Rect(0, 0, backgroundWidth * 8, backgroundHeight), 0);
+
+	file.seek(0xfc4);
+	_background = loadFrames(&file, background, backgroundWidth, backgroundHeight, front);
 
 	for (auto &it : _areaMap) {
 		it._value->addStructure(_areaMap[255]);
@@ -140,7 +156,7 @@ void CastleEngine::drawZXUI(Graphics::Surface *surface) {
 	for (int k = 0; k < _numberKeys; k++) {
 		surface->copyRectToSurface((const Graphics::Surface)*_keysFrame, 99 - k * 4, 177, Common::Rect(0, 0, 6, 11));
 	}
-
+	//surface->copyRectToSurface((const Graphics::Surface)*_background, 0, 0, Common::Rect(0, 0, 8 * 16, 18));
 	//drawEnergyMeter(surface);
 }
 
diff --git a/engines/freescape/gfx_opengl.h b/engines/freescape/gfx_opengl.h
index 78a347aed23..8021b9a4014 100644
--- a/engines/freescape/gfx_opengl.h
+++ b/engines/freescape/gfx_opengl.h
@@ -133,16 +133,16 @@ public:
 		{ 1.0, 0.0, 0.0 }
 	};
 
-	GLfloat _skyUvs[16][3] = {
+	GLfloat _skyUvs[16][2] = {
 		{ 0.0f, 0.0f }, //1
 		{ 0.0f, 2.0f }, //2
 		{ 1.0f, 2.0f }, //3
 		{ 1.0f, 0.0f }, //front //4
 
-		{ 1.0f, 0.0f }, //1
-		{ 0.0f, 0.0f }, //2
-		{ 0.0f, 2.0f }, //back //3
-		{ 1.0f, 2.0f }, //4
+		{ 0.0f, 2.0f }, //back //1
+		{ 1.0f, 2.0f }, //2
+		{ 1.0f, 0.0f }, //3
+		{ 0.0f, 0.0f }, //4
 
 		{ 0.0f, 0.0f }, //left //1
 		{ 1.0f, 0.0f }, //2
@@ -161,10 +161,10 @@ public:
 		{ 81280.0,  -8128.0, 81280.0 },	//3	// Vertex #2
 		{ 81280.0,  8128.0, 81280.0 },		//4	// Vertex #3
 
-		{ 81280.0f, -8128.0f, -81280.0f }, //back //1
-		{ -81280.0f, -8128.0f, -81280.0f }, //2
-		{ -81280.0f,  8128.0f, -81280.0f }, //3
-		{ 81280.0f,  8128.0f, -81280.0f }, //4
+		{ 81280.0f, -8128.0f, -81280.0f }, // 1
+		{ -81280.0f, -8128.0f, -81280.0f }, // 2
+		{ -81280.0f, 8128.0f, -81280.0f }, // 3
+		{ 81280.0f, 8128.0f, -81280.0f }, // 4
 
 		{ -81280.0f,  8128.0f,  81280.0f }, //left //1
 		{ -81280.0f,  8128.0f, -81280.0f }, //2


Commit: 17fb2fc91fea0596e85f967c261ba3ddbec3c110
    https://github.com/scummvm/scummvm/commit/17fb2fc91fea0596e85f967c261ba3ddbec3c110
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-07-19T16:08:58+02:00

Commit Message:
FREESCAPE: initial implementation of info menu for castle in dos

Changed paths:
  A devtools/create_freescape/castle_menu_ega.bmp
  R devtools/create_freescape/castle_background_ega.bmp
    dists/engine-data/freescape.dat
    engines/freescape/games/castle/castle.cpp
    engines/freescape/games/castle/castle.h
    engines/freescape/games/castle/dos.cpp


diff --git a/devtools/create_freescape/castle_background_ega.bmp b/devtools/create_freescape/castle_background_ega.bmp
deleted file mode 100644
index 226c0fbb0c5..00000000000
Binary files a/devtools/create_freescape/castle_background_ega.bmp and /dev/null differ
diff --git a/devtools/create_freescape/castle_menu_ega.bmp b/devtools/create_freescape/castle_menu_ega.bmp
new file mode 100644
index 00000000000..7ae5f0b4de8
Binary files /dev/null and b/devtools/create_freescape/castle_menu_ega.bmp differ
diff --git a/dists/engine-data/freescape.dat b/dists/engine-data/freescape.dat
index 6ab6f6f5576..c97d5ed18e1 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 ee2eaebf80d..2a846e180ec 100644
--- a/engines/freescape/games/castle/castle.cpp
+++ b/engines/freescape/games/castle/castle.cpp
@@ -50,6 +50,7 @@ CastleEngine::CastleEngine(OSystem *syst, const ADGameDescription *gd) : Freesca
 	_option = nullptr;
 	_optionTexture = nullptr;
 	_keysFrame = nullptr;
+	_menu = nullptr;
 
 	_numberKeys = 0;
 }
@@ -163,6 +164,105 @@ void CastleEngine::pressedKey(const int keycode) {
 	}
 }
 
+void CastleEngine::drawInfoMenu() {
+	PauseToken pauseToken = pauseEngine();
+	_savedScreen = _gfx->getScreenshot();
+
+	uint8 r, g, b;
+	uint32 color = _gfx->_texturePixelFormat.ARGBToColor(0x00, 0x00, 0x00, 0x00);
+	Graphics::Surface *surface = new Graphics::Surface();
+	surface->create(_screenW, _screenH, _gfx->_texturePixelFormat);
+	surface->fillRect(_fullscreenViewArea, color);
+
+	uint32 black = _gfx->_texturePixelFormat.ARGBToColor(0xFF, 0x00, 0x00, 0x00);
+	uint32 front = 0;
+	surface->fillRect(_viewArea, black);
+
+	int score = _gameStateVars[k8bitVariableScore];
+	if (isDOS()) {
+		g_system->lockMouse(false);
+		g_system->showMouse(true);
+		surface->copyRectToSurface(*_menu, 40, 33, Common::Rect(0, 0, _menu->w, _menu->h));
+
+		_gfx->readFromPalette(10, r, g, b);
+		front = _gfx->_texturePixelFormat.ARGBToColor(0xFF, r, g, b);
+		drawStringInSurface(Common::String::format("%07d", score), 166, 71, front, black, surface);
+	}
+
+	Texture *menuTexture = _gfx->createTexture(surface);
+	Common::Event event;
+	bool cont = true;
+	while (!shouldQuit() && cont) {
+		while (_eventManager->pollEvent(event)) {
+
+			// Events
+			switch (event.type) {
+			case Common::EVENT_KEYDOWN:
+				if (event.kbd.keycode == Common::KEYCODE_l) {
+					_gfx->setViewport(_fullscreenViewArea);
+					_eventManager->purgeKeyboardEvents();
+					loadGameDialog();
+					if (isDOS()) {
+						g_system->lockMouse(false);
+						g_system->showMouse(true);
+					}
+
+					_gfx->setViewport(_viewArea);
+				} else if (event.kbd.keycode == Common::KEYCODE_s) {
+					_gfx->setViewport(_fullscreenViewArea);
+					_eventManager->purgeKeyboardEvents();
+					saveGameDialog();
+					if (isDOS()) {
+						g_system->lockMouse(false);
+						g_system->showMouse(true);
+					}
+
+					_gfx->setViewport(_viewArea);
+				} else if (isDOS() && event.kbd.keycode == Common::KEYCODE_t) {
+					// TODO
+				} else if ((isDOS() || isCPC()) && event.kbd.keycode == Common::KEYCODE_ESCAPE) {
+					_forceEndGame = true;
+					cont = false;
+				} else if (isSpectrum() && event.kbd.keycode == Common::KEYCODE_1) {
+					_forceEndGame = true;
+					cont = false;
+				} else
+					cont = false;
+				break;
+			case Common::EVENT_SCREEN_CHANGED:
+				_gfx->computeScreenViewport();
+				// TODO: properly refresh screen
+				break;
+			case Common::EVENT_RBUTTONDOWN:
+			// fallthrough
+			case Common::EVENT_LBUTTONDOWN:
+				if (g_system->hasFeature(OSystem::kFeatureTouchscreen))
+					cont = false;
+				break;
+			default:
+				break;
+			}
+		}
+		_gfx->clear(0, 0, 0, true);
+		drawFrame();
+		if (surface)
+			_gfx->drawTexturedRect2D(_fullscreenViewArea, _fullscreenViewArea, menuTexture);
+
+		_gfx->flipBuffer();
+		g_system->updateScreen();
+		g_system->delayMillis(15); // try to target ~60 FPS
+	}
+
+	_savedScreen->free();
+	delete _savedScreen;
+	surface->free();
+	delete surface;
+	delete menuTexture;
+	pauseToken.clear();
+	g_system->lockMouse(true);
+	g_system->showMouse(false);
+}
+
 void CastleEngine::executePrint(FCLInstruction &instruction) {
 	uint16 index = instruction._source;
 	_currentAreaMessages.clear();
diff --git a/engines/freescape/games/castle/castle.h b/engines/freescape/games/castle/castle.h
index 259e45ce3a3..b5c0cd3cc2a 100644
--- a/engines/freescape/games/castle/castle.h
+++ b/engines/freescape/games/castle/castle.h
@@ -27,8 +27,11 @@ public:
 	~CastleEngine();
 
 	Graphics::ManagedSurface *_option;
+	Graphics::Surface *_menu;
 	void initGameState() override;
 	void endGame() override;
+
+	void drawInfoMenu() 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 4317b7147e3..6752046fd98 100644
--- a/engines/freescape/games/castle/dos.cpp
+++ b/engines/freescape/games/castle/dos.cpp
@@ -151,9 +151,9 @@ void CastleEngine::loadAssetsDOSFullGame() {
 		_areaMap[2]->addFloor();
 		delete stream;
 
-		_background = loadBundledImage("castle_background");
-		assert(_background);
-		_background->convertToInPlace(_gfx->_texturePixelFormat);
+		_menu = loadBundledImage("castle_menu");
+		assert(_menu);
+		_menu->convertToInPlace(_gfx->_texturePixelFormat);
 	} else
 		error("Not implemented yet");
 
@@ -210,9 +210,9 @@ void CastleEngine::loadAssetsDOSDemo() {
 		_areaMap[1]->addFloor();
 		_areaMap[2]->addFloor();
 		delete stream;
-		//_background = loadBundledImage("background");
-		//assert(_background);
-		//_background->convertToInPlace(_gfx->_texturePixelFormat);
+		_menu = loadBundledImage("castle_menu");
+		assert(_menu);
+		_menu->convertToInPlace(_gfx->_texturePixelFormat);
 	} else
 		error("Not implemented yet");
 }


Commit: 747fa1c9e2ab3b1017446d3c42b92b8c1306dbd4
    https://github.com/scummvm/scummvm/commit/747fa1c9e2ab3b1017446d3c42b92b8c1306dbd4
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-07-19T16:08:58+02:00

Commit Message:
FREESCAPE: fixes for ghost handling in castle for zx

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


diff --git a/engines/freescape/games/castle/castle.cpp b/engines/freescape/games/castle/castle.cpp
index 2a846e180ec..2756bef3075 100644
--- a/engines/freescape/games/castle/castle.cpp
+++ b/engines/freescape/games/castle/castle.cpp
@@ -107,9 +107,12 @@ void CastleEngine::gotoArea(uint16 areaID, int entranceID) {
 	if (isSpectrum() || isCPC())
 		_gfx->_paperColor = 0;
 	resetInput();
-	Entrance *entrance = (Entrance *)_currentArea->entranceWithID(entranceID);
-	assert(entrance);
-	executeEntranceConditions(entrance);
+
+	if (entranceID > 0) {
+		Entrance *entrance = (Entrance *)_currentArea->entranceWithID(entranceID);
+		assert(entrance);
+		executeEntranceConditions(entrance);
+	}
 }
 
 void CastleEngine::initGameState() {
@@ -526,13 +529,31 @@ void CastleEngine::addGhosts() {
 	for (auto &it : _areaMap) {
 		for (auto &sensor : it._value->getSensors()) {
 			if (sensor->getObjectID() == 125) {
-				_areaMap[it._key]->addGroupFromArea(195, _areaMap[255]);
-				_areaMap[it._key]->addGroupFromArea(212, _areaMap[255]);
-			} else if (sensor->getObjectID() == 126)
-				_areaMap[it._key]->addGroupFromArea(191, _areaMap[255]);
-			else if (sensor->getObjectID() == 127)
-				_areaMap[it._key]->addGroupFromArea(182, _areaMap[255]);
-			else
+				if (isDOS()) {
+					_areaMap[it._key]->addGroupFromArea(195, _areaMap[255]);
+					_areaMap[it._key]->addGroupFromArea(212, _areaMap[255]);
+				} else if (isSpectrum()) {
+					_areaMap[it._key]->addObjectFromArea(170, _areaMap[255]);
+					_areaMap[it._key]->addObjectFromArea(172, _areaMap[255]);
+					_areaMap[it._key]->addObjectFromArea(173, _areaMap[255]);
+				}
+			} else if (sensor->getObjectID() == 126) {
+				if (isDOS())
+					_areaMap[it._key]->addGroupFromArea(191, _areaMap[255]);
+				else if (isSpectrum()) {
+					_areaMap[it._key]->addObjectFromArea(145, _areaMap[255]);
+					_areaMap[it._key]->addObjectFromArea(165, _areaMap[255]);
+					_areaMap[it._key]->addObjectFromArea(166, _areaMap[255]);
+				}
+			} else if (sensor->getObjectID() == 127) {
+				if (isDOS())
+					_areaMap[it._key]->addGroupFromArea(182, _areaMap[255]);
+				else if (isSpectrum()) {
+					_areaMap[it._key]->addObjectFromArea(142, _areaMap[255]);
+					_areaMap[it._key]->addObjectFromArea(143, _areaMap[255]);
+					_areaMap[it._key]->addObjectFromArea(144, _areaMap[255]);
+				}
+			} else
 				debugC(1, kFreescapeDebugParser, "Sensor %d in area %d", sensor->getObjectID(), it._key);
 		}
 	}
@@ -551,31 +572,33 @@ void CastleEngine::checkSensors() {
 		return;
 
 	Sensor *sensor = (Sensor *)&_sensors[0];
-	if (sensor->getObjectID() == 125) {
-		Group *group = (Group *)_currentArea->objectWithID(195);
-		if (!group->isDestroyed() && !group->isInvisible()) {
-			group->_active = true;
-		} else
-			return;
-
-		group = (Group *)_currentArea->objectWithID(212);
-		if (!group->isDestroyed() && !group->isInvisible()) {
-			group->_active = true;
-		} else
-			return;
-
-	} else if (sensor->getObjectID() == 126) {
-		Group *group = (Group *)_currentArea->objectWithID(191);
-		if (!group->isDestroyed() && !group->isInvisible()) {
-			group->_active = true;
-		} else
-			return;
-	} else if (sensor->getObjectID() == 197) {
-		Group *group = (Group *)_currentArea->objectWithID(182);
-		if (!group->isDestroyed() && !group->isInvisible()) {
-			group->_active = true;
-		} else
-			return;
+	if (isDOS()) { // Should be similar to Amiga/AtariST
+		if (sensor->getObjectID() == 125) {
+			Group *group = (Group *)_currentArea->objectWithID(195);
+			if (!group->isDestroyed() && !group->isInvisible()) {
+				group->_active = true;
+			} else
+				return;
+
+			group = (Group *)_currentArea->objectWithID(212);
+			if (!group->isDestroyed() && !group->isInvisible()) {
+				group->_active = true;
+			} else
+				return;
+
+		} else if (sensor->getObjectID() == 126) {
+			Group *group = (Group *)_currentArea->objectWithID(191);
+			if (!group->isDestroyed() && !group->isInvisible()) {
+				group->_active = true;
+			} else
+				return;
+		} else if (sensor->getObjectID() == 197) {
+			Group *group = (Group *)_currentArea->objectWithID(182);
+			if (!group->isDestroyed() && !group->isInvisible()) {
+				group->_active = true;
+			} else
+				return;
+		}
 	}
 
 	/*int firingInterval = 10; // This is fixed for all the ghosts?
diff --git a/engines/freescape/games/castle/zx.cpp b/engines/freescape/games/castle/zx.cpp
index 05ed554b288..e71124198e6 100644
--- a/engines/freescape/games/castle/zx.cpp
+++ b/engines/freescape/games/castle/zx.cpp
@@ -124,7 +124,7 @@ void CastleEngine::loadAssetsZXFullGame() {
 			it._value->addObjectFromArea(id, _areaMap[255]);
 		}
 	}
-
+	addGhosts();
 	_areaMap[1]->addFloor();
 	_areaMap[2]->addFloor();
 }
diff --git a/engines/freescape/language/instruction.cpp b/engines/freescape/language/instruction.cpp
index e6912dbf4bb..d76726d465d 100644
--- a/engines/freescape/language/instruction.cpp
+++ b/engines/freescape/language/instruction.cpp
@@ -552,7 +552,18 @@ void FreescapeEngine::executeMakeVisible(FCLInstruction &instruction) {
 		Object *obj = _areaMap[areaID]->objectWithID(objectID);
 		if (!obj && isCastle())
 			return; // No side effects
-		assert(obj); // We assume an object should be there
+
+		if (!obj) {
+			obj = _areaMap[255]->objectWithID(objectID);
+			if (!obj) {
+				error("obj %d does not exists in area %d nor in the global one!", objectID, areaID);
+				return;
+			}
+			_currentArea->addObjectFromArea(objectID, _areaMap[255]);
+			obj = _areaMap[areaID]->objectWithID(objectID);
+			assert(obj); // We know that an object should be there
+		}
+
 		obj->makeVisible();
 		if (!isDriller()) {
 			Math::AABB boundingBox = createPlayerAABB(_position, _playerHeight);


Commit: 866340005d7abe122f60ad95e5695bbeb36cfda6
    https://github.com/scummvm/scummvm/commit/866340005d7abe122f60ad95e5695bbeb36cfda6
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-07-19T16:08:58+02:00

Commit Message:
FREESCAPE: workaround for adding missing objects in castle

Changed paths:
    engines/freescape/freescape.cpp
    engines/freescape/freescape.h
    engines/freescape/language/instruction.cpp


diff --git a/engines/freescape/freescape.cpp b/engines/freescape/freescape.cpp
index 8b06c6869d4..25c448f5036 100644
--- a/engines/freescape/freescape.cpp
+++ b/engines/freescape/freescape.cpp
@@ -166,6 +166,7 @@ FreescapeEngine::FreescapeEngine(OSystem *syst, const ADGameDescription *gd)
 	_lastMinute = -1;
 	_frameLimiter = nullptr;
 	_vsyncEnabled = false;
+	_executingGlobalCode = false;
 
 	_underFireFrames = 0;
 	_shootingFrames = 0;
diff --git a/engines/freescape/freescape.h b/engines/freescape/freescape.h
index 13b671c1a0d..6f22c907ea0 100644
--- a/engines/freescape/freescape.h
+++ b/engines/freescape/freescape.h
@@ -338,6 +338,7 @@ public:
 
 	bool runCollisionConditions(Math::Vector3d const lastPosition, Math::Vector3d const newPosition);
 	Math::Vector3d _objExecutingCodeSize;
+	bool _executingGlobalCode;
 	virtual void executeMovementConditions();
 	bool executeObjectConditions(GeometricObject *obj, bool shot, bool collided, bool activated);
 	void executeEntranceConditions(Entrance *entrance);
diff --git a/engines/freescape/language/instruction.cpp b/engines/freescape/language/instruction.cpp
index d76726d465d..78f648bff0d 100644
--- a/engines/freescape/language/instruction.cpp
+++ b/engines/freescape/language/instruction.cpp
@@ -131,11 +131,13 @@ void FreescapeEngine::executeLocalGlobalConditions(bool shot, bool collided, boo
 		executeCode(conditions[i], shot, collided, timer, false);
 	}
 
+	_executingGlobalCode = true;
 	debugC(1, kFreescapeDebugCode, "Executing global conditions (%d)", _conditions.size());
 	for (uint i = 0; i < _conditions.size(); i++) {
 		debugC(1, kFreescapeDebugCode, "%s", _conditionSources[i].c_str());
 		executeCode(_conditions[i], shot, collided, timer, false);
 	}
+	_executingGlobalCode = false;
 }
 
 void FreescapeEngine::executeCode(FCLInstructionVector &code, bool shot, bool collided, bool timer, bool activated) {
@@ -550,7 +552,7 @@ void FreescapeEngine::executeMakeVisible(FCLInstruction &instruction) {
 	debugC(1, kFreescapeDebugCode, "Making obj %d visible in area %d!", objectID, areaID);
 	if (_areaMap.contains(areaID)) {
 		Object *obj = _areaMap[areaID]->objectWithID(objectID);
-		if (!obj && isCastle())
+		if (!obj && isCastle() && _executingGlobalCode)
 			return; // No side effects
 
 		if (!obj) {


Commit: 34252f8c53ce9ed2a8f50e81aaec0726102fa0e5
    https://github.com/scummvm/scummvm/commit/34252f8c53ce9ed2a8f50e81aaec0726102fa0e5
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-07-19T16:08:58+02:00

Commit Message:
FREESCAPE: more fixes and improvements for castle for zx

Changed paths:
    engines/freescape/gfx_opengl.h
    engines/freescape/movement.cpp


diff --git a/engines/freescape/gfx_opengl.h b/engines/freescape/gfx_opengl.h
index 8021b9a4014..1f71f3e4bfe 100644
--- a/engines/freescape/gfx_opengl.h
+++ b/engines/freescape/gfx_opengl.h
@@ -136,23 +136,23 @@ public:
 	GLfloat _skyUvs[16][2] = {
 		{ 0.0f, 0.0f }, //1
 		{ 0.0f, 2.0f }, //2
-		{ 1.0f, 2.0f }, //3
-		{ 1.0f, 0.0f }, //front //4
+		{ 2.5f, 2.0f }, //3
+		{ 2.5f, 0.0f }, //front //4
 
 		{ 0.0f, 2.0f }, //back //1
-		{ 1.0f, 2.0f }, //2
-		{ 1.0f, 0.0f }, //3
+		{ 2.5f, 2.0f }, //2
+		{ 2.5f, 0.0f }, //3
 		{ 0.0f, 0.0f }, //4
 
 		{ 0.0f, 0.0f }, //left //1
-		{ 1.0f, 0.0f }, //2
-		{ 1.0f, 2.0f }, //3
+		{ 2.5f, 0.0f }, //2
+		{ 2.5f, 2.0f }, //3
 		{ 0.0f, 2.0f }, //4
 
-		{ 1.0f, 0.0f }, //right //1
+		{ 2.5f, 0.0f }, //right //1
 		{ 0.0f, 0.0f }, //2
 		{ 0.0f, 2.0f }, //3
-		{ 1.0f, 2.0f }, //4
+		{ 2.5f, 2.0f }, //4
 	};
 
 	GLfloat _skyVertices[16][3] = {
diff --git a/engines/freescape/movement.cpp b/engines/freescape/movement.cpp
index a91aefcb0bb..912c1248724 100644
--- a/engines/freescape/movement.cpp
+++ b/engines/freescape/movement.cpp
@@ -445,7 +445,7 @@ bool FreescapeEngine::runCollisionConditions(Math::Vector3d const lastPosition,
 	ray = Math::Ray(lastPosition, direction);
 	int rayLenght = 45;
 	if (_currentArea->getScale() >= 5)
-		rayLenght = 45 / (2 * _currentArea->getScale());
+		rayLenght = MAX(5, 45 / (2 * _currentArea->getScale()));
 
 	collided = _currentArea->checkCollisionRay(ray, rayLenght);
 	if (collided) {


Commit: 99c1cce8268d4baa30c0f65d07f850082d447090
    https://github.com/scummvm/scummvm/commit/99c1cce8268d4baa30c0f65d07f850082d447090
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-07-19T16:08:58+02:00

Commit Message:
FREESCAPE: change color for fullscreen messagges in castle for zx

Changed paths:
    engines/freescape/ui.cpp


diff --git a/engines/freescape/ui.cpp b/engines/freescape/ui.cpp
index f8a34dacea6..4f9307a3ddc 100644
--- a/engines/freescape/ui.cpp
+++ b/engines/freescape/ui.cpp
@@ -83,7 +83,7 @@ Graphics::Surface *FreescapeEngine::drawStringsInSurface(const Common::Array<Com
 			color = 1;
 			break;
 		case Common::kRenderZX:
-			color = 6;
+			color = isCastle() ? 7 : 6;
 			break;
 		case Common::kRenderCPC:
 			color = _gfx->_underFireBackgroundColor;
@@ -139,9 +139,16 @@ void FreescapeEngine::borderScreen() {
 		lines.push_back("   2: IBM JOYSTICK    ");
 		lines.push_back("   3: AMSTRAD JOYSTICK");
 		lines.push_back("");
-		lines.push_back(" SPACEBAR:  BEGIN MISSION");
+		if (isDOS())
+			lines.push_back(" SPACEBAR:  BEGIN MISSION");
+		else
+			lines.push_back("   ENTER: BEGIN MISSION");
 		lines.push_back("");
-		lines.push_back(" COPYRIGHT 1988 INCENTIVE");
+		if (isDOS())
+			lines.push_back(" COPYRIGHT 1988 INCENTIVE");
+		else
+			lines.push_back("   (C) 1988 INCENTIVE");
+
 		lines.push_back("");
 		Graphics::Surface *surface = drawStringsInSurface(lines);
 		drawBorderScreenAndWait(surface);
@@ -167,8 +174,8 @@ void FreescapeEngine::drawFullscreenMessage(Common::String message, uint32 front
 		letterPerLine = 28;
 		numberOfLines = 10;
 	} else if (isSpectrum() || isCPC()) {
-		x = 60;
-		y = 40;
+		x = _viewArea.left;
+		y = _viewArea.top;
 		letterPerLine = 24;
 		numberOfLines = 12;
 	} else if (isAtariST()) {




More information about the Scummvm-git-logs mailing list