[Scummvm-git-logs] scummvm master -> 452051b18f87ea18edb7675d6bc3e587c4c39ea0

neuromancer noreply at scummvm.org
Sat Oct 26 11:00:25 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:
eb01f34229 FREESCAPE: improved initial config menu for several games
a83522af4a FREESCAPE: avoid crash in castle dos demo
7f3e4e8087 FREESCAPE: v8 initialization in castle for dos
1dadbd51dd FREESCAPE: correctly preserve type of condition when executing
5e8bd1094f FREESCAPE: missing entrance in castle for dos
452051b18f FREESCAPE: various fixes for castle


Commit: eb01f34229f45c518091c8246ff25c86d6da7631
    https://github.com/scummvm/scummvm/commit/eb01f34229f45c518091c8246ff25c86d6da7631
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-10-26T13:00:51+02:00

Commit Message:
FREESCAPE: improved initial config menu for several games

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


diff --git a/engines/freescape/games/castle/castle.cpp b/engines/freescape/games/castle/castle.cpp
index c33706b3048..6376146a8e7 100644
--- a/engines/freescape/games/castle/castle.cpp
+++ b/engines/freescape/games/castle/castle.cpp
@@ -1117,37 +1117,41 @@ void CastleEngine::selectCharacterScreen() {
 	surface->create(_screenW, _screenH, _gfx->_texturePixelFormat);
 	surface->fillRect(_fullscreenViewArea, color);
 
-	if (_language != Common::ES_ESP) {
-		int x = 0;
-		int y = 0;
-
-		Common::Array<RiddleText> selectMessage = _riddleList[21]._lines;
-		for (int i = 0; i < int(selectMessage.size()); i++) {
-			x = x + selectMessage[i]._dx;
-			y = y + selectMessage[i]._dy;
-			drawStringInSurface(selectMessage[i]._text, x, y, color, color, surface);
-		}
-		drawFullscreenSurface(surface);
-	} else {
-		// No accent in "príncipe" since it is not supported by the font
-		if (isDOS()) {
-			lines.push_back("Elija su personaje");
-			lines.push_back("");
-			lines.push_back("");
-			lines.push_back("            1. Principe");
-			lines.push_back("            2. Princesa");
-		} else if (isSpectrum()) {
+	if (isSpectrum()) {
+		if (_language == Common::ES_ESP) {
+			// No accent in "príncipe" since it is not supported by the font
 			lines.push_back(centerAndPadString("*******************", 21));
 			lines.push_back(centerAndPadString("Seleccion el ", 21));
 			lines.push_back(centerAndPadString("personaje que quiera", 21));
-			lines.push_back(centerAndPadString("ser y precione enter", 21));
+			lines.push_back(centerAndPadString("ser y pulse enter", 21));
 			lines.push_back("");
 			lines.push_back(centerAndPadString("1. Principe", 21));
 			lines.push_back(centerAndPadString("2. Princesa", 21));
 			lines.push_back("");
 			lines.push_back(centerAndPadString("*******************", 21));
+		} else {
+			lines.push_back(centerAndPadString("*******************", 21));
+			lines.push_back(centerAndPadString("Select the character", 21));
+			lines.push_back(centerAndPadString("you wish to play", 21));
+			lines.push_back(centerAndPadString("and press enter", 21));
+			lines.push_back("");
+			lines.push_back(centerAndPadString("1. Prince  ", 21));
+			lines.push_back(centerAndPadString("2. Princess", 21));
+			lines.push_back("");
+			lines.push_back(centerAndPadString("*******************", 21));
 		}
 		drawStringsInSurface(lines, surface);
+	} else {
+		int x = 0;
+		int y = 0;
+
+		Common::Array<RiddleText> selectMessage = _riddleList[21]._lines;
+		for (int i = 0; i < int(selectMessage.size()); i++) {
+			x = x + selectMessage[i]._dx;
+			y = y + selectMessage[i]._dy;
+			drawStringInSurface(selectMessage[i]._text, x, y, color, color, surface);
+		}
+		drawFullscreenSurface(surface);
 	}
 
 	_system->lockMouse(false);
diff --git a/engines/freescape/ui.cpp b/engines/freescape/ui.cpp
index c7dcb6cc69e..4fffd2305eb 100644
--- a/engines/freescape/ui.cpp
+++ b/engines/freescape/ui.cpp
@@ -191,30 +191,48 @@ void FreescapeEngine::borderScreen() {
 	if (isDOS() || isSpectrum()) {
 		Common::Array<Common::String> lines;
 		int pad = 25;
-		if (isSpectrum() && isCastle())
-			pad = 22;
-		else if (isDOS() && !isCastle())
-			pad = 30;
+		if (isDOS()) {
+			if (isDOS() && !isCastle())
+				pad = 30;
 
-		if (isDOS())
 			lines.push_back(centerAndPadString("CONFIGURATION MENU", pad));
-		else
-			lines.push_back(centerAndPadString("CONTROL OPTIONS", pad));
-		lines.push_back("");
-		lines.push_back(centerAndPadString("1: KEYBOARD ONLY   ", pad));
-		lines.push_back(centerAndPadString("2: IBM JOYSTICK    ", pad));
-		lines.push_back(centerAndPadString("3: AMSTRAD JOYSTICK", pad));
-		lines.push_back("");
-		lines.push_back("");
-		if (isDOS())
+			lines.push_back("");
+			lines.push_back(centerAndPadString("1: KEYBOARD ONLY   ", pad));
+			lines.push_back(centerAndPadString("2: IBM JOYSTICK    ", pad));
+			lines.push_back(centerAndPadString("3: AMSTRAD JOYSTICK", pad));
+			lines.push_back("");
+			lines.push_back("");
 			lines.push_back(centerAndPadString("SPACEBAR:  BEGIN MISSION", pad));
-		else
-			lines.push_back(centerAndPadString("ENTER: BEGIN MISSION", pad));
-		lines.push_back("");
-		if (isDOS())
 			lines.push_back(centerAndPadString("COPYRIGHT 1988 INCENTIVE", pad));
-		else
-			lines.push_back(centerAndPadString("(c) 1988 INCENTIVE", pad));
+		} else if (isSpectrum()) {
+			if (isSpectrum() && isCastle())
+				pad = 22;
+
+			if (_language == Common::ES_ESP) {
+				assert(isCastle());
+				lines.push_back(centerAndPadString("MENU DE OPCIONES", pad));
+				lines.push_back("");
+				lines.push_back(centerAndPadString("1 TECLADO          ", pad));
+				lines.push_back(centerAndPadString("2 JOYSTICK SINCLAIR", pad));
+				lines.push_back(centerAndPadString("3 JOYSTICK KEMSTON ", pad));
+				lines.push_back(centerAndPadString("4 JOYSTICK CURSOR  ", pad));
+				lines.push_back("");
+				lines.push_back(centerAndPadString("ENTER: EMPEZAR MISION", pad));
+				lines.push_back(centerAndPadString("(c) 1990 INCENTIVE", pad));
+			} else {
+				lines.push_back(centerAndPadString("CONTROL OPTIONS", pad));
+				lines.push_back("");
+				lines.push_back(centerAndPadString("1 KEYBOARD         ", pad));
+				lines.push_back(centerAndPadString("2 SINCLAIR JOYSTICK", pad));
+				lines.push_back(centerAndPadString("3 KEMSTON JOYSTICK ", pad));
+				lines.push_back(centerAndPadString("4 CURSOR JOYSTICK  ", pad));
+				lines.push_back("");
+				lines.push_back(centerAndPadString("ENTER: BEGIN MISSION", pad));
+				if (!isCastle())
+					lines.push_back("");;
+				lines.push_back(centerAndPadString("(c) 1990 INCENTIVE", pad));
+			}
+		}
 
 		lines.push_back("");
 


Commit: a83522af4a13985a0e576368e7d730484e9f5dec
    https://github.com/scummvm/scummvm/commit/a83522af4a13985a0e576368e7d730484e9f5dec
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-10-26T13:00:51+02:00

Commit Message:
FREESCAPE: avoid crash in castle dos demo

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


diff --git a/engines/freescape/games/castle/dos.cpp b/engines/freescape/games/castle/dos.cpp
index d333dd8832a..23512b51d81 100644
--- a/engines/freescape/games/castle/dos.cpp
+++ b/engines/freescape/games/castle/dos.cpp
@@ -421,7 +421,7 @@ void CastleEngine::loadAssetsDOSDemo() {
 
 		stream = decryptFile("CMLD"); // Only english
 		loadMessagesVariableSize(stream, 0x11, 164);
-		loadRiddles(stream, 0xaae - 2 - 21 * 2, 21);
+		loadRiddles(stream, 0xaae - 2 - 22 * 2, 22);
 		delete stream;
 
 		stream = decryptFile("CDEDF");


Commit: 7f3e4e8087cab43c0382342a6b51ad676a028da5
    https://github.com/scummvm/scummvm/commit/7f3e4e8087cab43c0382342a6b51ad676a028da5
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-10-26T13:00:51+02:00

Commit Message:
FREESCAPE: v8 initialization in castle for dos

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


diff --git a/engines/freescape/games/castle/castle.cpp b/engines/freescape/games/castle/castle.cpp
index 6376146a8e7..f01f8c31c7a 100644
--- a/engines/freescape/games/castle/castle.cpp
+++ b/engines/freescape/games/castle/castle.cpp
@@ -355,6 +355,7 @@ void CastleEngine::initGameState() {
 
 	_gameStateVars[k8bitVariableShield] = 20;
 	_gameStateVars[k8bitVariableEnergy] = 1;
+	_gameStateVars[8] = 128; // -1
 	_countdown = INT_MAX;
 	_keysCollected.clear();
 	_spiritsDestroyed = 0;
diff --git a/engines/freescape/language/instruction.cpp b/engines/freescape/language/instruction.cpp
index acd469d9488..deb67423971 100644
--- a/engines/freescape/language/instruction.cpp
+++ b/engines/freescape/language/instruction.cpp
@@ -468,17 +468,21 @@ bool FreescapeEngine::checkConditional(FCLInstruction &instruction, bool shot, b
 }
 
 bool FreescapeEngine::checkIfGreaterOrEqual(FCLInstruction &instruction) {
+	assert(instruction._destination <= 128);
+
 	uint16 variable = instruction._source;
-	uint16 value = instruction._destination;
+	int8 value = instruction._destination;
 	debugC(1, kFreescapeDebugCode, "Check if variable %d is greater than equal to %d!", variable, value);
-	return (_gameStateVars[variable] >= value);
+	return ((int8)_gameStateVars[variable] >= value);
 }
 
 bool FreescapeEngine::checkIfLessOrEqual(FCLInstruction &instruction) {
+	assert(instruction._destination <= 128);
+
 	uint16 variable = instruction._source;
-	uint16 value = instruction._destination;
+	int8 value = instruction._destination;
 	debugC(1, kFreescapeDebugCode, "Check if variable %d is less than equal to %d!", variable, value);
-	return (_gameStateVars[variable] <= value);
+	return ((int8)_gameStateVars[variable] <= value);
 }
 
 


Commit: 1dadbd51ddb3cb58cc02573df105570117fc7168
    https://github.com/scummvm/scummvm/commit/1dadbd51ddb3cb58cc02573df105570117fc7168
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-10-26T13:00:51+02:00

Commit Message:
FREESCAPE: correctly preserve type of condition when executing

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


diff --git a/engines/freescape/freescape.h b/engines/freescape/freescape.h
index 49c194afa99..a033dc3da63 100644
--- a/engines/freescape/freescape.h
+++ b/engines/freescape/freescape.h
@@ -395,7 +395,7 @@ public:
 	bool checkConditional(FCLInstruction &instruction, bool shot, bool collided, bool timer, bool activated);
 	bool checkIfGreaterOrEqual(FCLInstruction &instruction);
 	bool checkIfLessOrEqual(FCLInstruction &instruction);
-	void executeExecute(FCLInstruction &instruction);
+	void executeExecute(FCLInstruction &instruction, bool shot, bool collided, bool activated);
 	void executeIncrementVariable(FCLInstruction &instruction);
 	void executeDecrementVariable(FCLInstruction &instruction);
 	void executeSetVariable(FCLInstruction &instruction);
diff --git a/engines/freescape/language/instruction.cpp b/engines/freescape/language/instruction.cpp
index deb67423971..a9968e6dab7 100644
--- a/engines/freescape/language/instruction.cpp
+++ b/engines/freescape/language/instruction.cpp
@@ -261,7 +261,7 @@ bool FreescapeEngine::executeCode(FCLInstructionVector &code, bool shot, bool co
 			executeRedraw(instruction);
 			break;
 		case Token::EXECUTE:
-			executeExecute(instruction);
+			executeExecute(instruction, shot, collided, activated);
 			ip = codeSize;
 			break;
 		case Token::DELAY:
@@ -326,7 +326,7 @@ void FreescapeEngine::executeRedraw(FCLInstruction &instruction) {
 	}
 }
 
-void FreescapeEngine::executeExecute(FCLInstruction &instruction) {
+void FreescapeEngine::executeExecute(FCLInstruction &instruction, bool shot, bool collided, bool activated) {
 	uint16 objId = instruction._source;
 	debugC(1, kFreescapeDebugCode, "Executing instructions from object %d", objId);
 	Object *obj = _currentArea->objectWithID(objId);
@@ -339,7 +339,7 @@ void FreescapeEngine::executeExecute(FCLInstruction &instruction) {
 			return;
 		}
 	}
-	executeObjectConditions((GeometricObject *)obj, true, false, false);
+	executeObjectConditions((GeometricObject *)obj, shot, collided, activated);
 }
 
 void FreescapeEngine::executeSound(FCLInstruction &instruction) {


Commit: 5e8bd1094fdb9d1930e142002343d3e7c02f2302
    https://github.com/scummvm/scummvm/commit/5e8bd1094fdb9d1930e142002343d3e7c02f2302
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-10-26T13:00:51+02:00

Commit Message:
FREESCAPE: missing entrance in castle for dos

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


diff --git a/engines/freescape/games/castle/castle.cpp b/engines/freescape/games/castle/castle.cpp
index f01f8c31c7a..a8c2f949ac7 100644
--- a/engines/freescape/games/castle/castle.cpp
+++ b/engines/freescape/games/castle/castle.cpp
@@ -682,6 +682,7 @@ void CastleEngine::loadAssets() {
 	if (isDOS()) {
 		for (auto &it : _areaMap) {
 			it._value->addStructure(_areaMap[255]);
+			it._value->addObjectFromArea(227, _areaMap[255]);
 			it._value->addObjectFromArea(229, _areaMap[255]);
 			it._value->addObjectFromArea(242, _areaMap[255]);
 			it._value->addObjectFromArea(139, _areaMap[255]);


Commit: 452051b18f87ea18edb7675d6bc3e587c4c39ea0
    https://github.com/scummvm/scummvm/commit/452051b18f87ea18edb7675d6bc3e587c4c39ea0
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-10-26T13:00:51+02:00

Commit Message:
FREESCAPE: various fixes for castle

Changed paths:
    engines/freescape/games/castle/castle.cpp
    engines/freescape/games/castle/castle.h
    engines/freescape/language/8bitDetokeniser.cpp
    engines/freescape/language/8bitDetokeniser.h
    engines/freescape/language/instruction.cpp


diff --git a/engines/freescape/games/castle/castle.cpp b/engines/freescape/games/castle/castle.cpp
index a8c2f949ac7..7a03e8a3c3a 100644
--- a/engines/freescape/games/castle/castle.cpp
+++ b/engines/freescape/games/castle/castle.cpp
@@ -86,7 +86,6 @@ CastleEngine::CastleEngine(OSystem *syst, const ADGameDescription *gd) : Freesca
 	_menuFxOnIndicator = nullptr;
 	_menuFxOffIndicator = nullptr;
 
-	_spiritsDestroyed = 0;
 	_spiritsMeter = 32;
 	_spiritsToKill = 26;
 }
@@ -358,7 +357,6 @@ void CastleEngine::initGameState() {
 	_gameStateVars[8] = 128; // -1
 	_countdown = INT_MAX;
 	_keysCollected.clear();
-	_spiritsDestroyed = 0;
 	_spiritsMeter = 32;
 	_spiritsMeterMax = 64;
 
@@ -446,6 +444,7 @@ void CastleEngine::drawInfoMenu() {
 
 	int score = _gameStateVars[k8bitVariableScore];
 	int shield = _gameStateVars[k8bitVariableShield];
+	int spiritsDestroyed = _gameStateVars[k8bitVariableSpiritsDestroyed];
 	if (isDOS()) {
 		g_system->lockMouse(false);
 		g_system->showMouse(true);
@@ -460,9 +459,9 @@ void CastleEngine::drawInfoMenu() {
 		Common::replace(keysCollected, "X", Common::String::format("%d", _keysCollected.size()));
 		drawStringInSurface(keysCollected, 103, 41,  front, black, surface);
 
-		Common::String spiritsDestroyed = _messagesList[133];
-		Common::replace(spiritsDestroyed, "X", Common::String::format("%d", _spiritsDestroyed));
-		drawStringInSurface(spiritsDestroyed, 145 , 132,  front, black, surface);
+		Common::String spiritsDestroyedString = _messagesList[133];
+		Common::replace(spiritsDestroyedString, "X", Common::String::format("%d", spiritsDestroyed));
+		drawStringInSurface(spiritsDestroyedString, 145 , 132,  front, black, surface);
 
 		for (int  i = 0; i < int(_keysCollected.size()) ; i++) {
 			if (i % 2 == 0)
@@ -478,14 +477,14 @@ void CastleEngine::drawInfoMenu() {
 			lines.push_back(centerAndPadString("s-save l-load q-quit", 21));
 			lines.push_back("");
 			lines.push_back(centerAndPadString(Common::String::format("keys   %d collected", _keysCollected.size()), 21));
-			lines.push_back(centerAndPadString(Common::String::format("spirits  %d destroyed", _spiritsDestroyed), 21));
+			lines.push_back(centerAndPadString(Common::String::format("spirits  %d destroyed", spiritsDestroyed), 21));
 			lines.push_back(centerAndPadString(Common::String::format("strength  %s", _messagesList[62 + shield / 6].c_str()), 21));
 			lines.push_back(centerAndPadString(Common::String::format("score   %07d", score), 21));
 		} else if (_language == Common::ES_ESP) {
 			lines.push_back(centerAndPadString("s-salv c-carg q-quit", 21));
 			lines.push_back("");
 			lines.push_back(centerAndPadString(Common::String::format("llaves %d recogidas", _keysCollected.size()), 21));
-			lines.push_back(centerAndPadString(Common::String::format("espirit %d destruidos", _spiritsDestroyed), 21));
+			lines.push_back(centerAndPadString(Common::String::format("espirit %d destruidos", spiritsDestroyed), 21));
 			lines.push_back(centerAndPadString(Common::String::format("fuerza  %s", _messagesList[62 + shield / 6].c_str()), 21));
 			lines.push_back(centerAndPadString(Common::String::format("puntos   %07d", score), 21));
 		} else {
@@ -600,36 +599,6 @@ void CastleEngine::drawInfoMenu() {
 	g_system->showMouse(false);
 }
 
-// Same as FreescapeEngine::executeExecute but updates the spirits destroyed counter
-void CastleEngine::executeMakeInvisible(FCLInstruction &instruction) {
-	uint16 objectID = 0;
-	uint16 areaID = _currentArea->getAreaID();
-
-	if (instruction._destination > 0) {
-		objectID = instruction._destination;
-		areaID = instruction._source;
-	} else {
-		objectID = instruction._source;
-	}
-
-	debugC(1, kFreescapeDebugCode, "Making obj %d invisible in area %d!", objectID, areaID);
-	if (_areaMap.contains(areaID)) {
-		Object *obj = _areaMap[areaID]->objectWithID(objectID);
-		if (!obj && isCastle())
-			return; // No side effects
-		assert(obj); // We assume the object was there
-
-		if (!obj->isInvisible() && obj->getType() == kSensorType && isCastle()) {
-			_spiritsDestroyed++;
-		}
-
-		obj->makeInvisible();
-	} else {
-		assert(isDOS() && isDemo()); // Should only happen in the DOS demo
-	}
-
-}
-
 // Same as FreescapeEngine::executeExecute but updates the spirits destroyed counter
 void CastleEngine::executeDestroy(FCLInstruction &instruction) {
 	uint16 objectID = 0;
@@ -648,7 +617,6 @@ void CastleEngine::executeDestroy(FCLInstruction &instruction) {
 	assert(obj); // We know that an object should be there
 
 	if (!obj->isDestroyed() && obj->getType() == kSensorType && isCastle()) {
-		_spiritsDestroyed++;
 		_shootingFrames = 0;
 		_gfx->_inkColor = _currentArea->_inkColor;
 		_gfx->_shakeOffset = Common::Point();
@@ -1053,9 +1021,10 @@ void CastleEngine::updateTimeVariables() {
 	int seconds, minutes, hours;
 	getTimeFromCountdown(seconds, minutes, hours);
 	if (_lastMinute != minutes / 2) {
+		int spiritsDestroyed = _gameStateVars[k8bitVariableSpiritsDestroyed];
 		_lastMinute = minutes / 2;
 		_spiritsMeter++;
-		_spiritsMeterPosition = _spiritsMeter * (_spiritsToKill - _spiritsDestroyed) / _spiritsToKill;
+		_spiritsMeterPosition = _spiritsMeter * (_spiritsToKill - spiritsDestroyed) / _spiritsToKill;
 		if (_spiritsMeterPosition >= _spiritsMeterMax)
 			_countdown = -1;
 	}
@@ -1230,7 +1199,6 @@ Common::Error CastleEngine::saveGameStreamExtended(Common::WriteStream *stream,
 	}
 
 	stream->writeUint32LE(_spiritsMeter);
-	stream->writeUint32LE(_spiritsDestroyed);
 
 	for (auto &it : _areaMap) {
 		stream->writeUint16LE(it._key);
@@ -1248,7 +1216,6 @@ Common::Error CastleEngine::loadGameStreamExtended(Common::SeekableReadStream *s
 	}
 
 	_spiritsMeter = stream->readUint32LE();
-	_spiritsDestroyed = stream->readUint32LE();
 
 	for (uint i = 0; i < _areaMap.size(); i++) {
 		uint16 key = stream->readUint16LE();
diff --git a/engines/freescape/games/castle/castle.h b/engines/freescape/games/castle/castle.h
index d7e2c9f5bc6..b03214bcf4a 100644
--- a/engines/freescape/games/castle/castle.h
+++ b/engines/freescape/games/castle/castle.h
@@ -77,7 +77,6 @@ public:
 	void drawSensorShoot(Sensor *sensor) override;
 
 	void executePrint(FCLInstruction &instruction) override;
-	void executeMakeInvisible(FCLInstruction &instruction) override;
 	void executeDestroy(FCLInstruction &instruction) override;
 	void executeRedraw(FCLInstruction &instruction) override;
 	void gotoArea(uint16 areaID, int entranceID) override;
@@ -120,7 +119,6 @@ public:
 
 	Common::Array<int> _keysCollected;
 	bool _useRockTravel;
-	int _spiritsDestroyed;
 	int _spiritsMeter;
 	int _spiritsMeterPosition;
 	int _spiritsMeterMax;
diff --git a/engines/freescape/language/8bitDetokeniser.cpp b/engines/freescape/language/8bitDetokeniser.cpp
index 19f512d48c7..86143bf9f8d 100644
--- a/engines/freescape/language/8bitDetokeniser.cpp
+++ b/engines/freescape/language/8bitDetokeniser.cpp
@@ -81,6 +81,7 @@ Common::String detokenise8bitCondition(Common::Array<uint16> &tokenisedCondition
 
 			if (bytePointer > 0) {
 				detokenisedStream += "ENDIF\n";
+				assert(conditionalInstructions->size() > 0);
 				// Allocate the next vector of instructions
 				conditionalInstructions = new FCLInstructionVector();
 			}
@@ -470,6 +471,9 @@ Common::String detokenise8bitCondition(Common::Array<uint16> &tokenisedCondition
 		detokenisedStream += "\n";
 	}
 
+	// This fails in Castle Master
+	//assert(conditionalInstructions->size() > 0);
+
 	return detokenisedStream;
 }
 
diff --git a/engines/freescape/language/8bitDetokeniser.h b/engines/freescape/language/8bitDetokeniser.h
index f69e6527ac9..c04f4b90116 100644
--- a/engines/freescape/language/8bitDetokeniser.h
+++ b/engines/freescape/language/8bitDetokeniser.h
@@ -28,6 +28,7 @@ namespace Freescape {
 
 enum {
 	k8bitGameBitTravelRock = 30,
+	k8bitVariableSpiritsDestroyed = 28,
 	k8bitVariableEnergy = 62,
 	k8bitVariableScore = 61,
 	k8bitVariableShieldDrillerTank = 60,
diff --git a/engines/freescape/language/instruction.cpp b/engines/freescape/language/instruction.cpp
index a9968e6dab7..7b4ffe8c6c8 100644
--- a/engines/freescape/language/instruction.cpp
+++ b/engines/freescape/language/instruction.cpp
@@ -150,7 +150,13 @@ bool FreescapeEngine::executeCode(FCLInstructionVector &code, bool shot, bool co
 	int conditionalDepth = 0;
 	bool executed = false;
 	int codeSize = code.size();
-	assert(codeSize > 0);
+
+	if (codeSize == 0) {
+		assert(isCastle()); // Only seems to happen in Castle Master (magister room)
+		debugC(1, kFreescapeDebugCode, "Code is empty!");
+		return false;
+	}
+
 	while (ip <= codeSize - 1) {
 		FCLInstruction &instruction = code[ip];
 		debugC(1, kFreescapeDebugCode, "Executing ip: %d with type %d in code with size: %d. Skip flag is: %d", ip, instruction.getType(), codeSize, skip);
@@ -562,9 +568,6 @@ void FreescapeEngine::executeDestroy(FCLInstruction &instruction) {
 }
 
 void FreescapeEngine::executeMakeInvisible(FCLInstruction &instruction) {
-	// Castle uses their own implementation which is hard to
-	// integrate with this code without duplicating most of it
-	assert(!isCastle());
 	uint16 objectID = 0;
 	uint16 areaID = _currentArea->getAreaID();
 




More information about the Scummvm-git-logs mailing list