[Scummvm-git-logs] scummvm master -> 225eab754fd388d4f211ad7ba9d34bf92bed179f

neuromancer noreply at scummvm.org
Fri Nov 1 12:03:33 UTC 2024


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

Summary:
0fcd49caac FREESCAPE: refactor ghostInArea
075740a349 FREESCAPE: fix crash in castle for dos (spanish release)
225eab754f FREESCAPE: avoid player staying too close to the walls when changing areas


Commit: 0fcd49caacabfedad58ca56114ca18a61988f8bc
    https://github.com/scummvm/scummvm/commit/0fcd49caacabfedad58ca56114ca18a61988f8bc
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-11-01T13:04:23+01:00

Commit Message:
FREESCAPE: refactor ghostInArea

Changed paths:
    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/games/castle/castle.cpp b/engines/freescape/games/castle/castle.cpp
index 15ad2994452..04564693d2c 100644
--- a/engines/freescape/games/castle/castle.cpp
+++ b/engines/freescape/games/castle/castle.cpp
@@ -1230,15 +1230,8 @@ void CastleEngine::checkSensors() {
 		}
 	}
 
-	bool ghostInArea = false;
-	for (auto &it : _sensors) {
-		if (it->isDestroyed() || it->isInvisible())
-			continue;
-		ghostInArea = true;
-		break;
-	}
 
-	if (!ghostInArea) {
+	if (!ghostInArea()) {
 		_gfx->_shakeOffset = Common::Point();
 		return;
 	}
@@ -1258,6 +1251,16 @@ void CastleEngine::checkSensors() {
 	}
 }
 
