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

neuromancer noreply at scummvm.org
Fri Aug 9 15:21:21 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:
332374bb8a FREESCAPE: workaround for shooting certain types of lines
c698cfc159 FREESCAPE: added disc release of castle for zx and refactored game variants
99b404d7cd FREESCAPE: start removing sound selection code in favor of using variables per game/platform


Commit: 332374bb8a41aa73983d3cf9f203bbc74164319f
    https://github.com/scummvm/scummvm/commit/332374bb8a41aa73983d3cf9f203bbc74164319f
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-08-09T17:19:50+02:00

Commit Message:
FREESCAPE: workaround for shooting certain types of lines

Changed paths:
    engines/freescape/area.cpp
    engines/freescape/objects/geometricobject.cpp
    engines/freescape/objects/geometricobject.h


diff --git a/engines/freescape/area.cpp b/engines/freescape/area.cpp
index 7d9c0b9ead5..e956d75b236 100644
--- a/engines/freescape/area.cpp
+++ b/engines/freescape/area.cpp
@@ -385,6 +385,11 @@ Object *Area::checkCollisionRay(const Math::Ray &ray, int raySize) {
 	Math::AABB boundingBox(ray.getOrigin(), ray.getOrigin());
 	Object *collided = nullptr;
 	for (auto &obj : _drawableObjects) {
+		if (obj->getType() == kLineType)
+			// If the line is not along an axis, the AABB is wildly inaccurate so we skip it
+			if (((GeometricObject *)obj)->isLineButNotStraight())
+				continue;
+
 		if (!obj->isDestroyed() && !obj->isInvisible()) {
 			GeometricObject *gobj = (GeometricObject *)obj;
 			Math::Vector3d collidedNormal;
diff --git a/engines/freescape/objects/geometricobject.cpp b/engines/freescape/objects/geometricobject.cpp
index 25aabeb22e0..b66a483a128 100644
--- a/engines/freescape/objects/geometricobject.cpp
+++ b/engines/freescape/objects/geometricobject.cpp
@@ -416,6 +416,30 @@ GeometricObject::~GeometricObject() {
 	delete _initialOrdinates;
 }
 
+// This function returns when the object is a line, but it is not a straight line
+bool GeometricObject::isLineButNotStraight() {
+	if (_type != kLineType)
+		return false;
+
+	if (!_ordinates)
+		return false;
+
+	if (_ordinates->size() != 6)
+		return false;
+
+	// At least two coordinates should be the same to be a straight line
+	if ((*_ordinates)[0] == (*_ordinates)[3] && (*_ordinates)[1] == (*_ordinates)[4])
+		return false;
+
+	if ((*_ordinates)[0] == (*_ordinates)[3] && (*_ordinates)[2] == (*_ordinates)[5])
+		return false;
+
+	if ((*_ordinates)[1] == (*_ordinates)[4] && (*_ordinates)[2] == (*_ordinates)[5])
+		return false;
+
+	return true;
+}
+
 bool GeometricObject::isDrawable() { return true; }
 bool GeometricObject::isPlanar() {
 	ObjectType t = this->getType();
diff --git a/engines/freescape/objects/geometricobject.h b/engines/freescape/objects/geometricobject.h
index 804f4b3b104..2b8bd956a24 100644
--- a/engines/freescape/objects/geometricobject.h
+++ b/engines/freescape/objects/geometricobject.h
@@ -63,6 +63,8 @@ public:
 	bool isPlanar() override;
 	bool _cyclingColors;
 
+	bool isLineButNotStraight();
+
 	Common::String _conditionSource;
 	FCLInstructionVector _condition;
 


Commit: c698cfc159cc66259fc542c094eb9550605d96d8
    https://github.com/scummvm/scummvm/commit/c698cfc159cc66259fc542c094eb9550605d96d8
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-08-09T17:19:50+02:00

Commit Message:
FREESCAPE: added disc release of castle for zx and refactored game variants

Changed paths:
    engines/freescape/detection.cpp
    engines/freescape/freescape.h
    engines/freescape/games/castle/castle.h
    engines/freescape/games/driller/driller.h


diff --git a/engines/freescape/detection.cpp b/engines/freescape/detection.cpp
index 70967a94e9e..9d8a85e662b 100644
--- a/engines/freescape/detection.cpp
+++ b/engines/freescape/detection.cpp
@@ -677,6 +677,7 @@ static const ADGameDescription gameDescriptions[] = {
 	},
 
 	// Castle Master
+	// Tape release
 	{
 		"castlemaster",
 		"",
@@ -686,13 +687,24 @@ static const ADGameDescription gameDescriptions[] = {
 		ADGF_UNSTABLE,
 		GUIO3(GUIO_NOMIDI, GAMEOPTION_TRAVEL_ROCK, GUIO_RENDERZX)
 	},
+	// Disc release
+	{
+		"castlemaster",
+		"",
+		AD_ENTRY1s("castlemaster.zx.data", "98513a4438ba93971d793a0fbc875b70", 36309),
+		Common::EN_ANY,
+		Common::kPlatformZX,
+		ADGF_UNSTABLE | GF_ZX_DISC,
+		GUIO3(GUIO_NOMIDI, GAMEOPTION_TRAVEL_ROCK, GUIO_RENDERZX)
+	},
+	// Spanish release was disc-only?
 	{
 		"castlemaster",
 		"",
 		AD_ENTRY1s("castlemaster.zx.data", "3e6f6b283fa00a3073edce2392950601", 36309),
 		Common::ES_ESP,
 		Common::kPlatformZX,
-		ADGF_UNSTABLE,
+		ADGF_UNSTABLE | GF_ZX_DISC,
 		GUIO3(GUIO_NOMIDI, GAMEOPTION_TRAVEL_ROCK, GUIO_RENDERZX)
 	},
 	{
diff --git a/engines/freescape/freescape.h b/engines/freescape/freescape.h
index 04a82803ad3..7ee09a5f2a6 100644
--- a/engines/freescape/freescape.h
+++ b/engines/freescape/freescape.h
@@ -509,6 +509,20 @@ public:
 	Common::RandomSource *_rnd;
 };
 
+enum GameReleaseFlags {
+	GF_AMIGA_RETAIL = (1 << 0),
+	GF_AMIGA_BUDGET = (1 << 1),
+	GF_ZX_RETAIL = (1 << 2),
+	GF_ZX_BUDGET = (1 << 3),
+	GF_ZX_DISC = (1 << 4),
+	GF_CPC_RETAIL = (1 << 5),
+	GF_CPC_RETAIL_ALT = (1 << 6),
+	GF_CPC_BUDGET = (1 << 7),
+	GF_CPC_VIRTUALWORLDS = (1 << 8),
+	GF_ATARI_RETAIL = (1 << 9),
+	GF_ATARI_BUDGET = (1 << 10)
+};
+
 extern FreescapeEngine *g_freescape;
 
 } // namespace Freescape
diff --git a/engines/freescape/games/castle/castle.h b/engines/freescape/games/castle/castle.h
index dbfef4d1273..e791b217405 100644
--- a/engines/freescape/games/castle/castle.h
+++ b/engines/freescape/games/castle/castle.h
@@ -87,6 +87,4 @@ private:
 	Texture *_optionTexture;
 };
 
-extern byte kFreescapeCastleFont[];
-
 }
\ No newline at end of file
diff --git a/engines/freescape/games/driller/driller.h b/engines/freescape/games/driller/driller.h
index a3c22ce0ced..65d93235bd6 100644
--- a/engines/freescape/games/driller/driller.h
+++ b/engines/freescape/games/driller/driller.h
@@ -108,19 +108,8 @@ private:
 };
 
 enum DrillerReleaseFlags {
-		GF_AMIGA_RETAIL = (1 << 0),
-		GF_AMIGA_BUDGET = (1 << 1),
-		GF_ZX_RETAIL = (1 << 2),
-		GF_ZX_BUDGET = (1 << 3),
-		GF_ZX_DISC = (1 << 4),
-		GF_CPC_RETAIL = (1 << 5),
-		GF_CPC_RETAIL2 = (1 << 6),
-		GF_CPC_BUDGET = (1 << 7),
-		GF_CPC_VIRTUALWORLDS = (1 << 8),
-		GF_ATARI_RETAIL = (1 << 9),
-		GF_ATARI_BUDGET = (1 << 10),
-		GF_AMIGA_MAGAZINE_DEMO = (1 << 11),
-		GF_ATARI_MAGAZINE_DEMO = (1 << 12),
+	GF_AMIGA_MAGAZINE_DEMO = (1 << 0),
+	GF_ATARI_MAGAZINE_DEMO = (1 << 1),
 };
 
 }


