[Scummvm-git-logs] scummvm master -> 74cad91d12253f9afea06ac2aac93efd45c329a0
neuromancer
noreply at scummvm.org
Sun Oct 1 19:12:18 UTC 2023
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
74cad91d12 FREESCAPE: initial support for the eclipse demo for cpc
Commit: 74cad91d12253f9afea06ac2aac93efd45c329a0
https://github.com/scummvm/scummvm/commit/74cad91d12253f9afea06ac2aac93efd45c329a0
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2023-10-01T21:01:02+02:00
Commit Message:
FREESCAPE: initial support for the eclipse demo for cpc
Changed paths:
A engines/freescape/games/eclipse/cpc.cpp
A engines/freescape/games/eclipse/dos.cpp
A engines/freescape/games/eclipse/eclipse.cpp
R engines/freescape/games/eclipse.cpp
engines/freescape/assets.cpp
engines/freescape/detection.cpp
engines/freescape/freescape.h
engines/freescape/module.mk
diff --git a/engines/freescape/assets.cpp b/engines/freescape/assets.cpp
index ae9d740b1e9..e8dd4e27d89 100644
--- a/engines/freescape/assets.cpp
+++ b/engines/freescape/assets.cpp
@@ -65,6 +65,8 @@ void FreescapeEngine::loadAssetsDemo() {
loadAssetsDOSDemo();
} else if (isSpectrum()) {
loadAssetsZXDemo();
+ } else if (isCPC()) {
+ loadAssetsCPCDemo();
} else
error("Unsupported demo");
}
diff --git a/engines/freescape/detection.cpp b/engines/freescape/detection.cpp
index faa0190aeae..088e9e5ebce 100644
--- a/engines/freescape/detection.cpp
+++ b/engines/freescape/detection.cpp
@@ -441,6 +441,19 @@ static const ADGameDescription gameDescriptions[] = {
ADGF_UNSTABLE,
GUIO2(GUIO_NOMIDI, GAMEOPTION_AUTOMATIC_DRILLING)
},
+ {
+ "totaleclipse",
+ "Demo",
+ {
+ {"TECON.BIN", 0, "990f9a5e6d29142f98d53e53b1e43cc9", 16512},
+ {"TEPROG.BIN", 0, "093a3a9a65c7914b93e13675fedafcc6", 29824},
+ AD_LISTEND
+ },
+ Common::EN_ANY,
+ Common::kPlatformAmstradCPC,
+ ADGF_UNSTABLE | ADGF_DEMO,
+ GUIO1(GUIO_NOMIDI)
+ },
{
"totaleclipse",
"",
diff --git a/engines/freescape/freescape.h b/engines/freescape/freescape.h
index 7f4fe705e34..0799710f1bb 100644
--- a/engines/freescape/freescape.h
+++ b/engines/freescape/freescape.h
@@ -618,7 +618,13 @@ public:
void gotoArea(uint16 areaID, int entranceID) override;
void loadAssetsDOSFullGame() override;
- void drawUI() override;
+
+ void initDOS();
+ void initCPC();
+ void loadAssetsCPCDemo() override;
+
+ void drawDOSUI(Graphics::Surface *surface) override;
+ void drawCPCUI(Graphics::Surface *surface) override;
Common::Error saveGameStreamExtended(Common::WriteStream *stream, bool isAutosave = false) override;
Common::Error loadGameStreamExtended(Common::SeekableReadStream *stream) override;
diff --git a/engines/freescape/games/eclipse/cpc.cpp b/engines/freescape/games/eclipse/cpc.cpp
new file mode 100644
index 00000000000..35d6cbcfeed
--- /dev/null
+++ b/engines/freescape/games/eclipse/cpc.cpp
@@ -0,0 +1,95 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "common/file.h"
+#include "common/memstream.h"
+
+#include "freescape/freescape.h"
+#include "freescape/games/dark/dark.h"
+#include "freescape/language/8bitDetokeniser.h"
+
+namespace Freescape {
+
+void EclipseEngine::initCPC() {
+ _viewArea = Common::Rect(36 + 3, 24 + 8, 284, 130 + 3);
+}
+
+extern byte kCPCPaletteTitleData[4][3];
+extern byte kCPCPaletteBorderData[4][3];
+
+extern Graphics::ManagedSurface *readCPCImage(Common::SeekableReadStream *file, bool mode0);
+
+void EclipseEngine::loadAssetsCPCDemo() {
+ Common::File file;
+
+ file.open("TECON.BIN");
+ if (!file.isOpen())
+ error("Failed to open TECON.BIN");
+
+ _border = readCPCImage(&file, true);
+ _border->setPalette((byte*)&kCPCPaletteTitleData, 0, 4);
+
+ file.close();
+ file.open("TEPROG.BIN");
+
+ if (!file.isOpen())
+ error("Failed to open TEPROG.BIN");
+
+ loadFonts(&file, 0x63ce);
+ load8bitBinary(&file, 0x65c6, 16);
+ for (auto &it : _areaMap) {
+ it._value->_name = "Now training";
+ it._value->addStructure(_areaMap[255]);
+ for (int16 id = 183; id < 207; id++)
+ it._value->addObjectFromArea(id, _areaMap[255]);
+ }
+ //_indicators.push_back(loadBundledImage("dark_fallen_indicator"));
+ //_indicators.push_back(loadBundledImage("dark_crouch_indicator"));
+ //_indicators.push_back(loadBundledImage("dark_walk_indicator"));
+ //_indicators.push_back(loadBundledImage("dark_jet_indicator"));
+
+ //for (auto &it : _indicators)
+ // it->convertToInPlace(_gfx->_texturePixelFormat, nullptr);
+}
+
+void EclipseEngine::drawCPCUI(Graphics::Surface *surface) {
+ uint32 color = _currentArea->_underFireBackgroundColor;
+ uint8 r, g, b;
+
+ _gfx->readFromPalette(color, r, g, b);
+ uint32 front = _gfx->_texturePixelFormat.ARGBToColor(0xFF, r, g, b);
+
+ color = _currentArea->_usualBackgroundColor;
+ if (_gfx->_colorRemaps && _gfx->_colorRemaps->contains(color)) {
+ color = (*_gfx->_colorRemaps)[color];
+ }
+
+ _gfx->readFromPalette(color, r, g, b);
+ uint32 back = _gfx->_texturePixelFormat.ARGBToColor(0xFF, r, g, b);
+
+ int score = _gameStateVars[k8bitVariableScore];
+
+ if (!_currentAreaMessages.empty())
+ drawStringInSurface(_currentAreaMessages[0], 102, 135, front, back, surface);
+ drawStringInSurface(Common::String::format("%07d", score), 136, 6, front, back, surface);
+}
+
+} // End of namespace Freescape
\ No newline at end of file
diff --git a/engines/freescape/games/eclipse/dos.cpp b/engines/freescape/games/eclipse/dos.cpp
new file mode 100644
index 00000000000..5b9b28f751e
--- /dev/null
+++ b/engines/freescape/games/eclipse/dos.cpp
@@ -0,0 +1,79 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "common/file.h"
+
+#include "freescape/freescape.h"
+#include "freescape/language/8bitDetokeniser.h"
+
+namespace Freescape {
+
+extern byte kEGADefaultPalette[16][3];
+
+void EclipseEngine::initDOS() {
+ _viewArea = Common::Rect(40, 32, 280, 132);
+}
+
+void EclipseEngine::loadAssetsDOSFullGame() {
+ Common::File file;
+ if (_renderMode == Common::kRenderEGA) {
+ file.open("SCN1E.DAT");
+ if (file.isOpen()) {
+ _title = load8bitBinImage(&file, 0x0);
+ _title->setPalette((byte *)&kEGADefaultPalette, 0, 16);
+ }
+ file.close();
+ file.open("TOTEE.EXE");
+
+ if (!file.isOpen())
+ error("Failed to open TOTEE.EXE");
+
+ loadFonts(&file, 0xd403);
+ load8bitBinary(&file, 0x3ce0, 16);
+ for (auto &it : _areaMap) {
+ it._value->addStructure(_areaMap[255]);
+ for (int16 id = 183; id < 207; id++)
+ it._value->addObjectFromArea(id, _areaMap[255]);
+ }
+ _border = load8bitBinImage(&file, 0x210);
+ _border->setPalette((byte *)&kEGADefaultPalette, 0, 16);
+ } else if (_renderMode == Common::kRenderCGA) {
+ file.open("TOTEC.EXE");
+
+ if (!file.isOpen())
+ error("Failed to open TOTEC.EXE");
+ load8bitBinary(&file, 0x7bb0, 4); // TODO
+ } else
+ error("Invalid or unsupported render mode %s for Total Eclipse", Common::getRenderModeDescription(_renderMode));
+}
+
+void EclipseEngine::drawDOSUI(Graphics::Surface *surface) {
+ int score = _gameStateVars[k8bitVariableScore];
+ uint32 yellow = _gfx->_texturePixelFormat.ARGBToColor(0xFF, 0xFF, 0xFF, 0x55);
+ uint32 black = _gfx->_texturePixelFormat.ARGBToColor(0xFF, 0x00, 0x00, 0x00);
+ uint32 white = _gfx->_texturePixelFormat.ARGBToColor(0xFF, 0xFF, 0xFF, 0xFF);
+
+ if (!_currentAreaMessages.empty())
+ drawStringInSurface(_currentAreaMessages[0], 102, 135, black, yellow, surface);
+ drawStringInSurface(Common::String::format("%07d", score), 136, 6, black, white, surface);
+}
+
+} // End of namespace Freescape
\ No newline at end of file
diff --git a/engines/freescape/games/eclipse.cpp b/engines/freescape/games/eclipse/eclipse.cpp
similarity index 59%
rename from engines/freescape/games/eclipse.cpp
rename to engines/freescape/games/eclipse/eclipse.cpp
index 7ba7a435dc1..106d94aa515 100644
--- a/engines/freescape/games/eclipse.cpp
+++ b/engines/freescape/games/eclipse/eclipse.cpp
@@ -48,7 +48,11 @@ static const char *rawMessagesTable[] = {
NULL};
EclipseEngine::EclipseEngine(OSystem *syst, const ADGameDescription *gd) : FreescapeEngine(syst, gd) {
- _viewArea = Common::Rect(40, 32, 280, 132);
+ if (isDOS())
+ initDOS();
+ else if (isCPC())
+ initCPC();
+
_playerHeightNumber = 1;
_playerHeights.push_back(16);
_playerHeights.push_back(48);
@@ -74,41 +78,6 @@ EclipseEngine::EclipseEngine(OSystem *syst, const ADGameDescription *gd) : Frees
_playerSteps.push_back(25);
}
-extern byte kEGADefaultPalette[16][3];
-
-void EclipseEngine::loadAssetsDOSFullGame() {
- Common::File file;
- if (_renderMode == Common::kRenderEGA) {
- file.open("SCN1E.DAT");
- if (file.isOpen()) {
- _title = load8bitBinImage(&file, 0x0);
- _title->setPalette((byte *)&kEGADefaultPalette, 0, 16);
- }
- file.close();
- file.open("TOTEE.EXE");
-
- if (!file.isOpen())
- error("Failed to open TOTEE.EXE");
-
- loadFonts(&file, 0xd403);
- load8bitBinary(&file, 0x3ce0, 16);
- for (auto &it : _areaMap) {
- it._value->addStructure(_areaMap[255]);
- for (int16 id = 183; id < 207; id++)
- it._value->addObjectFromArea(id, _areaMap[255]);
- }
- _border = load8bitBinImage(&file, 0x210);
- _border->setPalette((byte *)&kEGADefaultPalette, 0, 16);
- } else if (_renderMode == Common::kRenderCGA) {
- file.open("TOTEC.EXE");
-
- if (!file.isOpen())
- error("Failed to open TOTEC.EXE");
- load8bitBinary(&file, 0x7bb0, 4); // TODO
- } else
- error("Invalid or unsupported render mode %s for Total Eclipse", Common::getRenderModeDescription(_renderMode));
-}
-
void EclipseEngine::gotoArea(uint16 areaID, int entranceID) {
debugC(1, kFreescapeDebugMove, "Jumping to area: %d, entrance: %d", areaID, entranceID);
@@ -131,31 +100,12 @@ void EclipseEngine::gotoArea(uint16 areaID, int entranceID) {
_gfx->_keyColor = 0;
} else
_gfx->_keyColor = 255;
-}
-
-void EclipseEngine::drawUI() {
- _gfx->setViewport(_fullscreenViewArea);
-
- Graphics::Surface *surface = new Graphics::Surface();
- surface->create(_screenW, _screenH, _gfx->_texturePixelFormat);
- uint32 gray = _gfx->_texturePixelFormat.ARGBToColor(0x00, 0xA0, 0xA0, 0xA0);
- surface->fillRect(_fullscreenViewArea, gray);
- drawCrossair(surface);
-
- int score = _gameStateVars[k8bitVariableScore];
- uint32 yellow = _gfx->_texturePixelFormat.ARGBToColor(0xFF, 0xFF, 0xFF, 0x55);
- uint32 black = _gfx->_texturePixelFormat.ARGBToColor(0xFF, 0x00, 0x00, 0x00);
- uint32 white = _gfx->_texturePixelFormat.ARGBToColor(0xFF, 0xFF, 0xFF, 0xFF);
-
- if (!_currentAreaMessages.empty())
- drawStringInSurface(_currentAreaMessages[0], 102, 135, black, yellow, surface);
- drawStringInSurface(Common::String::format("%07d", score), 136, 6, black, white, surface);
- drawFullscreenSurface(surface);
- surface->free();
- delete surface;
+ swapPalette(areaID);
+ //_currentArea->_skyColor = isCPC() ? 1 : 0;
+ _currentArea->_usualBackgroundColor = isCPC() ? 1 : 0;
- _gfx->setViewport(_viewArea);
+ resetInput();
}
Common::Error EclipseEngine::saveGameStreamExtended(Common::WriteStream *stream, bool isAutosave) {
diff --git a/engines/freescape/module.mk b/engines/freescape/module.mk
index 61254259f01..1822c10043b 100644
--- a/engines/freescape/module.mk
+++ b/engines/freescape/module.mk
@@ -18,7 +18,9 @@ MODULE_OBJS := \
games/driller/dos.o \
games/driller/driller.o \
games/driller/zx.o \
- games/eclipse.o \
+ games/eclipse/dos.o \
+ games/eclipse/eclipse.o \
+ games/eclipse/cpc.o \
games/palettes.o \
gfx.o \
loaders/8bitImage.o \
More information about the Scummvm-git-logs
mailing list