[Scummvm-git-logs] scummvm master -> 69c13277e286da2fe229c87d3732f266f0d60ae6
neuromancer
noreply at scummvm.org
Thu Sep 26 07:16:02 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:
a5ae580b34 FREESCAPE: fix offset computation in groups
7c2864c0d4 FREESCAPE: basic implementation of key display for castle dos
69c13277e2 FREESCAPE: basic implementation of ghost effect for castle zx
Commit: a5ae580b34a39e158c4dbc933339089ace72d364
https://github.com/scummvm/scummvm/commit/a5ae580b34a39e158c4dbc933339089ace72d364
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-09-26T08:57:08+02:00
Commit Message:
FREESCAPE: fix offset computation in groups
Changed paths:
engines/freescape/objects/group.cpp
diff --git a/engines/freescape/objects/group.cpp b/engines/freescape/objects/group.cpp
index f7d720f7e08..8467b02ceae 100644
--- a/engines/freescape/objects/group.cpp
+++ b/engines/freescape/objects/group.cpp
@@ -99,7 +99,7 @@ void Group::assemble(int index) {
else if (index == 1)
offset = _offset1;
else if (index == 2)
- offset = _offset2;
+ offset = _offset1 + _offset2;
else
error("Invalid index: %d", index);
Commit: 7c2864c0d4b1e554ecff764ce0c18bae199437b5
https://github.com/scummvm/scummvm/commit/7c2864c0d4b1e554ecff764ce0c18bae199437b5
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-09-26T08:57:08+02:00
Commit Message:
FREESCAPE: basic implementation of key display for castle dos
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 71790286a0b..83290bb490c 100644
--- a/engines/freescape/games/castle/castle.cpp
+++ b/engines/freescape/games/castle/castle.cpp
@@ -82,7 +82,6 @@ CastleEngine::CastleEngine(OSystem *syst, const ADGameDescription *gd) : Freesca
_menuFxOnIndicator = nullptr;
_menuFxOffIndicator = nullptr;
- _numberKeys = 0;
_spiritsDestroyed = 0;
_spiritsMeter = 32;
_spiritsToKill = 26;
@@ -349,7 +348,7 @@ void CastleEngine::initGameState() {
_gameStateVars[k8bitVariableShield] = 16;
_gameStateVars[k8bitVariableEnergy] = 1;
_countdown = INT_MAX;
- _numberKeys = 0;
+ _keysCollected.clear();
_spiritsDestroyed = 0;
_spiritsMeter = 32;
_spiritsMeterMax = 64;
@@ -434,12 +433,19 @@ void CastleEngine::drawInfoMenu() {
_gfx->readFromPalette(10, r, g, b);
front = _gfx->_texturePixelFormat.ARGBToColor(0xFF, r, g, b);
drawStringInSurface(Common::String::format("%07d", score), 166, 71, front, black, surface);
+
+ for (int i = 0; i < int(_keysCollected.size()) ; i++) {
+ if (i % 2 == 0)
+ surface->copyRectToSurfaceWithKey(*_keysBorderFrames[i], 58, 58 + (i / 2) * 18, Common::Rect(0, 0, _keysBorderFrames[i]->w, _keysBorderFrames[i]->h), black);
+ else
+ surface->copyRectToSurfaceWithKey(*_keysBorderFrames[i], 80, 58 + (i / 2) * 18, Common::Rect(0, 0, _keysBorderFrames[i]->w, _keysBorderFrames[i]->h), black);
+ }
} else if (isSpectrum()) {
Common::Array<Common::String> lines;
lines.push_back(centerAndPadString("********************", 21));
lines.push_back(centerAndPadString("s-save l-load q-quit", 21));
lines.push_back("");
- lines.push_back(centerAndPadString(Common::String::format("keys %d collected", _numberKeys), 21));
+ 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("strength strong", 21));
lines.push_back(centerAndPadString(Common::String::format("score %07d", score), 21));
@@ -990,9 +996,11 @@ void CastleEngine::checkSensors() {
void CastleEngine::tryToCollectKey() {
if (_gameStateVars[32] > 0) { // Key collected!
- setGameBit(_gameStateVars[32]);
+ if (_keysCollected.size() < 10) {
+ setGameBit(_gameStateVars[32]);
+ _keysCollected.push_back(_gameStateVars[32]);
+ }
_gameStateVars[32] = 0;
- _numberKeys++;
}
}
@@ -1153,7 +1161,11 @@ void CastleEngine::selectCharacterScreen() {
}
Common::Error CastleEngine::saveGameStreamExtended(Common::WriteStream *stream, bool isAutosave) {
- stream->writeUint32LE(_numberKeys);
+ stream->writeUint32LE(_keysCollected.size());
+ for (auto &it : _keysCollected) {
+ stream->writeUint32LE(it);
+ }
+
stream->writeUint32LE(_spiritsMeter);
stream->writeUint32LE(_spiritsDestroyed);
@@ -1166,7 +1178,12 @@ Common::Error CastleEngine::saveGameStreamExtended(Common::WriteStream *stream,
}
Common::Error CastleEngine::loadGameStreamExtended(Common::SeekableReadStream *stream) {
- _numberKeys = stream->readUint32LE();
+ _keysCollected.clear();
+ int numberKeys = stream->readUint32LE();
+ for (int i = 0; i < numberKeys; i++) {
+ _keysCollected.push_back(stream->readUint32LE());
+ }
+
_spiritsMeter = stream->readUint32LE();
_spiritsDestroyed = stream->readUint32LE();
diff --git a/engines/freescape/games/castle/castle.h b/engines/freescape/games/castle/castle.h
index 529c9de629e..745495a99ad 100644
--- a/engines/freescape/games/castle/castle.h
+++ b/engines/freescape/games/castle/castle.h
@@ -105,7 +105,7 @@ public:
Graphics::ManagedSurface *_endGameThroneFrame;
Graphics::ManagedSurface *_endGameBackgroundFrame;
- int _numberKeys;
+ Common::Array<int> _keysCollected;
bool _useRockTravel;
int _spiritsDestroyed;
int _spiritsMeter;
diff --git a/engines/freescape/games/castle/dos.cpp b/engines/freescape/games/castle/dos.cpp
index 6f3496fff6f..0739cb331e8 100644
--- a/engines/freescape/games/castle/dos.cpp
+++ b/engines/freescape/games/castle/dos.cpp
@@ -187,13 +187,13 @@ void CastleEngine::loadAssetsDOSFullGame() {
debug("%lx", stream->pos());
debug("extra: %x", stream->readByte());
- for (int i = 0; i < 9; i++) {
+ for (int i = 0; i < 10; i++) {
Graphics::ManagedSurface *frame = loadFrameFromPlanes(stream, 8, 14);
frame->convertToInPlace(_gfx->_texturePixelFormat, (byte *)&kEGADefaultPalette, 16);
_keysBorderFrames.push_back(frame);
}
- for (int i = 0; i < 11; i++) {
+ for (int i = 0; i < 10; i++) {
Graphics::ManagedSurface *frame = loadFrameFromPlanes(stream, 8, 14);
frame->convertToInPlace(_gfx->_texturePixelFormat, (byte *)&kEGADefaultPalette, 16);
_keysMenuFrames.push_back(frame);
@@ -432,8 +432,8 @@ void CastleEngine::drawDOSUI(Graphics::Surface *surface) {
} else
drawStringInSurface(_currentArea->_name, 97, 182, front, back, surface);
- for (int k = 0; k < _numberKeys; k++) {
- surface->copyRectToSurfaceWithKey((const Graphics::Surface)*_keysBorderFrames[k], 76 - k * 4, 179, Common::Rect(0, 0, 6, 14), black);
+ 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);
}
drawEnergyMeter(surface, Common::Point(39, 157));
diff --git a/engines/freescape/games/castle/zx.cpp b/engines/freescape/games/castle/zx.cpp
index 3eb5402abd8..7c8b1fb91b3 100644
--- a/engines/freescape/games/castle/zx.cpp
+++ b/engines/freescape/games/castle/zx.cpp
@@ -237,7 +237,7 @@ void CastleEngine::drawZXUI(Graphics::Surface *surface) {
} else
drawStringInSurface(_currentArea->_name, 120, 179, front, black, surface);
- for (int k = 0; k < _numberKeys; k++) {
+ 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: 69c13277e286da2fe229c87d3732f266f0d60ae6
https://github.com/scummvm/scummvm/commit/69c13277e286da2fe229c87d3732f266f0d60ae6
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-09-26T08:57:08+02:00
Commit Message:
FREESCAPE: basic implementation of ghost effect for castle zx
Changed paths:
engines/freescape/freescape.cpp
engines/freescape/games/castle/castle.cpp
engines/freescape/games/castle/castle.h
engines/freescape/loaders/8bitBinaryLoader.cpp
engines/freescape/objects/sensor.cpp
diff --git a/engines/freescape/freescape.cpp b/engines/freescape/freescape.cpp
index 51c5534f561..d9b92b66d44 100644
--- a/engines/freescape/freescape.cpp
+++ b/engines/freescape/freescape.cpp
@@ -445,7 +445,9 @@ void FreescapeEngine::drawFrame() {
if (_underFireFrames > 0) {
for (auto &it : _sensors) {
Sensor *sensor = (Sensor *)it;
- if (sensor->isShooting())
+ if (it->isDestroyed() || it->isInvisible())
+ continue;
+ if (isCastle() || sensor->isShooting())
drawSensorShoot(sensor);
}
_underFireFrames--;
diff --git a/engines/freescape/games/castle/castle.cpp b/engines/freescape/games/castle/castle.cpp
index 83290bb490c..9c994e105dc 100644
--- a/engines/freescape/games/castle/castle.cpp
+++ b/engines/freescape/games/castle/castle.cpp
@@ -606,6 +606,8 @@ void CastleEngine::executeDestroy(FCLInstruction &instruction) {
if (!obj->isDestroyed() && obj->getType() == kSensorType && isCastle()) {
_spiritsDestroyed++;
+ _shootingFrames = 0;
+ _gfx->_inkColor = _currentArea->_inkColor;
}
if (obj->isDestroyed())
@@ -956,42 +958,63 @@ void CastleEngine::checkSensors() {
if (_sensors.empty())
return;
- Sensor *sensor = (Sensor *)&_sensors[0];
- if (isDOS()) { // Should be similar to Amiga/AtariST
- if (sensor->getObjectID() == 125) {
- Group *group = (Group *)_currentArea->objectWithID(195);
- if (!group->isDestroyed() && !group->isInvisible()) {
- group->_active = true;
- } else
- return;
+ for (auto &it : _sensors) {
+ Sensor *sensor = (Sensor *)it;
+ if (isDOS()) { // Should be similar to Amiga/AtariST
+ if (sensor->getObjectID() == 125) {
+ Group *group = (Group *)_currentArea->objectWithID(195);
+ if (!group->isDestroyed() && !group->isInvisible()) {
+ group->_active = true;
+ } else
+ return;
- group = (Group *)_currentArea->objectWithID(212);
- if (!group->isDestroyed() && !group->isInvisible()) {
- group->_active = true;
- } else
- return;
+ group = (Group *)_currentArea->objectWithID(212);
+ if (!group->isDestroyed() && !group->isInvisible()) {
+ group->_active = true;
+ } else
+ return;
- } else if (sensor->getObjectID() == 126) {
- Group *group = (Group *)_currentArea->objectWithID(191);
- if (!group->isDestroyed() && !group->isInvisible()) {
- group->_active = true;
- } else
- return;
- } else if (sensor->getObjectID() == 197) {
- Group *group = (Group *)_currentArea->objectWithID(182);
- if (!group->isDestroyed() && !group->isInvisible()) {
- group->_active = true;
- } else
- return;
+ } else if (sensor->getObjectID() == 126) {
+ Group *group = (Group *)_currentArea->objectWithID(191);
+ if (!group->isDestroyed() && !group->isInvisible()) {
+ group->_active = true;
+ } else
+ return;
+ } else if (sensor->getObjectID() == 197) {
+ Group *group = (Group *)_currentArea->objectWithID(182);
+ if (!group->isDestroyed() && !group->isInvisible()) {
+ group->_active = true;
+ } else
+ return;
+ }
}
}
- /*int firingInterval = 10; // This is fixed for all the ghosts?
+ bool ghostInArea = false;
+ for (auto &it : _sensors) {
+ if (it->isDestroyed() || it->isInvisible())
+ continue;
+ ghostInArea = true;
+ break;
+ }
+
+ if (!ghostInArea)
+ return;
+
+ int firingInterval = 5; // This is fixed for all the ghosts?
if (_ticks % firingInterval == 0) {
if (_underFireFrames <= 0)
- _underFireFrames = 4;
- takeDamageFromSensor();
- }*/
+ _underFireFrames = 1;
+ //takeDamageFromSensor();
+ }
+}
+
+void CastleEngine::drawSensorShoot(Sensor *sensor) {
+ if (isSpectrum()) {
+ _gfx->_inkColor = 1 + (_gfx->_inkColor + 1) % 7;
+ } else {
+ /* TODO */
+ }
}
void CastleEngine::tryToCollectKey() {
diff --git a/engines/freescape/games/castle/castle.h b/engines/freescape/games/castle/castle.h
index 745495a99ad..d879146149f 100644
--- a/engines/freescape/games/castle/castle.h
+++ b/engines/freescape/games/castle/castle.h
@@ -61,6 +61,7 @@ public:
void updateTimeVariables() override;
bool checkIfGameEnded() override;
+ void drawSensorShoot(Sensor *sensor) override;
void executePrint(FCLInstruction &instruction) override;
void executeMakeInvisible(FCLInstruction &instruction) override;
diff --git a/engines/freescape/loaders/8bitBinaryLoader.cpp b/engines/freescape/loaders/8bitBinaryLoader.cpp
index 780e92b54d6..23a3dedc9c9 100644
--- a/engines/freescape/loaders/8bitBinaryLoader.cpp
+++ b/engines/freescape/loaders/8bitBinaryLoader.cpp
@@ -511,7 +511,7 @@ Object *FreescapeEngine::load8bitObject(Common::SeekableReadStream *file) {
0,
0,
0,
- 0,
+ rawFlagsAndType,
instructions,
conditionSource);
}
diff --git a/engines/freescape/objects/sensor.cpp b/engines/freescape/objects/sensor.cpp
index 16b841296df..69fb9f84aca 100644
--- a/engines/freescape/objects/sensor.cpp
+++ b/engines/freescape/objects/sensor.cpp
@@ -45,6 +45,12 @@ Sensor::Sensor(
_firingRange = firingRange_;
_axis = axis_;
_flags = flags_;
+
+ if (isInitiallyInvisible())
+ makeInvisible();
+ else
+ makeVisible();
+
_conditionSource = conditionSource_;
_condition = condition_;
_isShooting = false;
More information about the Scummvm-git-logs
mailing list