Commit: 99b404d7cdb1fedde0a83718c9e1febc2ffa077d
    https://github.com/scummvm/scummvm/commit/99b404d7cdb1fedde0a83718c9e1febc2ffa077d
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-08-09T17:19:50+02:00

Commit Message:
FREESCAPE: start removing sound selection code in favor of using variables per game/platform

Changed paths:
    engines/freescape/freescape.cpp
    engines/freescape/freescape.h
    engines/freescape/games/castle/castle.cpp
    engines/freescape/games/castle/zx.cpp
    engines/freescape/games/dark/dark.cpp
    engines/freescape/games/dark/zx.cpp
    engines/freescape/games/driller/driller.cpp
    engines/freescape/games/eclipse/eclipse.cpp
    engines/freescape/games/eclipse/zx.cpp
    engines/freescape/movement.cpp
    engines/freescape/sound.cpp


diff --git a/engines/freescape/freescape.cpp b/engines/freescape/freescape.cpp
index c48329f4f89..2e434d851c7 100644
--- a/engines/freescape/freescape.cpp
+++ b/engines/freescape/freescape.cpp
@@ -79,7 +79,7 @@ FreescapeEngine::FreescapeEngine(OSystem *syst, const ADGameDescription *gd)
 		error("Failed to parse bool from disable_falling option");
 
 	if (!Common::parseBool(ConfMan.get("invert_y"), _invertY))
