[Scummvm-git-logs] scummvm master -> 1de1caf4ec02076728c2d4cfdb03e1c816fc9d0d
neuromancer
noreply at scummvm.org
Sun Sep 29 07:06:05 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:
f467275b6e FREESCAPE: basic implementation of ghost effect for castle dos
bf92c793e3 FREESCAPE: improved riddle rendering for castle zx
1de1caf4ec FREESCAPE: correct parsing and rendering of riddles in castle
Commit: f467275b6e2c655c07b15b4dd57e9a433b89d86e
https://github.com/scummvm/scummvm/commit/f467275b6e2c655c07b15b4dd57e9a433b89d86e
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-09-29T09:03:06+02:00
Commit Message:
FREESCAPE: basic implementation of ghost effect for castle dos
Changed paths:
engines/freescape/games/castle/castle.cpp
engines/freescape/gfx.h
engines/freescape/gfx_opengl.cpp
diff --git a/engines/freescape/games/castle/castle.cpp b/engines/freescape/games/castle/castle.cpp
index 9c994e105dc..3d884b16d85 100644
--- a/engines/freescape/games/castle/castle.cpp
+++ b/engines/freescape/games/castle/castle.cpp
@@ -22,6 +22,7 @@
#include "common/file.h"
#include "common/memstream.h"
#include "common/config-manager.h"
+#include "common/random.h"
#include "backends/keymapper/action.h"
#include "backends/keymapper/keymap.h"
@@ -356,6 +357,8 @@ void CastleEngine::initGameState() {
_exploredAreas[_startArea] = true;
if (_useRockTravel) // Enable cheat
setGameBit(k8bitGameBitTravelRock);
+
+ _gfx->_shakeOffset = Common::Point();
}
bool CastleEngine::checkIfGameEnded() {
@@ -608,6 +611,7 @@ void CastleEngine::executeDestroy(FCLInstruction &instruction) {
_spiritsDestroyed++;
_shootingFrames = 0;
_gfx->_inkColor = _currentArea->_inkColor;
+ _gfx->_shakeOffset = Common::Point();
}
if (obj->isDestroyed())
@@ -1012,6 +1016,12 @@ void CastleEngine::checkSensors() {
void CastleEngine::drawSensorShoot(Sensor *sensor) {
if (isSpectrum()) {
_gfx->_inkColor = 1 + (_gfx->_inkColor + 1) % 7;
+ } else if (isDOS()) {
+ float shakeIntensity = 10;
+ Common::Point shakeOffset;
+ shakeOffset.x = (_rnd->getRandomNumber(10) / 10.0 - 0.5f) * shakeIntensity;
+ shakeOffset.y = (_rnd->getRandomNumber(10) / 10.0 - 0.5f) * shakeIntensity;
+ _gfx->_shakeOffset = shakeOffset;
} else {
/* TODO */
}
diff --git a/engines/freescape/gfx.h b/engines/freescape/gfx.h
index a5d1faf1e55..97c1a2826db 100644
--- a/engines/freescape/gfx.h
+++ b/engines/freescape/gfx.h
@@ -141,6 +141,7 @@ public:
int _inkColor;
int _paperColor;
int _underFireBackgroundColor;
+ Common::Point _shakeOffset;
byte _stipples[16][128];
int _scale;
diff --git a/engines/freescape/gfx_opengl.cpp b/engines/freescape/gfx_opengl.cpp
index 07be58fbb12..8faf3fe8e49 100644
--- a/engines/freescape/gfx_opengl.cpp
+++ b/engines/freescape/gfx_opengl.cpp
@@ -221,6 +221,7 @@ void OpenGLRenderer::positionCamera(const Math::Vector3d &pos, const Math::Vecto
Math::Matrix4 lookMatrix = Math::makeLookAtMatrix(pos, interest, up_vec);
glMultMatrixf(lookMatrix.getData());
glTranslatef(-pos.x(), -pos.y(), -pos.z());
+ glTranslatef(_shakeOffset.x, _shakeOffset.y, 0);
}
void OpenGLRenderer::renderSensorShoot(byte color, const Math::Vector3d sensor, const Math::Vector3d target, const Common::Rect viewArea) {
Commit: bf92c793e3db8e17f781592017ddc9a7f1035ef9
https://github.com/scummvm/scummvm/commit/bf92c793e3db8e17f781592017ddc9a7f1035ef9
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-09-29T09:03:06+02:00
Commit Message:
FREESCAPE: improved riddle rendering for castle zx
Changed paths:
A devtools/create_freescape/castle_riddle_background_frame_ZX Spectrum.bmp
A devtools/create_freescape/castle_riddle_bottom_frame_ZX Spectrum.bmp
A devtools/create_freescape/castle_riddle_top_frame_ZX Spectrum.bmp
dists/engine-data/freescape.dat
engines/freescape/games/castle/castle.cpp
engines/freescape/games/castle/zx.cpp
diff --git a/devtools/create_freescape/castle_riddle_background_frame_ZX Spectrum.bmp b/devtools/create_freescape/castle_riddle_background_frame_ZX Spectrum.bmp
new file mode 100644
index 00000000000..96924a977d8
Binary files /dev/null and b/devtools/create_freescape/castle_riddle_background_frame_ZX Spectrum.bmp differ
diff --git a/devtools/create_freescape/castle_riddle_bottom_frame_ZX Spectrum.bmp b/devtools/create_freescape/castle_riddle_bottom_frame_ZX Spectrum.bmp
new file mode 100644
index 00000000000..6002ba4b5d3
Binary files /dev/null and b/devtools/create_freescape/castle_riddle_bottom_frame_ZX Spectrum.bmp differ
diff --git a/devtools/create_freescape/castle_riddle_top_frame_ZX Spectrum.bmp b/devtools/create_freescape/castle_riddle_top_frame_ZX Spectrum.bmp
new file mode 100644
index 00000000000..a48d79433ca
Binary files /dev/null and b/devtools/create_freescape/castle_riddle_top_frame_ZX Spectrum.bmp differ
diff --git a/dists/engine-data/freescape.dat b/dists/engine-data/freescape.dat
index 8ab5cb22c1f..b157e8e6971 100644
Binary files a/dists/engine-data/freescape.dat and b/dists/engine-data/freescape.dat differ
diff --git a/engines/freescape/games/castle/castle.cpp b/engines/freescape/games/castle/castle.cpp
index 3d884b16d85..8846a1e67d7 100644
--- a/engines/freescape/games/castle/castle.cpp
+++ b/engines/freescape/games/castle/castle.cpp
@@ -817,19 +817,26 @@ void CastleEngine::drawRiddle(uint16 riddle, uint32 front, uint32 back, Graphics
for (int i = 7 * riddle; i < 7 * (riddle + 1); i++) {
riddleMessages.push_back(_riddleList[i]);
}
- uint32 frameColor = 0;
+ //uint32 frameColor = 0;
+ //if (isDOS()) {
+
+ int h, w, mw;
+
if (isDOS()) {
- int w = 34;
- surface->copyRectToSurface((const Graphics::Surface)*_riddleTopFrame, 40, w, Common::Rect(0, 0, _riddleTopFrame->w, _riddleTopFrame->h));
- for (w += _riddleTopFrame->h; w < 136;) {
- surface->copyRectToSurface((const Graphics::Surface)*_riddleBackgroundFrame, 40, w, Common::Rect(0, 0, _riddleBackgroundFrame->w, _riddleBackgroundFrame->h));
- w += _riddleBackgroundFrame->h;
- }
- surface->copyRectToSurface((const Graphics::Surface)*_riddleBottomFrame, 40, 136, Common::Rect(0, 0, _riddleBottomFrame->w, _riddleBottomFrame->h - 1));
+ h = 40;
+ w = 34;
+ mw = 136;
} else {
- frameColor = _gfx->_texturePixelFormat.ARGBToColor(0xFF, 0xD8, 0xD8, 0xD8);
- surface->fillRect(_viewArea, frameColor);
+ h = 64;
+ w = 37;
+ mw = 136;
}
+ surface->copyRectToSurface((const Graphics::Surface)*_riddleTopFrame, h, w, Common::Rect(0, 0, _riddleTopFrame->w, _riddleTopFrame->h));
+ for (w += _riddleTopFrame->h; w < mw;) {
+ surface->copyRectToSurface((const Graphics::Surface)*_riddleBackgroundFrame, h, w, Common::Rect(0, 0, _riddleBackgroundFrame->w, _riddleBackgroundFrame->h));
+ w += _riddleBackgroundFrame->h;
+ }
+ surface->copyRectToSurface((const Graphics::Surface)*_riddleBottomFrame, h, mw, Common::Rect(0, 0, _riddleBottomFrame->w, _riddleBottomFrame->h - 1));
int x = 0;
int y = 0;
@@ -839,8 +846,8 @@ void CastleEngine::drawRiddle(uint16 riddle, uint32 front, uint32 back, Graphics
x = 60;
y = 62;
} else if (isSpectrum() || isCPC()) {
- x = 60;
- y = 40;
+ x = 65;
+ y = 70;
}
for (int i = 0; i < numberOfLines; i++) {
diff --git a/engines/freescape/games/castle/zx.cpp b/engines/freescape/games/castle/zx.cpp
index 7c8b1fb91b3..2f7f2ff74ab 100644
--- a/engines/freescape/games/castle/zx.cpp
+++ b/engines/freescape/games/castle/zx.cpp
@@ -178,6 +178,15 @@ void CastleEngine::loadAssetsZXFullGame() {
_thunderFrame->fillRect(Common::Rect(0, 0, thunderWidth * 8, thunderHeight), 0);
_thunderFrame = loadFrame(&file, _thunderFrame, thunderWidth, thunderHeight, front);
+ _riddleTopFrame = new Graphics::ManagedSurface(loadBundledImage("castle_riddle_top_frame"));
+ _riddleTopFrame->convertToInPlace(_gfx->_texturePixelFormat);
+
+ _riddleBackgroundFrame = new Graphics::ManagedSurface(loadBundledImage("castle_riddle_background_frame"));
+ _riddleBackgroundFrame->convertToInPlace(_gfx->_texturePixelFormat);
+
+ _riddleBottomFrame = new Graphics::ManagedSurface(loadBundledImage("castle_riddle_bottom_frame"));
+ _riddleBottomFrame->convertToInPlace(_gfx->_texturePixelFormat);
+
for (auto &it : _areaMap) {
it._value->addStructure(_areaMap[255]);
Commit: 1de1caf4ec02076728c2d4cfdb03e1c816fc9d0d
https://github.com/scummvm/scummvm/commit/1de1caf4ec02076728c2d4cfdb03e1c816fc9d0d
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-09-29T09:03:06+02:00
Commit Message:
FREESCAPE: correct parsing and rendering of riddles in castle
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 8846a1e67d7..18b388f452e 100644
--- a/engines/freescape/games/castle/castle.cpp
+++ b/engines/freescape/games/castle/castle.cpp
@@ -653,26 +653,30 @@ void CastleEngine::loadAssets() {
void CastleEngine::loadRiddles(Common::SeekableReadStream *file, int offset, int number) {
file->seek(offset);
+
+ Common::Array<Common::Point> origins;
+ for (int i = 0; i < number; i++) {
+ Common::Point origin;
+ origin.x = file->readByte();
+ origin.y = file->readByte();
+ debugC(1, kFreescapeDebugParser, "riddle %d origin: %d, %d", i, origin.x, origin.y);
+ origins.push_back(origin);
+ }
+
debugC(1, kFreescapeDebugParser, "Riddle table:");
- int maxLineSize = isSpectrum() ? 20 : 23;
+ int maxLineSize = isSpectrum() ? 20 : 24;
for (int i = 0; i < number; i++) {
- int header = file->readByte();
- debugC(1, kFreescapeDebugParser, "riddle %d header: %x", i, header);
- int numberLines = 6;
- if (header == 0x18)
- numberLines = 8;
- else if (header == 0x15 || header == 0x1a || header == 0x1b || header == 0x1c || header == 0x1e)
- numberLines = 7;
- else if (header == 0x1d)
- numberLines = 6;
- else if (header == 0x27)
- numberLines = 5;
-
- if (isSpectrum())
- --numberLines;
+ Riddle riddle;
+ riddle._origin = origins[i];
+ int numberLines = file->readByte();
+ debugC(1, kFreescapeDebugParser, "riddle %d number of lines: %d", i, numberLines);
+ int8 x, y;
for (int j = 0; j < numberLines; j++) {
+
+ x = file->readByte();
+ y = file->readByte();
int size = file->readByte();
debugC(1, kFreescapeDebugParser, "size: %d (max %d?)", size, maxLineSize);
@@ -682,63 +686,31 @@ void CastleEngine::loadRiddles(Common::SeekableReadStream *file, int offset, int
while (size-- > 0)
message = message + "*";
- //debugC(1, kFreescapeDebugParser, "extra byte: %x", file->readByte());
- debugC(1, kFreescapeDebugParser, "extra byte: %x", file->readByte());
- debugC(1, kFreescapeDebugParser, "extra byte: %x", file->readByte());
- debugC(1, kFreescapeDebugParser, "'%s'", message.c_str());
- _riddleList.push_back(message);
+ debugC(1, kFreescapeDebugParser, "'%s' with offset: %d, %d", message.c_str(), x, y);
+ riddle._lines.push_back(RiddleText(x, y, message));
continue;
} else if (size > maxLineSize) {
- for (int k = j; k < numberLines; k++)
- _riddleList.push_back(message);
-
- if (isSpectrum()) {
- debugC(1, kFreescapeDebugParser, "extra byte: %x", file->readByte());
- debugC(1, kFreescapeDebugParser, "extra byte: %x", file->readByte());
- }
-
- debugC(1, kFreescapeDebugParser, "'%s'", message.c_str());
- break;
+ assert(0);
} else if (size == 0) {
- size = 20;
+ assert(0);
}
- int padSpaces = (22 - size) / 2;
debugC(1, kFreescapeDebugParser, "extra byte: %x", file->readByte());
-
- int k = padSpaces;
-
- if (size > 0) {
- while (k-- > 0)
- message = message + " ";
-
- while (size-- > 0) {
- byte c = file->readByte();
- if (c != 0)
- message = message + c;
- }
-
- k = padSpaces;
- while (k-- > 0)
- message = message + " ";
+ while (size-- > 0) {
+ byte c = file->readByte();
+ if (c != 0)
+ message = message + c;
}
-
- if (isAmiga() || isAtariST())
+ /*if (isAmiga() || isAtariST())
debug("extra byte: %x", file->readByte());
debugC(1, kFreescapeDebugParser, "extra byte: %x", file->readByte());
- debugC(1, kFreescapeDebugParser, "extra byte: %x", file->readByte());
- debugC(1, kFreescapeDebugParser, "'%s'", message.c_str());
+ debugC(1, kFreescapeDebugParser, "extra byte: %x", file->readByte());*/
+ debugC(1, kFreescapeDebugParser, "'%s' with offset: %d, %d", message.c_str(), x, y);
- _riddleList.push_back(message);
+ riddle._lines.push_back(RiddleText(x, y, message));
}
-
- if (numberLines < 7)
- for (int j = numberLines; j < 7; j++) {
- _riddleList.push_back("");
- debugC(1, kFreescapeDebugParser, "Padded with ''");
- }
-
+ _riddleList.push_back(riddle);
}
debugC(1, kFreescapeDebugParser, "End of riddles at %" PRIx64, file->pos());
}
@@ -812,47 +784,39 @@ void CastleEngine::drawFullscreenRiddleAndWait(uint16 riddle) {
}
void CastleEngine::drawRiddle(uint16 riddle, uint32 front, uint32 back, Graphics::Surface *surface) {
-
- Common::StringArray riddleMessages;
- for (int i = 7 * riddle; i < 7 * (riddle + 1); i++) {
- riddleMessages.push_back(_riddleList[i]);
- }
- //uint32 frameColor = 0;
- //if (isDOS()) {
-
- int h, w, mw;
+ int x, y;
+ int maxWidth = 136;
if (isDOS()) {
- h = 40;
- w = 34;
- mw = 136;
- } else {
- h = 64;
- w = 37;
- mw = 136;
+ x = 40;
+ y = 34;
+ } else if (isSpectrum()) {
+ x = 64;
+ y = 37;
}
- surface->copyRectToSurface((const Graphics::Surface)*_riddleTopFrame, h, w, Common::Rect(0, 0, _riddleTopFrame->w, _riddleTopFrame->h));
- for (w += _riddleTopFrame->h; w < mw;) {
- surface->copyRectToSurface((const Graphics::Surface)*_riddleBackgroundFrame, h, w, Common::Rect(0, 0, _riddleBackgroundFrame->w, _riddleBackgroundFrame->h));
- w += _riddleBackgroundFrame->h;
+ surface->copyRectToSurface((const Graphics::Surface)*_riddleTopFrame, x, y, Common::Rect(0, 0, _riddleTopFrame->w, _riddleTopFrame->h));
+ for (y += _riddleTopFrame->h; y < maxWidth;) {
+ surface->copyRectToSurface((const Graphics::Surface)*_riddleBackgroundFrame, x, y, Common::Rect(0, 0, _riddleBackgroundFrame->w, _riddleBackgroundFrame->h));
+ y += _riddleBackgroundFrame->h;
}
- surface->copyRectToSurface((const Graphics::Surface)*_riddleBottomFrame, h, mw, Common::Rect(0, 0, _riddleBottomFrame->w, _riddleBottomFrame->h - 1));
+ surface->copyRectToSurface((const Graphics::Surface)*_riddleBottomFrame, x, maxWidth, Common::Rect(0, 0, _riddleBottomFrame->w, _riddleBottomFrame->h - 1));
- int x = 0;
- int y = 0;
- int numberOfLines = 7;
+ Common::Array<RiddleText> riddleMessages = _riddleList[riddle]._lines;
+ x = _riddleList[riddle]._origin.x;
+ y = _riddleList[riddle]._origin.y;
if (isDOS()) {
- x = 60;
- y = 62;
- } else if (isSpectrum() || isCPC()) {
- x = 65;
- y = 70;
+ x = 38;
+ y = 33;
+ } else if (isSpectrum()) {
+ x = 64;
+ y = 36;
}
- for (int i = 0; i < numberOfLines; i++) {
- drawStringInSurface(riddleMessages[i], x, y, front, back, surface);
- y = y + 10;
+ for (int i = 0; i < int(riddleMessages.size()); i++) {
+ x = x + riddleMessages[i]._dx;
+ y = y + riddleMessages[i]._dy;
+ drawStringInSurface(riddleMessages[i]._text, x, y, front, back, surface);
}
drawFullscreenSurface(surface);
}
diff --git a/engines/freescape/games/castle/castle.h b/engines/freescape/games/castle/castle.h
index d879146149f..5324c6747d4 100644
--- a/engines/freescape/games/castle/castle.h
+++ b/engines/freescape/games/castle/castle.h
@@ -21,6 +21,19 @@
namespace Freescape {
+struct RiddleText {
+ int8 _dx;
+ int8 _dy;
+ Common::String _text;
+
+ RiddleText(int8 dx, int8 dy, const Common::String &text) : _dx(dx), _dy(dy), _text(text) {}
+};
+
+struct Riddle {
+ Common::Point _origin;
+ Common::Array<RiddleText> _lines;
+};
+
class CastleEngine : public FreescapeEngine {
public:
CastleEngine(OSystem *syst, const ADGameDescription *gd);
@@ -71,7 +84,7 @@ public:
Common::Error saveGameStreamExtended(Common::WriteStream *stream, bool isAutosave = false) override;
Common::Error loadGameStreamExtended(Common::SeekableReadStream *stream) override;
- Common::StringArray _riddleList;
+ Common::Array<Riddle> _riddleList;
Common::BitArray _fontPlane1;
Common::BitArray _fontPlane2;
Common::BitArray _fontPlane3;
diff --git a/engines/freescape/games/castle/dos.cpp b/engines/freescape/games/castle/dos.cpp
index 0739cb331e8..2e671c71be9 100644
--- a/engines/freescape/games/castle/dos.cpp
+++ b/engines/freescape/games/castle/dos.cpp
@@ -276,7 +276,7 @@ void CastleEngine::loadAssetsDOSFullGame() {
break;
case Common::EN_ANY:
stream = decryptFile("CMLE");
- loadRiddles(stream, 0xaae, 20);
+ loadRiddles(stream, 0xaae - 2 - 22 * 2, 22);
break;
default:
error("Invalid or unsupported language: %x", _language);
diff --git a/engines/freescape/games/castle/zx.cpp b/engines/freescape/games/castle/zx.cpp
index 2f7f2ff74ab..724bcdf420d 100644
--- a/engines/freescape/games/castle/zx.cpp
+++ b/engines/freescape/games/castle/zx.cpp
@@ -113,14 +113,15 @@ void CastleEngine::loadAssetsZXFullGame() {
loadMessagesVariableSize(&file, 0x4bd, 71);
switch (_language) {
case Common::ES_ESP:
- loadRiddles(&file, 0x1470 - 4, 8);
+ loadRiddles(&file, 0x1470 - 4 - 2 - 9 * 2, 9);
+ assert(0);
loadMessagesVariableSize(&file, 0xf3d, 71);
load8bitBinary(&file, 0x6aab - 2, 16);
loadSpeakerFxZX(&file, 0xca0, 0xcdc);
loadFonts(&file, 0x1218 + 16, _font);
break;
case Common::EN_ANY:
- loadRiddles(&file, 0x145c, 9);
+ loadRiddles(&file, 0x145c - 2 - 9 * 2, 9);
load8bitBinary(&file, 0x6a3b, 16);
loadSpeakerFxZX(&file, 0xc91, 0xccd);
loadFonts(&file, 0x1219, _font);
More information about the Scummvm-git-logs
mailing list