+bool CastleEngine::ghostInArea() {
+	for (auto &it : _sensors) {
+		if (it->isDestroyed() || it->isInvisible())
+			continue;
+		return true;
+		break;
+	}
+	return false;
+}
+
 void CastleEngine::drawSensorShoot(Sensor *sensor) {
 	if (isSpectrum()) {
 		_gfx->_inkColor = 1 + (_gfx->_inkColor + 1) % 7;
diff --git a/engines/freescape/games/castle/castle.h b/engines/freescape/games/castle/castle.h
index c0c8812c830..e6b394387d1 100644
--- a/engines/freescape/games/castle/castle.h
+++ b/engines/freescape/games/castle/castle.h
@@ -138,6 +138,7 @@ private:
 	void drawRiddle(uint16 riddle, uint32 front, uint32 back, Graphics::Surface *surface);
 	void tryToCollectKey();
 	void addGhosts();
+	bool ghostInArea();
 	Texture *_optionTexture;
 	Font _fontRiddle;
 };
diff --git a/engines/freescape/games/castle/dos.cpp b/engines/freescape/games/castle/dos.cpp
index ac767e9dd87..1d23f6c498b 100644
--- a/engines/freescape/games/castle/dos.cpp
+++ b/engines/freescape/games/castle/dos.cpp
@@ -448,8 +448,12 @@ void CastleEngine::drawDOSUI(Graphics::Surface *surface) {
 		_temporaryMessages.push_back(message);
 		_temporaryMessageDeadlines.push_back(deadline);
 	} else {
-		if (_gameStateControl == kFreescapeGameStatePlaying)
-			drawStringInSurface(_currentArea->_name, 97, 182, front, back, surface);
+		if (_gameStateControl == kFreescapeGameStatePlaying) {
+			if (ghostInArea())
+				drawStringInSurface(_messagesList[116], 97, 182, front, back, surface);
+			else
+				drawStringInSurface(_currentArea->_name, 97, 182, front, back, surface);
+		}
 	}
 
 	for (int k = 0; k < int(_keysCollected.size()); k++) {
diff --git a/engines/freescape/games/castle/zx.cpp b/engines/freescape/games/castle/zx.cpp
index a857435d080..6571546e2b2 100644
--- a/engines/freescape/games/castle/zx.cpp
+++ b/engines/freescape/games/castle/zx.cpp
@@ -252,15 +252,18 @@ void CastleEngine::drawZXUI(Graphics::Surface *surface) {
 	surface->fillRect(backRect, black);
 
 	Common::String message;
-	int deadline;
+	int deadline = -1;
 	getLatestMessages(message, deadline);
-	if (deadline <= _countdown) {
+	if (deadline > 0 && deadline <= _countdown) {
 		//debug("deadline: %d countdown: %d", deadline, _countdown);
 		drawStringInSurface(message, 120, 179, front, black, surface);
 		_temporaryMessages.push_back(message);
 		_temporaryMessageDeadlines.push_back(deadline);
-	} else
-		drawStringInSurface(_currentArea->_name, 120, 179, front, black, surface);
+	} else {
+		if (_gameStateControl == kFreescapeGameStatePlaying) {
+			drawStringInSurface(_currentArea->_name, 120, 179, front, black, surface);
+		}
+	}
 
 	for (int k = 0; k < int(_keysCollected.size()); k++) {
 		surface->copyRectToSurface((const Graphics::Surface)*_keysBorderFrames[0], 99 - k * 4, 177, Common::Rect(0, 0, 6, 11));


Commit: 075740a34920e3ed59c1373a0bc49f525e168f9f
    https://github.com/scummvm/scummvm/commit/075740a34920e3ed59c1373a0bc49f525e168f9f
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-11-01T13:04:23+01:00

Commit Message:
FREESCAPE: fix crash in castle for dos (spanish release)

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 04564693d2c..fcaaff179fb 100644
--- a/engines/freescape/games/castle/castle.cpp
+++ b/engines/freescape/games/castle/castle.cpp
@@ -967,6 +967,9 @@ void CastleEngine::loadRiddles(Common::SeekableReadStream *file, int offset, int
 			}
 
 			debugC(1, kFreescapeDebugParser, "extra byte: %x", file->readByte());
+			if (i == 20 && j == 1 && _language == Common::ES_ESP)
+				size = size + 3;
+
 			while (size-- > 0) {
 				byte c = file->readByte();
 				if (c > 0x7F) {
diff --git a/engines/freescape/games/castle/dos.cpp b/engines/freescape/games/castle/dos.cpp
index 1d23f6c498b..6be0174777f 100644
--- a/engines/freescape/games/castle/dos.cpp
+++ b/engines/freescape/games/castle/dos.cpp
@@ -271,7 +271,7 @@ void CastleEngine::loadAssetsDOSFullGame() {
 		switch (_language) {
 			case Common::ES_ESP:
 				stream = decryptFile("CMLS");
-				loadRiddles(stream, 0xaae - 2 - 21 * 2, 21);
+				loadRiddles(stream, 0xaae - 2 - 22 * 2, 22);
 				break;
 			case Common::FR_FRA:
 				stream = decryptFile("CMLF");


Commit: 225eab754fd388d4f211ad7ba9d34bf92bed179f
    https://github.com/scummvm/scummvm/commit/225eab754fd388d4f211ad7ba9d34bf92bed179f
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-11-01T13:04:23+01:00

Commit Message:
FREESCAPE: avoid player staying too close to the walls when changing areas

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


diff --git a/engines/freescape/area.cpp b/engines/freescape/area.cpp
index 88398846e1d..f02ef0baf6c 100644
--- a/engines/freescape/area.cpp
+++ b/engines/freescape/area.cpp
@@ -448,6 +448,42 @@ bool Area::checkIfPlayerWasCrushed(const Math::AABB &boundingBox) {
 	return false;
 }
 
+Math::Vector3d Area::separateFromWall(const Math::Vector3d &_position) {
+	Math::Vector3d position = _position;
+	float sep = 8 / _scale;
+	for (auto &obj : _drawableObjects) {
+		if (!obj->isDestroyed() && !obj->isInvisible()) {
+			GeometricObject *gobj = (GeometricObject *)obj;
+			Math::Vector3d distance = gobj->_boundingBox.distance(position);
+			if (distance.length() > 0.0001)
+				continue;
+
+			position.z() = position.z() + sep;
+			distance = gobj->_boundingBox.distance(position);
+			if (distance.length() > 0.0001)
+				return position;
+
+			position = _position;
+			position.z() = position.z() - sep;
+			distance = gobj->_boundingBox.distance(position);
+			if (distance.length() > 0.0001)
+				return position;
+
+			position = _position;
+			position.x() = position.x() + sep;
+			distance = gobj->_boundingBox.distance(position);
+			if (distance.length() > 0.0001)
+				return position;
+
+			position = _position;
+			position.x() = position.x() - sep;
+			distance = gobj->_boundingBox.distance(position);
+			if (distance.length() > 0.0001)
+				return position;
+		}
+	}
+	return position;
+}
 
 Math::Vector3d Area::resolveCollisions(const Math::Vector3d &lastPosition_, const Math::Vector3d &newPosition_, int playerHeight) {
 	Math::Vector3d position = newPosition_;
diff --git a/engines/freescape/area.h b/engines/freescape/area.h
index 3ba0b63ce6b..fea9e2907d0 100644
--- a/engines/freescape/area.h
+++ b/engines/freescape/area.h
@@ -58,6 +58,7 @@ public:
 
 	Object *checkCollisionRay(const Math::Ray &ray, int raySize);
 	bool checkInSight(const Math::Ray &ray, float maxDistance);
+	Math::Vector3d separateFromWall(const Math::Vector3d &position);
 	ObjectArray checkCollisions(const Math::AABB &boundingBox);
 	bool checkIfPlayerWasCrushed(const Math::AABB &boundingBox);
 	Math::Vector3d resolveCollisions(Math::Vector3d const &lastPosition, Math::Vector3d const &newPosition, int playerHeight);
diff --git a/engines/freescape/games/castle/castle.cpp b/engines/freescape/games/castle/castle.cpp
index fcaaff179fb..e199a877a84 100644
--- a/engines/freescape/games/castle/castle.cpp
+++ b/engines/freescape/games/castle/castle.cpp
@@ -311,6 +311,7 @@ void CastleEngine::gotoArea(uint16 areaID, int entranceID) {
 	if (entranceID > 0)
 		traverseEntrance(entranceID);
 
+	_position = _currentArea->separateFromWall(_position);
 	_lastPosition = _position;
 
 	if (_currentArea->_skyColor > 0 && _currentArea->_skyColor != 255) {




More information about the Scummvm-git-logs mailing list