[Scummvm-git-logs] scummvm master -> 48704f55600667d86e4f478686c96fbf2196b7a1
neuromancer
noreply at scummvm.org
Wed Oct 8 17:04:32 UTC 2025
This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .
Summary:
c4f94638f6 FREESCAPE: restore falling damange in castle (and sounds for it)
866f5b5989 FREESCAPE: a few small fixes for castle (dos)
48704f5560 FREESCAPE: added missing instruction for castle (dos)
Commit: c4f94638f68faae933121354e3072bd951cfdf90
https://github.com/scummvm/scummvm/commit/c4f94638f68faae933121354e3072bd951cfdf90
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2025-10-08T14:04:07-03:00
Commit Message:
FREESCAPE: restore falling damange in castle (and sounds for it)
Changed paths:
engines/freescape/games/castle/castle.cpp
engines/freescape/games/castle/castle.h
engines/freescape/games/castle/zx.cpp
engines/freescape/movement.cpp
diff --git a/engines/freescape/games/castle/castle.cpp b/engines/freescape/games/castle/castle.cpp
index a50e73a31c4..0dbc49113c7 100644
--- a/engines/freescape/games/castle/castle.cpp
+++ b/engines/freescape/games/castle/castle.cpp
@@ -44,6 +44,7 @@ CastleEngine::CastleEngine(OSystem *syst, const ADGameDescription *gd) : Freesca
_soundIndexCollide = 4;
_soundIndexStepUp = 5;
_soundIndexStepDown = 6;
+ _soundIndexStartFalling = -1;
k8bitVariableShield = 29;
@@ -69,7 +70,6 @@ CastleEngine::CastleEngine(OSystem *syst, const ADGameDescription *gd) : Freesca
_playerWidth = 8;
_playerDepth = 8;
_stepUpDistance = 32;
- _maxFallingDistance = 8192;
_maxShield = 24;
_option = nullptr;
@@ -338,6 +338,7 @@ void CastleEngine::gotoArea(uint16 areaID, int entranceID) {
assert(_areaMap.contains(areaID));
_currentArea = _areaMap[areaID];
_currentArea->show();
+ _maxFallingDistance = MAX(32, _currentArea->getScale() * 16 - 2);
if (entranceID > 0)
traverseEntrance(entranceID);
@@ -449,8 +450,22 @@ void CastleEngine::initGameState() {
}
bool CastleEngine::checkIfGameEnded() {
- if (_gameStateControl != kFreescapeGameStatePlaying)
- return false;
+ if (_gameStateControl == kFreescapeGameStatePlaying) {
+ if (_hasFallen && _avoidRenderingFrames == 0) {
+ _hasFallen = false;
+ playSound(_soundIndexFallen, false, _soundFxHandle);
+
+ stopMovement();
+ // If shield is less than 11 after a fall, the game ends
+ if (_gameStateVars[k8bitVariableShield] > 5) {
+ _gameStateVars[k8bitVariableShield] -= 5;
+ return false; // Game can continue
+ }
+ if (!_fallenMessage.empty())
+ insertTemporaryMessage(_fallenMessage, _countdown - 4);
+ _gameStateControl = kFreescapeGameStateEnd;
+ }
+ }
if (getGameBit(31) || _currentArea->getAreaID() == 74) { // Escaped!
_gameStateControl = kFreescapeGameStateEnd;
@@ -1681,7 +1696,7 @@ void CastleEngine::drawBackground() {
clearBackground();
_gfx->drawBackground(_currentArea->_skyColor);
- if (_currentArea->isOutside()) {
+ if (_avoidRenderingFrames == 0 && _currentArea->isOutside()) {
if (_background) {
if (!_skyTexture)
_skyTexture = _gfx->createTexture(_background->surfacePtr(), true);
diff --git a/engines/freescape/games/castle/castle.h b/engines/freescape/games/castle/castle.h
index b5bccfc23f3..b106860e3ad 100644
--- a/engines/freescape/games/castle/castle.h
+++ b/engines/freescape/games/castle/castle.h
@@ -136,6 +136,7 @@ public:
int _spiritsToKill;
int _lastTenSeconds;
+ int _soundIndexStartFalling;
private:
Common::SeekableReadStream *decryptFile(const Common::Path &filename);
diff --git a/engines/freescape/games/castle/zx.cpp b/engines/freescape/games/castle/zx.cpp
index f4cfe5ab533..e6a81d6a202 100644
--- a/engines/freescape/games/castle/zx.cpp
+++ b/engines/freescape/games/castle/zx.cpp
@@ -31,7 +31,9 @@ void CastleEngine::initZX() {
_viewArea = Common::Rect(64, 36, 256, 148);
_soundIndexShoot = 5;
_soundIndexCollide = 3;
- _soundIndexFallen = 6;
+ _soundIndexStartFalling = -1;
+ _soundIndexFallen = 1;
+ _soundIndexFall = 6;
_soundIndexStepUp = 12;
_soundIndexStepDown = 12;
_soundIndexMenu = 3;
diff --git a/engines/freescape/movement.cpp b/engines/freescape/movement.cpp
index 0f18e1a09bb..d036aed48b4 100644
--- a/engines/freescape/movement.cpp
+++ b/engines/freescape/movement.cpp
@@ -576,15 +576,15 @@ void FreescapeEngine::resolveCollisions(Math::Vector3d const position) {
}
if (isSteppingUp) {
- debug("Stepping up sound!");
+ //debug("Stepping up sound!");
if (!_mixer->isSoundHandleActive(_movementSoundHandle))
playSound(_soundIndexStepUp, false, _movementSoundHandle);
} else if (isSteppingDown) {
- debug("Stepping down sound!");
+ //debug("Stepping down sound!");
if (!_mixer->isSoundHandleActive(_movementSoundHandle))
playSound(_soundIndexStepDown, false, _movementSoundHandle);
} else if (isCollidingWithWall) {
- debug("Colliding with wall sound!");
+ //debug("Colliding with wall sound!");
if (!_mixer->isSoundHandleActive(_movementSoundHandle))
playSound(_soundIndexCollide, false, _movementSoundHandle);
}
Commit: 866f5b5989f0a6c74de6db8a027832be056e2b79
https://github.com/scummvm/scummvm/commit/866f5b5989f0a6c74de6db8a027832be056e2b79
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2025-10-08T14:04:07-03:00
Commit Message:
FREESCAPE: a few small fixes 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 0dbc49113c7..b0a69e8755f 100644
--- a/engines/freescape/games/castle/castle.cpp
+++ b/engines/freescape/games/castle/castle.cpp
@@ -23,6 +23,7 @@
#include "common/memstream.h"
#include "common/config-manager.h"
#include "common/random.h"
+#include "graphics/cursorman.h"
#include "backends/keymapper/action.h"
#include "backends/keymapper/keymap.h"
@@ -570,8 +571,8 @@ void CastleEngine::drawInfoMenu() {
Common::Array<Common::Rect> keyRects;
if (isDOS()) {
- g_system->lockMouse(false);
- g_system->showMouse(true);
+ CursorMan.setDefaultArrowCursor();
+ CursorMan.showMouse(true);
surface->copyRectToSurface(*_menu, 47, 35, Common::Rect(0, 0, _menu->w, _menu->h));
_gfx->readFromPalette(10, r, g, b);
@@ -752,8 +753,7 @@ void CastleEngine::drawInfoMenu() {
delete menuTexture;
pauseToken.clear();
- g_system->lockMouse(true);
- g_system->showMouse(false);
+ CursorMan.showMouse(false);
}
void CastleEngine::drawFullscreenEndGameAndWait() {
@@ -1702,8 +1702,9 @@ void CastleEngine::drawBackground() {
_skyTexture = _gfx->createTexture(_background->surfacePtr(), true);
_gfx->drawSkybox(_skyTexture, _position);
if (_thunderTextures.empty()) {
- _thunderTextures.push_back(_gfx->createTexture(_thunderFrames[0]->surfacePtr(), true));
- _thunderTextures.push_back(_gfx->createTexture(_thunderFrames[1]->surfacePtr(), true));
+ for (auto &it : _thunderFrames ) {
+ _thunderTextures.push_back(_gfx->createTexture(it->surfacePtr(), true));
+ }
}
updateThunder();
}
@@ -1718,7 +1719,7 @@ void CastleEngine::updateThunder() {
//debug("Thunder frame duration: %d", _thunderFrameDuration);
//debug("Size: %f", 2 * _thunderOffset.length());
//debug("Offset: %.1f, %.1f, %.1f", _thunderOffset.x(), _thunderOffset.y(), _thunderOffset.z());
- _gfx->drawThunder(_thunderTextures[(_thunderFrameDuration - 1) / 5], _position + _thunderOffset, 100);
+ _gfx->drawThunder(_thunderTextures[0], _position + _thunderOffset, 100);
_thunderFrameDuration--;
if (_thunderFrameDuration == 0)
if (isSpectrum())
@@ -1736,9 +1737,9 @@ void CastleEngine::updateThunder() {
// Schedule next thunder, between 10 and 10 + 10 seconds
_thunderTicks = 50 * (10 + _rnd->getRandomNumber(10));
_thunderOffset = Math::Vector3d();
- _thunderOffset.x() += (int(_rnd->getRandomNumber(100)) + 100);
+ _thunderOffset.x() += (int(_rnd->getRandomNumber(100)) + 300);
_thunderOffset.y() += int(_rnd->getRandomNumber(100)) + 50.0f;
- _thunderOffset.z() += (int(_rnd->getRandomNumber(100)) + 100);
+ _thunderOffset.z() += (int(_rnd->getRandomNumber(100)) + 300);
}
}
diff --git a/engines/freescape/games/castle/dos.cpp b/engines/freescape/games/castle/dos.cpp
index f355f090456..6d717b0adb1 100644
--- a/engines/freescape/games/castle/dos.cpp
+++ b/engines/freescape/games/castle/dos.cpp
@@ -222,6 +222,9 @@ void CastleEngine::loadAssetsDOSFullGame() {
_riddleBottomFrame = loadFrameWithHeaderDOS(stream);
_endGameThroneFrame = loadFrameWithHeaderDOS(stream);
// No header
+ Graphics::ManagedSurface *thunderFrame = loadFrameFromPlanes(stream, 32, 128);
+ thunderFrame->convertToInPlace(_gfx->_texturePixelFormat, (byte *)&kEGADefaultPalette, 16);
+ _thunderFrames.push_back(thunderFrame);
stream->seek(0x29696);
Common::Array<Graphics::ManagedSurface *> chars;
@@ -243,9 +246,6 @@ void CastleEngine::loadAssetsDOSFullGame() {
_fontRiddle = Font(charsRiddle);
_fontRiddle.setCharWidth(9);
_fontLoaded = true;
-
- // No header
- // Another thunder frame?
}
delete stream;
@@ -366,6 +366,10 @@ void CastleEngine::loadAssetsDOSDemo() {
_riddleBottomFrame = loadFrameWithHeaderDOS(stream);
_endGameThroneFrame = loadFrameWithHeaderDOS(stream);
// No header
+ Graphics::ManagedSurface *thunderFrame = loadFrameFromPlanes(stream, 32, 128);
+ thunderFrame->convertToInPlace(_gfx->_texturePixelFormat, (byte *)&kEGADefaultPalette, 16);
+ _thunderFrames.push_back(thunderFrame);
+
stream->seek(0x293f6); // TODO: check this
Common::Array<Graphics::ManagedSurface *> chars;
Common::Array<Graphics::ManagedSurface *> charsRiddle;
Commit: 48704f55600667d86e4f478686c96fbf2196b7a1
https://github.com/scummvm/scummvm/commit/48704f55600667d86e4f478686c96fbf2196b7a1
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2025-10-08T14:04:08-03:00
Commit Message:
FREESCAPE: added missing instruction for castle (dos)
Changed paths:
engines/freescape/language/8bitDetokeniser.cpp
engines/freescape/language/instruction.cpp
diff --git a/engines/freescape/language/8bitDetokeniser.cpp b/engines/freescape/language/8bitDetokeniser.cpp
index 4ad725f38b9..c9cec3af1d1 100644
--- a/engines/freescape/language/8bitDetokeniser.cpp
+++ b/engines/freescape/language/8bitDetokeniser.cpp
@@ -330,6 +330,10 @@ Common::String detokenise8bitCondition(Common::Array<uint16> &tokenisedCondition
case 42: // Not sure about this one
detokenisedStream += "AGAIN";
currentInstruction = FCLInstruction(Token::AGAIN);
+ conditionalInstructions->push_back(currentInstruction);
+ currentInstruction = FCLInstruction(Token::UNKNOWN);
+ bytePointer++;
+ numberOfArguments = 0;
break;
case 12:
diff --git a/engines/freescape/language/instruction.cpp b/engines/freescape/language/instruction.cpp
index 034cfeaccba..2c03944ee35 100644
--- a/engines/freescape/language/instruction.cpp
+++ b/engines/freescape/language/instruction.cpp
@@ -152,6 +152,8 @@ bool FreescapeEngine::executeCode(FCLInstructionVector &code, bool shot, bool co
int skipDepth = 0;
int conditionalDepth = 0;
bool executed = false;
+ int loopIterations = 0;
+ int loopHead = -1;
int codeSize = code.size();
if (codeSize == 0) {
@@ -200,6 +202,25 @@ bool FreescapeEngine::executeCode(FCLInstructionVector &code, bool shot, bool co
debugC(1, kFreescapeDebugCode, "Executing NOP at ip: %d", ip);
break;
+ case Token::LOOP:
+ loopHead = ip;
+ loopIterations = instruction._source;
+ debugC(1, kFreescapeDebugCode, "Starting loop with %d iterations at ip: %d", loopIterations, ip);
+ break;
+
+ case Token::AGAIN:
+ if (loopIterations > 1) {
+ loopIterations--;
+ ip = loopHead;
+ debugC(1, kFreescapeDebugCode, "Looping again, %d iterations left, jumping to ip: %d", loopIterations, ip);
+ } else if (loopIterations == 1) {
+ loopIterations--;
+ debugC(1, kFreescapeDebugCode, "Loop finished");
+ } else {
+ error("AGAIN found without a matching LOOP!");
+ }
+ break;
+
case Token::CONDITIONAL:
if (checkConditional(instruction, shot, collided, timer, activated))
executed = executeCode(*instruction._thenInstructions, shot, collided, timer, activated);
More information about the Scummvm-git-logs
mailing list