-		error("Failed to parse bool from disable_falling option");
+		error("Failed to parse bool from invert_y option");
 
 	_gameStateControl = kFreescapeGameStateStart;
 	_startArea = 0;
@@ -149,6 +149,16 @@ FreescapeEngine::FreescapeEngine(OSystem *syst, const ADGameDescription *gd)
 	_stepUpDistance = 0;
 	_colorNumber = 0;
 
+	_soundIndexShoot = 1;
+	_soundIndexCollide = -1;
+	_soundIndexFall = -1;
+	_soundIndexClimb = -1;
+	_soundIndexMenu = -1;
+	_soundIndexStart = -1;
+	_soundIndexAreaChange = -1;
+	//_soundIndexEndGame = -1;
+	//_soundIndexSensor = -1;
+
 	_fullscreenViewArea = Common::Rect(0, 0, _screenW, _screenH);
 	_viewArea = _fullscreenViewArea;
 	_rnd = new Common::RandomSource("freescape");
diff --git a/engines/freescape/freescape.h b/engines/freescape/freescape.h
index 7ee09a5f2a6..08e1ddc10e9 100644
--- a/engines/freescape/freescape.h
+++ b/engines/freescape/freescape.h
@@ -402,7 +402,13 @@ public:
 
 	void playSoundZX(Common::Array<soundUnitZX> *data);
 	Common::HashMap<uint16, Common::Array<soundUnitZX>*> _soundsSpeakerFxZX;
-	int _nextSoundToPlay = 1;
+	int _soundIndexShoot;
+	int _soundIndexCollide;
+	int _soundIndexFall;
+	int _soundIndexClimb;
+	int _soundIndexMenu;
+	int _soundIndexStart;
+	int _soundIndexAreaChange;
 
 	// Rendering
 	int _screenW, _screenH;
diff --git a/engines/freescape/games/castle/castle.cpp b/engines/freescape/games/castle/castle.cpp
index a390e42ecc3..62cfa3e8c84 100644
--- a/engines/freescape/games/castle/castle.cpp
+++ b/engines/freescape/games/castle/castle.cpp
@@ -62,6 +62,10 @@ CastleEngine::CastleEngine(OSystem *syst, const ADGameDescription *gd) : Freesca
 	_spiritsDestroyed = 0;
 	_spiritsMeter = 32;
 	_spiritsToKill = 26;
