[Scummvm-git-logs] scummvm master -> 60147736fffed1c9e5b220f7cf16c0744e055e67
neuromancer
noreply at scummvm.org
Tue Oct 29 20:44:54 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:
89110d4e4a FREESCAPE: initial implementation of game over screen
d30a26c61c FREESCAPE: improved implementation of game over screen
76718f4c57 FREESCAPE: avoid crash in castle zx
b66d729ca0 FREESCAPE: correctly propagate execution flags in the execute opcode
34163572ac FREESCAPE: initial implementation player crushing with group animations
60147736ff FREESCAPE: avoid empty temporary messages
Commit: 89110d4e4af6b4ccc27c9bec72880619d3919aa3
https://github.com/scummvm/scummvm/commit/89110d4e4af6b4ccc27c9bec72880619d3919aa3
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-10-29T21:44:00+01:00
Commit Message:
FREESCAPE: initial implementation of game over screen
Changed paths:
engines/freescape/games/castle/castle.cpp
engines/freescape/games/castle/castle.h
engines/freescape/games/castle/dos.cpp
diff --git a/engines/freescape/games/castle/castle.cpp b/engines/freescape/games/castle/castle.cpp
index 5fb85b9f390..b03bd548810 100644
--- a/engines/freescape/games/castle/castle.cpp
+++ b/engines/freescape/games/castle/castle.cpp
@@ -314,6 +314,8 @@ void CastleEngine::gotoArea(uint16 areaID, int entranceID) {
playSound(13, true);
else
playSound(_soundIndexStart, false);
+ } else if (areaID == _endArea && entranceID == _endEntrance) {
+ _pitch = -85;
} else {
// If escaped, play a different sound
if (getGameBit(31))
@@ -387,10 +389,15 @@ void CastleEngine::endGame() {
_shootingFrames = 0;
_delayedShootObject = nullptr;
_endGamePlayerEndArea = true;
- insertTemporaryMessage(_messagesList[5], INT_MIN);
- if (isDOS()) {
- drawFullscreenEndGameAndWait();
+ if (getGameBit(31) || _currentArea->getAreaID() == 74) {
+ insertTemporaryMessage(_messagesList[5], INT_MIN);
+
+ if (isDOS()) {
+ drawFullscreenEndGameAndWait();
+ }
+ } else {
+ drawFullscreenGameOverAndWait();
}
_gameStateControl = kFreescapeGameStateRestart;
@@ -676,6 +683,69 @@ void CastleEngine::drawFullscreenEndGameAndWait() {
delete surface;
}
+void CastleEngine::drawFullscreenGameOverAndWait() {
+ Graphics::Surface *surface = new Graphics::Surface();
+ surface->create(_screenW, _screenH, _gfx->_texturePixelFormat);
+ surface->fillRect(_fullscreenViewArea, _gfx->_texturePixelFormat.ARGBToColor(0x00, 0x00, 0x00, 0x00));
+
+ Common::Event event;
+ bool cont = true;
+
+ int score = _gameStateVars[k8bitVariableScore];
+ int spiritsDestroyed = _gameStateVars[k8bitVariableSpiritsDestroyed];
+
+ Common::String keysCollectedString = _messagesList[130];
+ if (_keysCollected.size() == 0)
+ keysCollectedString = _messagesList[128];
+ else
+ Common::replace(keysCollectedString, "X", Common::String::format("%d", _keysCollected.size()));
+ keysCollectedString = centerAndPadString(keysCollectedString, 15);
+
+ Common::String scoreString = _messagesList[131];
+ Common::replace(scoreString, "XXXXXXX", Common::String::format("%07d", score));
+ scoreString = centerAndPadString(scoreString, 15);
+
+ Common::String spiritsDestroyedString = _messagesList[133];
+ Common::replace(spiritsDestroyedString, "X", Common::String::format("%d", spiritsDestroyed));
+ spiritsDestroyedString = centerAndPadString(spiritsDestroyedString, 15);
+
+ while (!shouldQuit() && cont) {
+ if (_temporaryMessageDeadlines.empty()) {
+ insertTemporaryMessage(scoreString, _countdown - 2);
+ insertTemporaryMessage(spiritsDestroyedString, _countdown - 4);
+ insertTemporaryMessage(keysCollectedString, _countdown - 6);
+ }
+
+ while (_eventManager->pollEvent(event)) {
+
+ // Events
+ switch (event.type) {
+ case Common::EVENT_CUSTOM_ENGINE_ACTION_START:
+ if (event.customType == kActionShoot) {
+ cont = false;
+ }
+ break;
+ case Common::EVENT_SCREEN_CHANGED:
+ _gfx->computeScreenViewport();
+ break;
+ default:
+ break;
+ }
+ }
+ _gfx->clear(0, 0, 0, true);
+ drawFrame();
+
+ //drawFullscreenSurface(surface);
+ _gfx->flipBuffer();
+ g_system->updateScreen();
+ g_system->delayMillis(15); // try to target ~60 FPS
+ }
+
+ surface->free();
+ delete surface;
+}
+
+
// Same as FreescapeEngine::executeExecute but updates the spirits destroyed counter
void CastleEngine::executeDestroy(FCLInstruction &instruction) {
diff --git a/engines/freescape/games/castle/castle.h b/engines/freescape/games/castle/castle.h
index d7947691e4e..454e247a99a 100644
--- a/engines/freescape/games/castle/castle.h
+++ b/engines/freescape/games/castle/castle.h
@@ -132,6 +132,7 @@ private:
void loadDOSFonts(Common::SeekableReadStream *file, int pos);
void drawFullscreenRiddleAndWait(uint16 riddle);
void drawFullscreenEndGameAndWait();
+ void drawFullscreenGameOverAndWait();
void drawRiddle(uint16 riddle, uint32 front, uint32 back, Graphics::Surface *surface);
void tryToCollectKey();
void addGhosts();
diff --git a/engines/freescape/games/castle/dos.cpp b/engines/freescape/games/castle/dos.cpp
index 23512b51d81..b8e0b60eaa3 100644
--- a/engines/freescape/games/castle/dos.cpp
+++ b/engines/freescape/games/castle/dos.cpp
@@ -305,6 +305,8 @@ void CastleEngine::loadAssetsDOSFullGame() {
_conditionSources.remove_at(1);
}
+ _endArea = 1;
+ _endEntrance = 42;
// CPC
// file = gameDir.createReadStreamForMember("cm.bin");
// if (file == nullptr)
@@ -454,8 +456,10 @@ void CastleEngine::drawDOSUI(Graphics::Surface *surface) {
drawStringInSurface(message, 97, 182, front, back, surface);
_temporaryMessages.push_back(message);
_temporaryMessageDeadlines.push_back(deadline);
- } else
- drawStringInSurface(_currentArea->_name, 97, 182, front, back, surface);
+ } else {
+ if (_gameStateControl == kFreescapeGameStatePlaying)
+ drawStringInSurface(_currentArea->_name, 97, 182, front, back, surface);
+ }
for (int k = 0; k < int(_keysCollected.size()); k++) {
surface->copyRectToSurfaceWithKey((const Graphics::Surface)*_keysBorderFrames[k], 76 - k * 3, 179, Common::Rect(0, 0, 6, 14), black);
Commit: d30a26c61c2d23d86b06995b435ab73d69a9513c
https://github.com/scummvm/scummvm/commit/d30a26c61c2d23d86b06995b435ab73d69a9513c
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-10-29T21:44:00+01:00
Commit Message:
FREESCAPE: improved implementation of game over screen
Changed paths:
A devtools/create_freescape/castle_gate.bmp
A devtools/create_freescape/castle_gate_ZX Spectrum.bmp
dists/engine-data/freescape.dat
engines/freescape/assets.cpp
engines/freescape/freescape.h
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/devtools/create_freescape/castle_gate.bmp b/devtools/create_freescape/castle_gate.bmp
new file mode 100644
index 00000000000..b72fd96a5d8
Binary files /dev/null and b/devtools/create_freescape/castle_gate.bmp differ
diff --git a/devtools/create_freescape/castle_gate_ZX Spectrum.bmp b/devtools/create_freescape/castle_gate_ZX Spectrum.bmp
new file mode 100644
index 00000000000..4d36bbc2306
Binary files /dev/null and b/devtools/create_freescape/castle_gate_ZX Spectrum.bmp differ
diff --git a/dists/engine-data/freescape.dat b/dists/engine-data/freescape.dat
index b157e8e6971..f7a5a1cf362 100644
Binary files a/dists/engine-data/freescape.dat and b/dists/engine-data/freescape.dat differ
diff --git a/engines/freescape/assets.cpp b/engines/freescape/assets.cpp
index 01dc36c26c2..c02332fb6bb 100644
--- a/engines/freescape/assets.cpp
+++ b/engines/freescape/assets.cpp
@@ -127,9 +127,13 @@ void FreescapeEngine::loadDataBundle() {
free(versionData);
}
-Graphics::Surface *FreescapeEngine::loadBundledImage(const Common::String &name) {
+Graphics::Surface *FreescapeEngine::loadBundledImage(const Common::String &name, bool appendRenderMode) {
Image::BitmapDecoder decoder;
- Common::Path bmpFilename(name + "_" + Common::getRenderModeDescription(_renderMode) + ".bmp");
+ Common::Path bmpFilename(name + ".bmp");
+
+ if (appendRenderMode)
+ bmpFilename = Common::Path(name + "_" + Common::getRenderModeDescription(_renderMode) + ".bmp");
+
debugC(1, kFreescapeDebugParser, "Loading %s from bundled archive", bmpFilename.toString().c_str());
if (!_dataBundle->hasFile(bmpFilename))
error("Failed to open file %s from bundle", bmpFilename.toString().c_str());
diff --git a/engines/freescape/freescape.h b/engines/freescape/freescape.h
index 20ea38aac3a..d60b695a171 100644
--- a/engines/freescape/freescape.h
+++ b/engines/freescape/freescape.h
@@ -243,7 +243,7 @@ public:
Common::Archive *_dataBundle;
void loadDataBundle();
- Graphics::Surface *loadBundledImage(const Common::String &name);
+ Graphics::Surface *loadBundledImage(const Common::String &name, bool appendRenderMode = true);
byte *getPaletteFromNeoImage(Common::SeekableReadStream *stream, int offset);
Graphics::ManagedSurface *loadAndConvertNeoImage(Common::SeekableReadStream *stream, int offset, byte *palette = nullptr);
Graphics::ManagedSurface *loadAndCenterScrImage(Common::SeekableReadStream *stream);
diff --git a/engines/freescape/games/castle/castle.cpp b/engines/freescape/games/castle/castle.cpp
index b03bd548810..74e045bc3f2 100644
--- a/engines/freescape/games/castle/castle.cpp
+++ b/engines/freescape/games/castle/castle.cpp
@@ -79,6 +79,7 @@ CastleEngine::CastleEngine(OSystem *syst, const ADGameDescription *gd) : Freesca
_endGameThroneFrame = nullptr;
_endGameBackgroundFrame = nullptr;
+ _gameOverBackgroundFrame = nullptr;
_menuCrawlIndicator = nullptr;
_menuWalkIndicator = nullptr;
@@ -174,6 +175,11 @@ CastleEngine::~CastleEngine() {
delete _endGameBackgroundFrame;
}
+ if (_gameOverBackgroundFrame) {
+ _gameOverBackgroundFrame->free();
+ delete _gameOverBackgroundFrame;
+ }
+
if (_menu) {
_menu->free();
delete _menu;
@@ -687,6 +693,8 @@ void CastleEngine::drawFullscreenGameOverAndWait() {
Graphics::Surface *surface = new Graphics::Surface();
surface->create(_screenW, _screenH, _gfx->_texturePixelFormat);
surface->fillRect(_fullscreenViewArea, _gfx->_texturePixelFormat.ARGBToColor(0x00, 0x00, 0x00, 0x00));
+ uint32 blue = _gfx->_texturePixelFormat.ARGBToColor(0xFF, 0x00, 0x24, 0xA5);
+ surface->copyRectToSurfaceWithKey(*_gameOverBackgroundFrame, _viewArea.left, _viewArea.top, Common::Rect(0, 0, _gameOverBackgroundFrame->w, _gameOverBackgroundFrame->h), blue);
Common::Event event;
bool cont = true;
@@ -694,18 +702,51 @@ void CastleEngine::drawFullscreenGameOverAndWait() {
int score = _gameStateVars[k8bitVariableScore];
int spiritsDestroyed = _gameStateVars[k8bitVariableSpiritsDestroyed];
- Common::String keysCollectedString = _messagesList[130];
- if (_keysCollected.size() == 0)
+ Common::String keysCollectedString;
+ if (isDOS())
+ keysCollectedString = _messagesList[130];
+ else if (isSpectrum()) {
+ if (_language == Common::EN_ANY)
+ keysCollectedString = "X COLLECTED";
+ else if (_language == Common::ES_ESP)
+ keysCollectedString = "X RECOGIDAS";
+ else
+ error("Language not supported");
+ }
+
+ if (isDOS() && _keysCollected.size() == 0)
keysCollectedString = _messagesList[128];
else
Common::replace(keysCollectedString, "X", Common::String::format("%d", _keysCollected.size()));
keysCollectedString = centerAndPadString(keysCollectedString, 15);
- Common::String scoreString = _messagesList[131];
+ Common::String scoreString;
+ if (isDOS())
+ scoreString = _messagesList[131];
+ else if (isSpectrum()) {
+ if (_language == Common::EN_ANY)
+ scoreString = "SCORE XXXXXXX";
+ else if (_language == Common::ES_ESP)
+ scoreString = "PUNTAJE XXXXXXX";
+ else
+ error("Language not supported");
+ }
+
Common::replace(scoreString, "XXXXXXX", Common::String::format("%07d", score));
scoreString = centerAndPadString(scoreString, 15);
- Common::String spiritsDestroyedString = _messagesList[133];
+ Common::String spiritsDestroyedString;
+ if (isDOS())
+ spiritsDestroyedString = _messagesList[133];
+ else if (isSpectrum()) {
+ if (_language == Common::EN_ANY)
+ spiritsDestroyedString = "X DESTROYED";
+ else if (_language == Common::ES_ESP)
+ spiritsDestroyedString = "X DESTRUIDOS";
+ else
+ error("Language not supported");
+ }
+
Common::replace(spiritsDestroyedString, "X", Common::String::format("%d", spiritsDestroyed));
spiritsDestroyedString = centerAndPadString(spiritsDestroyedString, 15);
@@ -735,7 +776,7 @@ void CastleEngine::drawFullscreenGameOverAndWait() {
_gfx->clear(0, 0, 0, true);
drawFrame();
- //drawFullscreenSurface(surface);
+ drawFullscreenSurface(surface);
_gfx->flipBuffer();
g_system->updateScreen();
g_system->delayMillis(15); // try to target ~60 FPS
diff --git a/engines/freescape/games/castle/castle.h b/engines/freescape/games/castle/castle.h
index 454e247a99a..269824ef82f 100644
--- a/engines/freescape/games/castle/castle.h
+++ b/engines/freescape/games/castle/castle.h
@@ -116,6 +116,7 @@ public:
Graphics::ManagedSurface *_endGameThroneFrame;
Graphics::ManagedSurface *_endGameBackgroundFrame;
+ Graphics::ManagedSurface *_gameOverBackgroundFrame;
Common::Array<int> _keysCollected;
bool _useRockTravel;
diff --git a/engines/freescape/games/castle/dos.cpp b/engines/freescape/games/castle/dos.cpp
index b8e0b60eaa3..bebd0f92b3b 100644
--- a/engines/freescape/games/castle/dos.cpp
+++ b/engines/freescape/games/castle/dos.cpp
@@ -147,7 +147,7 @@ void CastleEngine::loadAssetsDOSFullGame() {
Common::SeekableReadStream *stream = nullptr;
if (_renderMode == Common::kRenderEGA) {
- _viewArea = Common::Rect(40, 33, 280, 152);
+ _viewArea = Common::Rect(40, 33 - 2, 280, 152);
file.open("CME.EXE");
stream = unpackEXE(file);
@@ -307,6 +307,15 @@ void CastleEngine::loadAssetsDOSFullGame() {
_endArea = 1;
_endEntrance = 42;
+
+ Graphics::Surface *tmp;
+ tmp = loadBundledImage("castle_gate", false);
+ _gameOverBackgroundFrame = new Graphics::ManagedSurface;
+ _gameOverBackgroundFrame->copyFrom(*tmp);
+ _gameOverBackgroundFrame->convertToInPlace(_gfx->_texturePixelFormat);
+ tmp->free();
+ delete tmp;
+
// CPC
// file = gameDir.createReadStreamForMember("cm.bin");
// if (file == nullptr)
diff --git a/engines/freescape/games/castle/zx.cpp b/engines/freescape/games/castle/zx.cpp
index 6ebc2cdd6f6..d1032bde674 100644
--- a/engines/freescape/games/castle/zx.cpp
+++ b/engines/freescape/games/castle/zx.cpp
@@ -253,6 +253,16 @@ void CastleEngine::loadAssetsZXFullGame() {
_crushedMessage = _messagesList[3];
_outOfReachMessage = _messagesList[7];
_noEffectMessage = _messagesList[8];
+
+ _endArea = 1;
+ _endEntrance = 42;
+
+ tmp = loadBundledImage("castle_gate");
+ _gameOverBackgroundFrame = new Graphics::ManagedSurface;
+ _gameOverBackgroundFrame->copyFrom(*tmp);
+ _gameOverBackgroundFrame->convertToInPlace(_gfx->_texturePixelFormat);
+ tmp->free();
+ delete tmp;
}
void CastleEngine::drawZXUI(Graphics::Surface *surface) {
Commit: 76718f4c5700ec579778b2b23ef47ad9299507fd
https://github.com/scummvm/scummvm/commit/76718f4c5700ec579778b2b23ef47ad9299507fd
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-10-29T21:44:00+01:00
Commit Message:
FREESCAPE: avoid crash in castle zx
Changed paths:
engines/freescape/games/castle/zx.cpp
diff --git a/engines/freescape/games/castle/zx.cpp b/engines/freescape/games/castle/zx.cpp
index d1032bde674..a8aa2d8e88f 100644
--- a/engines/freescape/games/castle/zx.cpp
+++ b/engines/freescape/games/castle/zx.cpp
@@ -214,7 +214,7 @@ void CastleEngine::loadAssetsZXFullGame() {
tmp = loadBundledImage("castle_riddle_bottom_frame");
_riddleBottomFrame = new Graphics::ManagedSurface();
- _riddleBackgroundFrame->copyFrom(*tmp);
+ _riddleBottomFrame->copyFrom(*tmp);
tmp->free();
delete tmp;
_riddleBottomFrame->convertToInPlace(_gfx->_texturePixelFormat);
Commit: b66d729ca009d183c27f5c63f307b64e7623162c
https://github.com/scummvm/scummvm/commit/b66d729ca009d183c27f5c63f307b64e7623162c
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-10-29T21:44:00+01:00
Commit Message:
FREESCAPE: correctly propagate execution flags in the execute opcode
Changed paths:
engines/freescape/freescape.cpp
engines/freescape/games/castle/castle.cpp
engines/freescape/language/instruction.cpp
diff --git a/engines/freescape/freescape.cpp b/engines/freescape/freescape.cpp
index c9b8b80bc35..3414b466120 100644
--- a/engines/freescape/freescape.cpp
+++ b/engines/freescape/freescape.cpp
@@ -209,10 +209,6 @@ FreescapeEngine::FreescapeEngine(OSystem *syst, const ADGameDescription *gd)
ConfMan.setBool("gamepad_controller_minimal_layout", true, gameDomain);
ConfMan.setInt("gamepad_controller_directional_input", 1 /* kDirectionalInputDpad */, gameDomain);
#endif
-
- if (isCastle())
- k8bitVariableShield = 29;
-
g_freescape = this;
}
diff --git a/engines/freescape/games/castle/castle.cpp b/engines/freescape/games/castle/castle.cpp
index 74e045bc3f2..674c75edda4 100644
--- a/engines/freescape/games/castle/castle.cpp
+++ b/engines/freescape/games/castle/castle.cpp
@@ -41,6 +41,7 @@ CastleEngine::CastleEngine(OSystem *syst, const ADGameDescription *gd) : Freesca
_soundIndexStart = 9;
_soundIndexAreaChange = 5;
+ k8bitVariableShield = 29;
if (isSpectrum())
initZX();
diff --git a/engines/freescape/language/instruction.cpp b/engines/freescape/language/instruction.cpp
index 177bb37fcce..308e730b094 100644
--- a/engines/freescape/language/instruction.cpp
+++ b/engines/freescape/language/instruction.cpp
@@ -342,7 +342,8 @@ void FreescapeEngine::executeExecute(FCLInstruction &instruction, bool shot, boo
if (!obj) {
obj = _areaMap[255]->entranceWithID(objId);
assert(obj);
- executeEntranceConditions((Entrance *)obj);
+ FCLInstructionVector &condition = ((Entrance *)obj)->_condition;
+ executeCode(condition, shot, collided, false, activated);
return;
}
}
Commit: 34163572acc2ff021c22d062bc258b2ebfcdfa2f
https://github.com/scummvm/scummvm/commit/34163572acc2ff021c22d062bc258b2ebfcdfa2f
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-10-29T21:44:00+01:00
Commit Message:
FREESCAPE: initial implementation player crushing with group animations
Changed paths:
engines/freescape/area.cpp
engines/freescape/area.h
engines/freescape/freescape.cpp
engines/freescape/freescape.h
engines/freescape/language/instruction.cpp
engines/freescape/objects/group.cpp
engines/freescape/objects/group.h
diff --git a/engines/freescape/area.cpp b/engines/freescape/area.cpp
index 5eb2b667add..88398846e1d 100644
--- a/engines/freescape/area.cpp
+++ b/engines/freescape/area.cpp
@@ -436,6 +436,19 @@ ObjectArray Area::checkCollisions(const Math::AABB &boundingBox) {
return collided;
}
+bool Area::checkIfPlayerWasCrushed(const Math::AABB &boundingBox) {
+ for (auto &obj : _drawableObjects) {
+ if (!obj->isDestroyed() && !obj->isInvisible() && obj->getType() == kGroupType) {
+ Group *group = (Group *)obj;
+ if (group->collides(boundingBox)) {
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
+
Math::Vector3d Area::resolveCollisions(const Math::Vector3d &lastPosition_, const Math::Vector3d &newPosition_, int playerHeight) {
Math::Vector3d position = newPosition_;
Math::Vector3d lastPosition = lastPosition_;
diff --git a/engines/freescape/area.h b/engines/freescape/area.h
index b1148f76db8..3ba0b63ce6b 100644
--- a/engines/freescape/area.h
+++ b/engines/freescape/area.h
@@ -59,6 +59,7 @@ public:
Object *checkCollisionRay(const Math::Ray &ray, int raySize);
bool checkInSight(const Math::Ray &ray, float maxDistance);
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);
void addObjectFromArea(int16 id, Area *global);
void addGroupFromArea(int16 id, Area *global);
diff --git a/engines/freescape/freescape.cpp b/engines/freescape/freescape.cpp
index 3414b466120..f649ef348ae 100644
--- a/engines/freescape/freescape.cpp
+++ b/engines/freescape/freescape.cpp
@@ -31,6 +31,7 @@
#include "freescape/freescape.h"
#include "freescape/language/8bitDetokeniser.h"
#include "freescape/objects/sensor.h"
+#include "freescape/sweepAABB.h"
namespace Freescape {
@@ -519,7 +520,7 @@ void FreescapeEngine::processInput() {
switch (event.type) {
case Common::EVENT_CUSTOM_ENGINE_ACTION_START:
- if (_hasFallen)
+ if (_hasFallen || _playerWasCrushed)
break;
switch (event.customType) {
case kActionMoveUp:
@@ -580,14 +581,14 @@ void FreescapeEngine::processInput() {
}
break;
case Common::EVENT_KEYDOWN:
- if (_hasFallen)
+ if (_hasFallen || _playerWasCrushed)
break;
pressedKey(event.kbd.keycode);
break;
case Common::EVENT_KEYUP:
- if (_hasFallen)
+ if (_hasFallen || _playerWasCrushed)
break;
releasedKey(event.kbd.keycode);
@@ -604,7 +605,7 @@ void FreescapeEngine::processInput() {
break;
case Common::EVENT_MOUSEMOVE:
- if (_hasFallen)
+ if (_hasFallen || _playerWasCrushed)
break;
mousePos = event.mouse;
@@ -632,7 +633,7 @@ void FreescapeEngine::processInput() {
break;
case Common::EVENT_LBUTTONDOWN:
- if (_hasFallen)
+ if (_hasFallen || _playerWasCrushed)
break;
mousePos = event.mouse;
{
@@ -649,7 +650,7 @@ void FreescapeEngine::processInput() {
break;
case Common::EVENT_RBUTTONDOWN:
- if (_hasFallen || !isCastle())
+ if (_hasFallen || _playerWasCrushed || !isCastle())
break;
activate();
break;
@@ -744,6 +745,7 @@ Common::Error FreescapeEngine::run() {
generateDemoInput();
checkSensors();
+ checkIfPlayerWasCrushed();
drawFrame();
if (_shootingFrames == 0) {
@@ -875,6 +877,14 @@ bool FreescapeEngine::checkIfGameEnded() {
return false;
}
+void FreescapeEngine::checkIfPlayerWasCrushed() {
+ Math::AABB boundingBox = createPlayerAABB(_position, _playerHeight);
+ if (!_playerWasCrushed && _currentArea->checkIfPlayerWasCrushed(boundingBox)) {
+ _avoidRenderingFrames = 60 * 3;
+ _playerWasCrushed = true;
+ }
+}
+
void FreescapeEngine::setGameBit(int index) {
_gameStateBits |= (1 << (index - 1));
}
diff --git a/engines/freescape/freescape.h b/engines/freescape/freescape.h
index d60b695a171..aa767fcb103 100644
--- a/engines/freescape/freescape.h
+++ b/engines/freescape/freescape.h
@@ -530,6 +530,7 @@ public:
StateVars _gameStateVars;
uint32 _gameStateBits;
+ void checkIfPlayerWasCrushed();
virtual bool checkIfGameEnded();
virtual void endGame();
int _endGameDelayTicks;
diff --git a/engines/freescape/language/instruction.cpp b/engines/freescape/language/instruction.cpp
index 308e730b094..88b859515c0 100644
--- a/engines/freescape/language/instruction.cpp
+++ b/engines/freescape/language/instruction.cpp
@@ -668,6 +668,7 @@ void FreescapeEngine::executeToggleVisibility(FCLInstruction &instruction) {
Math::AABB boundingBox = createPlayerAABB(_position, _playerHeight);
if (obj->_boundingBox.collides(boundingBox)) {
_playerWasCrushed = true;
+ _avoidRenderingFrames = 60 * 3;
_shootingFrames = 0;
}
}
diff --git a/engines/freescape/objects/group.cpp b/engines/freescape/objects/group.cpp
index 8bd661db843..3689aa84a9e 100644
--- a/engines/freescape/objects/group.cpp
+++ b/engines/freescape/objects/group.cpp
@@ -201,4 +201,16 @@ void Group::step() {
}
}
+bool Group::collides(const Math::AABB &aabb) {
+ uint32 groupSize = _objects.size();
+ for (uint32 i = 0; i < groupSize ; i++) {
+ if (!_objects[i]->isInvisible() && !_objects[i]->isDestroyed() && _objects[i]->isDrawable()) {
+ GeometricObject *gobj = (GeometricObject *)_objects[i];
+ if (gobj->collides(aabb))
+ return true;
+ }
+ }
+ return false;
+}
+
} // End of namespace Freescape
\ No newline at end of file
diff --git a/engines/freescape/objects/group.h b/engines/freescape/objects/group.h
index 0dceaf6255d..2351ebca5ab 100644
--- a/engines/freescape/objects/group.h
+++ b/engines/freescape/objects/group.h
@@ -52,6 +52,7 @@ public:
void run(int index);
void reset();
void start();
+ bool collides(const Math::AABB &aabb);
Common::Array<Object *> _objects;
Common::Array<Math::Vector3d> _origins;
Commit: 60147736fffed1c9e5b220f7cf16c0744e055e67
https://github.com/scummvm/scummvm/commit/60147736fffed1c9e5b220f7cf16c0744e055e67
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-10-29T21:44:01+01:00
Commit Message:
FREESCAPE: avoid empty temporary messages
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 674c75edda4..4f860ab5a78 100644
--- a/engines/freescape/games/castle/castle.cpp
+++ b/engines/freescape/games/castle/castle.cpp
@@ -364,7 +364,7 @@ void CastleEngine::initGameState() {
_gameStateVars[k8bitVariableShield] = 20;
_gameStateVars[k8bitVariableEnergy] = 1;
_gameStateVars[8] = 128; // -1
- _countdown = INT_MAX;
+ _countdown = INT_MAX - 8;
_keysCollected.clear();
_spiritsMeter = 32;
_spiritsMeterMax = 64;
diff --git a/engines/freescape/games/castle/dos.cpp b/engines/freescape/games/castle/dos.cpp
index bebd0f92b3b..4bc15788012 100644
--- a/engines/freescape/games/castle/dos.cpp
+++ b/engines/freescape/games/castle/dos.cpp
@@ -459,9 +459,9 @@ void CastleEngine::drawDOSUI(Graphics::Surface *surface) {
surface->fillRect(backRect, back);
Common::String message;
- int deadline;
+ int deadline = -1;
getLatestMessages(message, deadline);
- if (deadline <= _countdown) {
+ if (deadline > 0 && deadline <= _countdown) {
drawStringInSurface(message, 97, 182, front, back, surface);
_temporaryMessages.push_back(message);
_temporaryMessageDeadlines.push_back(deadline);
More information about the Scummvm-git-logs
mailing list