+
+	_soundIndexStart = 9;
+	_soundIndexAreaChange = 5;
+
 }
 
 CastleEngine::~CastleEngine() {
@@ -94,9 +98,9 @@ void CastleEngine::gotoArea(uint16 areaID, int entranceID) {
 	if (areaID == _startArea && entranceID == _startEntrance) {
 		_yaw = 310;
 		_pitch = 0;
-		playSound(9, false);
+		playSound(_soundIndexStart, false);
 	} else {
-		playSound(5, false);
+		playSound(_soundIndexAreaChange, false);
 	}
 
 	debugC(1, kFreescapeDebugMove, "starting player position: %f, %f, %f", _position.x(), _position.y(), _position.z());
diff --git a/engines/freescape/games/castle/zx.cpp b/engines/freescape/games/castle/zx.cpp
index da63270f9fc..a932d57d08f 100644
--- a/engines/freescape/games/castle/zx.cpp
+++ b/engines/freescape/games/castle/zx.cpp
@@ -31,6 +31,14 @@ void CastleEngine::initZX() {
 	_viewArea = Common::Rect(64, 36, 256, 148);
 	_yminValue = -1;
 	_ymaxValue = 1;
+
+	_soundIndexShoot = 5;
+	_soundIndexCollide = -1;
+	_soundIndexFall = -1;
+	_soundIndexClimb = -1;
+	_soundIndexMenu = -1;
+	_soundIndexStart = 6;
+	_soundIndexAreaChange = 5;
 }
 
 Graphics::Surface *CastleEngine::loadFramesWithHeader(Common::SeekableReadStream *file, int pos, int numFrames, uint32 back) {
diff --git a/engines/freescape/games/dark/dark.cpp b/engines/freescape/games/dark/dark.cpp
index 8d84338b7c3..b4561a16fab 100644
--- a/engines/freescape/games/dark/dark.cpp
+++ b/engines/freescape/games/dark/dark.cpp
@@ -203,6 +203,15 @@ void DarkEngine::loadAssets() {
 	_noEnergyMessage = _messagesList[16];
 	_fallenMessage = _messagesList[17];
 	_crushedMessage = _messagesList[10];
+
+	// These sounds can be overriden by the class of each platform
+	_soundIndexShoot = 8;
+	_soundIndexCollide = -1;
+	_soundIndexFall = -1;
+	_soundIndexClimb = -1;
+	_soundIndexMenu = -1;
+	_soundIndexStart = -1;
+	_soundIndexAreaChange = -1;
 }
 
 bool DarkEngine::tryDestroyECDFullGame(int index) {
diff --git a/engines/freescape/games/dark/zx.cpp b/engines/freescape/games/dark/zx.cpp
index 547b3182a1f..49a7f6cb1cf 100644
--- a/engines/freescape/games/dark/zx.cpp
+++ b/engines/freescape/games/dark/zx.cpp
@@ -31,6 +31,14 @@ void DarkEngine::initZX() {
 	_viewArea = Common::Rect(56, 28, 265, 132);
 	_maxEnergy = 63;
 	_maxShield = 63;
+
+	_soundIndexShoot = 5;
+	_soundIndexCollide = 2;
+	_soundIndexFall = 3;
+	_soundIndexClimb = -1;
+	_soundIndexMenu = -1;
+	_soundIndexStart = -1;
+	_soundIndexAreaChange = -1;
 }
 
 void DarkEngine::loadAssetsZXFullGame() {
diff --git a/engines/freescape/games/driller/driller.cpp b/engines/freescape/games/driller/driller.cpp
index a38399f0d38..2e0131a2609 100644
--- a/engines/freescape/games/driller/driller.cpp
+++ b/engines/freescape/games/driller/driller.cpp
@@ -92,6 +92,14 @@ DrillerEngine::DrillerEngine(OSystem *syst, const ADGameDescription *gd) : Frees
 
 	_endArea = 127;
 	_endEntrance = 0;
+
+	_soundIndexShoot = 1;
+	_soundIndexCollide = -1;
+	_soundIndexFall = 3;
+	_soundIndexClimb = -1;
+	_soundIndexMenu = -1;
+	_soundIndexStart = -1;
+	_soundIndexAreaChange = -1;
 }
 
 DrillerEngine::~DrillerEngine() {
diff --git a/engines/freescape/games/eclipse/eclipse.cpp b/engines/freescape/games/eclipse/eclipse.cpp
index 38cc8a71ded..2e5dc146425 100644
--- a/engines/freescape/games/eclipse/eclipse.cpp
+++ b/engines/freescape/games/eclipse/eclipse.cpp
@@ -67,6 +67,15 @@ EclipseEngine::EclipseEngine(OSystem *syst, const ADGameDescription *gd) : Frees
 	_lastThirtySeconds = 0;
 	_lastSecond = -1;
 	_resting = false;
+
+	// These sounds can be overriden by the class of each platform
+	_soundIndexShoot = 8;
+	_soundIndexCollide = 3;
+	_soundIndexFall = -1;
+	_soundIndexClimb = -1;
+	_soundIndexMenu = -1;
+	_soundIndexStart = -1;
+	_soundIndexAreaChange = -1;
 }
 
 void EclipseEngine::initGameState() {
diff --git a/engines/freescape/games/eclipse/zx.cpp b/engines/freescape/games/eclipse/zx.cpp
index a1942019650..86e1097b5eb 100644
--- a/engines/freescape/games/eclipse/zx.cpp
+++ b/engines/freescape/games/eclipse/zx.cpp
@@ -31,6 +31,14 @@ void EclipseEngine::initZX() {
 	_viewArea = Common::Rect(56, 36, 265, 139);
 	_maxEnergy = 63;
 	_maxShield = 63;
+
+	_soundIndexShoot = 5;
+	_soundIndexCollide = -1;
+	_soundIndexFall = 3;
+	_soundIndexClimb = -1;
+	_soundIndexMenu = -1;
+	_soundIndexStart = -1;
+	_soundIndexAreaChange = -1;
 }
 
 void EclipseEngine::loadAssetsZXFullGame() {
diff --git a/engines/freescape/movement.cpp b/engines/freescape/movement.cpp
index 15948e204f2..d6f0b5e9561 100644
--- a/engines/freescape/movement.cpp
+++ b/engines/freescape/movement.cpp
@@ -176,18 +176,7 @@ void FreescapeEngine::shoot() {
 	if (_shootingFrames > 0) // No more than one shot at a time
 		return;
 
-	if (isDriller())
-		playSound(1, false);
-	else if (isSpectrum()) {
-		if (isDark())
-			playSound(15, false);
-		else if (isEclipse())
-			playSound(5, false);
-		else
-			playSound(8, false);
-	} else
-		playSound(8, false);
-
+	playSound(_soundIndexShoot, false);
 	g_system->delayMillis(2);
 	_shootingFrames = 10;
 
@@ -398,9 +387,9 @@ void FreescapeEngine::resolveCollisions(Math::Vector3d const position) {
 		if (!executed)
 			setGameBit(31);
 		if (isSpectrum())
-			playSound(10, false);
+			playSound(_soundIndexCollide, false);
 		else
-			playSound(2, false);
+			playSound(_soundIndexCollide, false);
 	}
 
 	lastPosition = newPosition;
@@ -411,12 +400,12 @@ void FreescapeEngine::resolveCollisions(Math::Vector3d const position) {
 	if (fallen > _maxFallingDistance) {
 		_hasFallen = !_disableFalling;
 		_avoidRenderingFrames = 60 * 3;
-		if (isEclipse())
+		if (isEclipse()) // No need for an variable index, since these are special types of sound
 			playSoundFx(0, true);
 	}
 
 	if (!_hasFallen && fallen > 0) {
-		playSound(3, false);
+		playSound(_soundIndexFall, false);
 
 		// Position in Y was changed, let's re-run effects
 		runCollisionConditions(lastPosition, newPosition);
diff --git a/engines/freescape/sound.cpp b/engines/freescape/sound.cpp
index 8d44fff65de..a450506379b 100644
--- a/engines/freescape/sound.cpp
+++ b/engines/freescape/sound.cpp
@@ -293,6 +293,11 @@ void FreescapeEngine::loadSpeakerFxDOS(Common::SeekableReadStream *file, int off
 }
 
 void FreescapeEngine::playSound(int index, bool sync) {
+	if (index < 0) {
+		debugC(1, kFreescapeDebugMedia, "Sound not specified");
+		return;
+	}
+
 	debugC(1, kFreescapeDebugMedia, "Playing sound %d with sync: %d", index, sync);
 	if (isAmiga() || isAtariST()) {
 		playSoundFx(index, sync);
@@ -407,7 +412,7 @@ void FreescapeEngine::playSoundFx(int index, bool sync) {
 		return;
 	}
 
-	if (index >= int(_soundsFx.size())) {
+	if (index < 0 || index >= int(_soundsFx.size())) {
 		debugC(1, kFreescapeDebugMedia, "WARNING: Sound %d not available", index);
 		return;
 	}




More information about the Scummvm-git-logs mailing list