[Scummvm-git-logs] scummvm master -> f470ba3f6ef7ffbc01e392843f0760e486aa5771
neuromancer
noreply at scummvm.org
Sat Mar 11 10:36:49 UTC 2023
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:
649a06d06f FREESCAPE: moved dark side related code to its own directory
d82a3ff41d FREESCAPE: moved some functions to the main freescape class and reorganized game code
ec026a353b FREESCAPE: moved more functions to the main freescape class and reorganized game code
80f6c6ed87 FREESCAPE: moved code from dark dos release into its dedicated file
4940669e24 FREESCAPE: simplified driller cpc color handling code
f470ba3f6e FREESCAPE: commented unused variable
Commit: 649a06d06f081d7b398d7f91f92815df2de7f0c1
https://github.com/scummvm/scummvm/commit/649a06d06f081d7b398d7f91f92815df2de7f0c1
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2023-03-11T11:37:38+01:00
Commit Message:
FREESCAPE: moved dark side related code to its own directory
Changed paths:
A engines/freescape/games/dark/dark.cpp
A engines/freescape/games/dark/dos.cpp
R engines/freescape/games/dark.cpp
engines/freescape/module.mk
diff --git a/engines/freescape/games/dark.cpp b/engines/freescape/games/dark/dark.cpp
similarity index 82%
rename from engines/freescape/games/dark.cpp
rename to engines/freescape/games/dark/dark.cpp
index 1a10368adb1..29414dbbbc9 100644
--- a/engines/freescape/games/dark.cpp
+++ b/engines/freescape/games/dark/dark.cpp
@@ -298,69 +298,6 @@ void DarkEngine::updateTimeVariables() {
}
}
-void DarkEngine::drawDOSUI(Graphics::Surface *surface) {
- uint32 color = _renderMode == Common::kRenderCGA ? 1 : 14;
- 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];
- drawStringInSurface(Common::String::format("%04d", int(2 * _position.x())), 199, 137, front, back, surface);
- drawStringInSurface(Common::String::format("%04d", int(2 * _position.z())), 199, 145, front, back, surface);
- drawStringInSurface(Common::String::format("%04d", int(2 * _position.y())), 199, 153, front, back, surface);
-
- drawStringInSurface(Common::String::format("%02d", int(_angleRotations[_angleRotationIndex])), 71, 168, front, back, surface);
- drawStringInSurface(Common::String::format("%3d", _playerSteps[_playerStepIndex]), 71, 177, front, back, surface);
- drawStringInSurface(Common::String::format("%07d", score), 95, 8, front, back, surface);
-
- int seconds, minutes, hours;
- getTimeFromCountdown(seconds, minutes, hours);
- // TODO: implement binary clock
-
- Common::String message;
- int deadline;
- getLatestMessages(message, deadline);
- if (deadline <= _countdown) {
- drawStringInSurface(message, 112, 177, back, front, surface);
- _temporaryMessages.push_back(message);
- _temporaryMessageDeadlines.push_back(deadline);
- } else
- drawStringInSurface(_currentArea->_name, 112, 177, front, back, surface);
-
- int energy = _gameStateVars[k8bitVariableEnergy]; // called fuel in this game
- int shield = _gameStateVars[k8bitVariableShield];
-
- _gfx->readFromPalette(9, r, g, b);
- uint32 blue = _gfx->_texturePixelFormat.ARGBToColor(0xFF, r, g, b);
-
- if (shield >= 0) {
- Common::Rect shieldBar;
- shieldBar = Common::Rect(72, 139, 151 - (k8bitMaxShield - shield), 146);
- surface->fillRect(shieldBar, front);
-
- shieldBar = Common::Rect(72, 140, 151 - (k8bitMaxShield - shield), 145);
- surface->fillRect(shieldBar, blue);
- }
-
- if (energy >= 0) {
- Common::Rect energyBar;
- energyBar = Common::Rect(72, 147, 151 - (k8bitMaxEnergy - energy), 154);
- surface->fillRect(energyBar, front);
-
- energyBar = Common::Rect(72, 148, 151 - (k8bitMaxEnergy - energy), 153);
- surface->fillRect(energyBar, blue);
- }
-}
-
void DarkEngine::drawUI() {
Graphics::Surface *surface = nullptr;
if (_border) { // This can be removed when all the borders are loaded
diff --git a/engines/freescape/games/dark/dos.cpp b/engines/freescape/games/dark/dos.cpp
new file mode 100644
index 00000000000..6a3c5aff2ae
--- /dev/null
+++ b/engines/freescape/games/dark/dos.cpp
@@ -0,0 +1,92 @@
+/* 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 {
+
+void DarkEngine::drawDOSUI(Graphics::Surface *surface) {
+ uint32 color = _renderMode == Common::kRenderCGA ? 1 : 14;
+ 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];
+ drawStringInSurface(Common::String::format("%04d", int(2 * _position.x())), 199, 137, front, back, surface);
+ drawStringInSurface(Common::String::format("%04d", int(2 * _position.z())), 199, 145, front, back, surface);
+ drawStringInSurface(Common::String::format("%04d", int(2 * _position.y())), 199, 153, front, back, surface);
+
+ drawStringInSurface(Common::String::format("%02d", int(_angleRotations[_angleRotationIndex])), 71, 168, front, back, surface);
+ drawStringInSurface(Common::String::format("%3d", _playerSteps[_playerStepIndex]), 71, 177, front, back, surface);
+ drawStringInSurface(Common::String::format("%07d", score), 95, 8, front, back, surface);
+
+ int seconds, minutes, hours;
+ getTimeFromCountdown(seconds, minutes, hours);
+ // TODO: implement binary clock
+
+ Common::String message;
+ int deadline;
+ getLatestMessages(message, deadline);
+ if (deadline <= _countdown) {
+ drawStringInSurface(message, 112, 177, back, front, surface);
+ _temporaryMessages.push_back(message);
+ _temporaryMessageDeadlines.push_back(deadline);
+ } else
+ drawStringInSurface(_currentArea->_name, 112, 177, front, back, surface);
+
+ int energy = _gameStateVars[k8bitVariableEnergy]; // called fuel in this game
+ int shield = _gameStateVars[k8bitVariableShield];
+
+ _gfx->readFromPalette(9, r, g, b);
+ uint32 blue = _gfx->_texturePixelFormat.ARGBToColor(0xFF, r, g, b);
+
+ if (shield >= 0) {
+ Common::Rect shieldBar;
+ shieldBar = Common::Rect(72, 139, 151 - (k8bitMaxShield - shield), 146);
+ surface->fillRect(shieldBar, front);
+
+ shieldBar = Common::Rect(72, 140, 151 - (k8bitMaxShield - shield), 145);
+ surface->fillRect(shieldBar, blue);
+ }
+
+ if (energy >= 0) {
+ Common::Rect energyBar;
+ energyBar = Common::Rect(72, 147, 151 - (k8bitMaxEnergy - energy), 154);
+ surface->fillRect(energyBar, front);
+
+ energyBar = Common::Rect(72, 148, 151 - (k8bitMaxEnergy - energy), 153);
+ surface->fillRect(energyBar, blue);
+ }
+}
+
+} // End of namespace Freescape
\ No newline at end of file
diff --git a/engines/freescape/module.mk b/engines/freescape/module.mk
index 0d3c8b7d085..771c5b78e7f 100644
--- a/engines/freescape/module.mk
+++ b/engines/freescape/module.mk
@@ -5,7 +5,8 @@ MODULE_OBJS := \
demo.o \
freescape.o \
games/castle.o \
- games/dark.o \
+ games/dark/dark.o \
+ games/dark/dos.o \
games/driller/amiga.o \
games/driller/atari.o \
games/driller/cpc.o \
Commit: d82a3ff41d70792eef32cbbc6c796149a4720a54
https://github.com/scummvm/scummvm/commit/d82a3ff41d70792eef32cbbc6c796149a4720a54
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2023-03-11T11:37:38+01:00
Commit Message:
FREESCAPE: moved some functions to the main freescape class and reorganized game code
Changed paths:
A engines/freescape/assets.cpp
A engines/freescape/ui.cpp
engines/freescape/freescape.cpp
engines/freescape/freescape.h
engines/freescape/games/castle.cpp
engines/freescape/games/dark/dark.cpp
engines/freescape/games/driller/driller.cpp
engines/freescape/games/eclipse.cpp
engines/freescape/module.mk
diff --git a/engines/freescape/assets.cpp b/engines/freescape/assets.cpp
new file mode 100644
index 00000000000..a43b59d02c1
--- /dev/null
+++ b/engines/freescape/assets.cpp
@@ -0,0 +1,72 @@
+/* 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/>.
+ *
+ */
+
+// Based on Phantasma code by Thomas Harte (2013),
+// available at https://github.com/TomHarte/Phantasma/ (MIT)
+
+#include "freescape/freescape.h"
+
+namespace Freescape {
+
+void FreescapeEngine::loadAssets() {
+ if (isDemo())
+ loadAssetsDemo();
+ else
+ loadAssetsFullGame();
+}
+
+void FreescapeEngine::loadAssetsDemo() {
+}
+
+void FreescapeEngine::loadAssetsAtariDemo() {
+}
+
+void FreescapeEngine::loadAssetsAmigaDemo() {
+}
+
+void FreescapeEngine::loadAssetsDOSDemo() {
+}
+
+void FreescapeEngine::loadAssetsZXDemo() {
+}
+
+void FreescapeEngine::loadAssetsCPCDemo() {
+}
+
+void FreescapeEngine::loadAssetsFullGame() {
+}
+
+void FreescapeEngine::loadAssetsAtariFullGame() {
+}
+
+void FreescapeEngine::loadAssetsAmigaFullGame() {
+}
+
+void FreescapeEngine::loadAssetsDOSFullGame() {
+}
+
+void FreescapeEngine::loadAssetsZXFullGame() {
+}
+
+void FreescapeEngine::loadAssetsCPCFullGame() {
+}
+
+} // End of namespace Freescape
diff --git a/engines/freescape/freescape.cpp b/engines/freescape/freescape.cpp
index 27567e85686..c0aee262ed7 100644
--- a/engines/freescape/freescape.cpp
+++ b/engines/freescape/freescape.cpp
@@ -203,10 +203,6 @@ void FreescapeEngine::drawTitle() {
_gfx->setViewport(_viewArea);
}
-void FreescapeEngine::loadAssets() {
- error("Function \"%s\" not implemented", __FUNCTION__);
-}
-
// Taken from the Myst 3 codebase, it should be abstracted
Math::Vector3d FreescapeEngine::directionToVector(float pitch, float heading) {
Math::Vector3d v;
@@ -222,25 +218,6 @@ Math::Vector3d FreescapeEngine::directionToVector(float pitch, float heading) {
return v;
}
-void FreescapeEngine::drawUI() {
- // TODO: crossair
- _gfx->setViewport(_viewArea);
-}
-
-void FreescapeEngine::drawInfoMenu() {
- warning("Function \"%s\" not implemented", __FUNCTION__);
-}
-
-void FreescapeEngine::drawCrossair(Graphics::Surface *surface) {
- uint32 white = _gfx->_texturePixelFormat.ARGBToColor(0xFF, 0x00, 0x00, 0x00);
-
- surface->drawLine(_crossairPosition.x - 3, _crossairPosition.y, _crossairPosition.x - 2, _crossairPosition.y, white);
- surface->drawLine(_crossairPosition.x + 2, _crossairPosition.y, _crossairPosition.x + 3, _crossairPosition.y, white);
-
- surface->drawLine(_crossairPosition.x, _crossairPosition.y - 3, _crossairPosition.x, _crossairPosition.y - 2, white);
- surface->drawLine(_crossairPosition.x, _crossairPosition.y + 2, _crossairPosition.x, _crossairPosition.y + 3, white);
-}
-
void FreescapeEngine::centerCrossair() {
_crossairPosition.x = _viewArea.left + _viewArea.width() / 2;
_crossairPosition.y = _viewArea.top + _viewArea.height() / 2;
@@ -295,7 +272,6 @@ void FreescapeEngine::drawBackground() {
_gfx->clear(_currentArea->_skyColor);
}
-
void FreescapeEngine::drawFrame() {
_gfx->updateProjectionMatrix(70.0, _nearClipPlane, _farClipPlane);
_gfx->positionCamera(_position, _position + _cameraFront);
diff --git a/engines/freescape/freescape.h b/engines/freescape/freescape.h
index d2f8405437a..f0418c893f8 100644
--- a/engines/freescape/freescape.h
+++ b/engines/freescape/freescape.h
@@ -135,7 +135,31 @@ public:
// Parsing assets
uint8 _binaryBits;
- virtual void loadAssets();
+ void loadAssets();
+ virtual void loadAssetsDemo();
+ virtual void loadAssetsFullGame();
+
+ virtual void loadAssetsAtariFullGame();
+ virtual void loadAssetsAtariDemo();
+
+ virtual void loadAssetsAmigaFullGame();
+ virtual void loadAssetsAmigaDemo();
+
+ virtual void loadAssetsDOSFullGame();
+ virtual void loadAssetsDOSDemo();
+
+ virtual void loadAssetsZXFullGame();
+ virtual void loadAssetsZXDemo();
+
+ virtual void loadAssetsCPCFullGame();
+ virtual void loadAssetsCPCDemo();
+
+ virtual void drawDOSUI(Graphics::Surface *surface);
+ virtual void drawZXUI(Graphics::Surface *surface);
+ virtual void drawCPCUI(Graphics::Surface *surface);
+ virtual void drawC64UI(Graphics::Surface *surface);
+ virtual void drawAmigaAtariSTUI(Graphics::Surface *surface);
+
Common::Archive *_dataBundle;
void loadDataBundle();
void loadBundledImages();
@@ -419,8 +443,6 @@ public:
void titleScreen() override;
void processBorder() override;
- void loadAssets() override;
- void drawUI() override;
void drawInfoMenu() override;
void pressedKey(const int keycode) override;
@@ -437,29 +459,27 @@ private:
void removeDrill(Area *area);
void addSkanner(Area *area);
- void loadAssetsDemo();
- void loadAssetsFullGame();
+ void loadAssetsDemo() override;
+ void loadAssetsFullGame() override;
- void loadAssetsAtariFullGame();
- void loadAssetsAtariDemo();
+ void loadAssetsAtariFullGame() override;
+ void loadAssetsAtariDemo() override;
- void loadAssetsAmigaFullGame();
- void loadAssetsAmigaDemo();
+ void loadAssetsAmigaFullGame() override;
+ void loadAssetsAmigaDemo() override;
- void loadAssetsDOSFullGame();
- void loadAssetsDOSDemo();
+ void loadAssetsDOSFullGame() override;
+ void loadAssetsDOSDemo() override;
- void loadAssetsZXFullGame();
- void loadAssetsZXDemo();
+ void loadAssetsZXFullGame() override;
- void loadAssetsCPCFullGame();
- void loadAssetsCPCDemo();
+ void loadAssetsCPCFullGame() override;
- void drawDOSUI(Graphics::Surface *surface);
- void drawZXUI(Graphics::Surface *surface);
- void drawCPCUI(Graphics::Surface *surface);
- void drawC64UI(Graphics::Surface *surface);
- void drawAmigaAtariSTUI(Graphics::Surface *surface);
+ void drawDOSUI(Graphics::Surface *surface) override;
+ void drawZXUI(Graphics::Surface *surface) override;
+ void drawCPCUI(Graphics::Surface *surface) override;
+ void drawC64UI(Graphics::Surface *surface) override;
+ void drawAmigaAtariSTUI(Graphics::Surface *surface) override;
Graphics::ManagedSurface *load8bitTitleImage(Common::SeekableReadStream *file, int offset);
Graphics::ManagedSurface *load8bitDemoImage(Common::SeekableReadStream *file, int offset);
@@ -475,7 +495,6 @@ public:
uint32 _initialFuel;
uint32 _initialShield;
- void loadAssets() override;
void initGameState() override;
void borderScreen() override;
void titleScreen() override;
@@ -505,7 +524,7 @@ class EclipseEngine : public FreescapeEngine {
public:
EclipseEngine(OSystem *syst, const ADGameDescription *gd);
- void loadAssets() override;
+ void loadAssetsFullGame() override;
void titleScreen() override;
void gotoArea(uint16 areaID, int entranceID) override;
@@ -519,7 +538,7 @@ class CastleEngine : public FreescapeEngine {
public:
CastleEngine(OSystem *syst, const ADGameDescription *gd);
- void loadAssets() override;
+ void loadAssetsFullGame() override;
void gotoArea(uint16 areaID, int entranceID) override;
Common::Error saveGameStreamExtended(Common::WriteStream *stream, bool isAutosave = false) override;
diff --git a/engines/freescape/games/castle.cpp b/engines/freescape/games/castle.cpp
index 249c3b32064..1830891b8ed 100644
--- a/engines/freescape/games/castle.cpp
+++ b/engines/freescape/games/castle.cpp
@@ -56,7 +56,7 @@ Common::SeekableReadStream *CastleEngine::decryptFile(const Common::String filen
return (new Common::MemoryReadStream(encryptedBuffer, size));
}
-void CastleEngine::loadAssets() {
+void CastleEngine::loadAssetsFullGame() {
Common::SeekableReadStream *stream = nullptr;
stream = decryptFile("CMLE");
diff --git a/engines/freescape/games/dark/dark.cpp b/engines/freescape/games/dark/dark.cpp
index 29414dbbbc9..eadc74d1c12 100644
--- a/engines/freescape/games/dark/dark.cpp
+++ b/engines/freescape/games/dark/dark.cpp
@@ -61,13 +61,6 @@ void DarkEngine::titleScreen() {
}
}
-void DarkEngine::loadAssets() {
- if (isDemo())
- loadAssetsDemo();
- else
- loadAssetsFullGame();
-}
-
void DarkEngine::loadAssetsDemo() {
Common::File file;
if (isDOS() && _renderMode == Common::kRenderEGA) {
diff --git a/engines/freescape/games/driller/driller.cpp b/engines/freescape/games/driller/driller.cpp
index a9fb1974581..d132721d0ae 100644
--- a/engines/freescape/games/driller/driller.cpp
+++ b/engines/freescape/games/driller/driller.cpp
@@ -206,16 +206,6 @@ void DrillerEngine::loadGlobalObjects(Common::SeekableReadStream *file, int offs
_areaMap[255] = new Area(255, 0, globalObjectsByID, nullptr);
}
-void DrillerEngine::loadAssets() {
- if (isDemo())
- loadAssetsDemo();
- else
- loadAssetsFullGame();
-
- // Start playing music, if any, in any supported format
- playMusic("Matt Gray - The Best Of Reformation - 07 Driller Theme");
-}
-
void DrillerEngine::loadAssetsDemo() {
Common::File file;
if (isAmiga()) {
@@ -242,20 +232,7 @@ void DrillerEngine::loadAssetsFullGame() {
} else if (isCPC()) {
loadAssetsCPCFullGame();
} else if (isC64()) {
- if (_targetName.hasPrefix("spacestationoblivion")) {
- loadBundledImages();
- file.open("spacestationoblivion.c64.data");
- loadMessagesFixedSize(&file, 0x167a, 14, 20);
- //loadFonts(&file, 0xae54);
- load8bitBinary(&file, 0x8e02, 4);
- loadGlobalObjects(&file, 0x1855);
- } else if (_targetName.hasPrefix("driller")) {
- file.open("driller.c64.data");
- loadMessagesFixedSize(&file, 0x167a - 0x400, 14, 20);
- //loadFonts(&file, 0xae54);
- load8bitBinary(&file, 0x8e02 - 0x400, 4);
- loadGlobalObjects(&file, 0x1855 - 0x400);
- }
+ //loadAssetsC64FullGame();
} else if (isDOS()) {
loadAssetsDOSFullGame();
} else
@@ -289,41 +266,6 @@ void DrillerEngine::processBorder() {
FreescapeEngine::processBorder();
}
-void DrillerEngine::drawUI() {
- Graphics::Surface *surface = nullptr;
- if (_border) { // This can be removed when all the borders are loaded
- uint32 gray = _gfx->_texturePixelFormat.ARGBToColor(0x00, 0xA0, 0xA0, 0xA0);
- surface = new Graphics::Surface();
- surface->create(_screenW, _screenH, _gfx->_texturePixelFormat);
- surface->fillRect(_fullscreenViewArea, gray);
- drawCrossair(surface);
- } else
- return;
-
- if (isDOS())
- drawDOSUI(surface);
- else if (isC64())
- drawC64UI(surface);
- else if (isSpectrum())
- drawZXUI(surface);
- else if (isCPC())
- drawCPCUI(surface);
- else if (isAmiga() || isAtariST())
- drawAmigaAtariSTUI(surface);
-
- if (!_uiTexture)
- _uiTexture = _gfx->createTexture(surface);
- else
- _uiTexture->update(surface);
-
- _gfx->setViewport(_fullscreenViewArea);
- _gfx->drawTexturedRect2D(_fullscreenViewArea, _fullscreenViewArea, _uiTexture);
- _gfx->setViewport(_viewArea);
-
- surface->free();
- delete surface;
-}
-
void DrillerEngine::drawC64UI(Graphics::Surface *surface) {
uint32 color = 1;
uint8 r, g, b;
@@ -912,6 +854,9 @@ void DrillerEngine::initGameState() {
_lastMinute = minutes;
_demoIndex = 0;
_demoEvents.clear();
+
+ // Start playing music, if any, in any supported format
+ playMusic("Matt Gray - The Best Of Reformation - 07 Driller Theme");
}
bool DrillerEngine::checkIfGameEnded() {
diff --git a/engines/freescape/games/eclipse.cpp b/engines/freescape/games/eclipse.cpp
index 56baa42f46b..e8d67acbfb4 100644
--- a/engines/freescape/games/eclipse.cpp
+++ b/engines/freescape/games/eclipse.cpp
@@ -111,7 +111,7 @@ void EclipseEngine::titleScreen() {
}
}
-void EclipseEngine::loadAssets() {
+void EclipseEngine::loadAssetsFullGame() {
Common::File file;
if (_renderMode == Common::kRenderEGA) {
file.open("SCN1E.DAT");
diff --git a/engines/freescape/module.mk b/engines/freescape/module.mk
index 771c5b78e7f..f157394ca05 100644
--- a/engines/freescape/module.mk
+++ b/engines/freescape/module.mk
@@ -2,6 +2,7 @@ MODULE := engines/freescape
MODULE_OBJS := \
area.o \
+ assets.o \
demo.o \
freescape.o \
games/castle.o \
@@ -25,7 +26,8 @@ MODULE_OBJS := \
objects/geometricobject.o \
objects/sensor.o \
scr.o \
- sound.o
+ sound.o \
+ ui.o
ifdef USE_TINYGL
MODULE_OBJS += \
diff --git a/engines/freescape/ui.cpp b/engines/freescape/ui.cpp
new file mode 100644
index 00000000000..9bc829e4b93
--- /dev/null
+++ b/engines/freescape/ui.cpp
@@ -0,0 +1,90 @@
+/* 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 "freescape/freescape.h"
+
+namespace Freescape {
+
+void FreescapeEngine::drawUI() {
+ Graphics::Surface *surface = nullptr;
+ if (_border) { // This can be removed when all the borders are loaded
+ uint32 gray = _gfx->_texturePixelFormat.ARGBToColor(0x00, 0xA0, 0xA0, 0xA0);
+ surface = new Graphics::Surface();
+ surface->create(_screenW, _screenH, _gfx->_texturePixelFormat);
+ surface->fillRect(_fullscreenViewArea, gray);
+ drawCrossair(surface);
+ } else
+ return;
+
+ if (isDOS())
+ drawDOSUI(surface);
+ else if (isC64())
+ drawC64UI(surface);
+ else if (isSpectrum())
+ drawZXUI(surface);
+ else if (isCPC())
+ drawCPCUI(surface);
+ else if (isAmiga() || isAtariST())
+ drawAmigaAtariSTUI(surface);
+
+ if (!_uiTexture)
+ _uiTexture = _gfx->createTexture(surface);
+ else
+ _uiTexture->update(surface);
+
+ _gfx->setViewport(_fullscreenViewArea);
+ _gfx->drawTexturedRect2D(_fullscreenViewArea, _fullscreenViewArea, _uiTexture);
+ _gfx->setViewport(_viewArea);
+
+ surface->free();
+ delete surface;
+}
+
+void FreescapeEngine::drawInfoMenu() {
+ warning("Function \"%s\" not implemented", __FUNCTION__);
+}
+
+void FreescapeEngine::drawCrossair(Graphics::Surface *surface) {
+ uint32 white = _gfx->_texturePixelFormat.ARGBToColor(0xFF, 0x00, 0x00, 0x00);
+
+ surface->drawLine(_crossairPosition.x - 3, _crossairPosition.y, _crossairPosition.x - 2, _crossairPosition.y, white);
+ surface->drawLine(_crossairPosition.x + 2, _crossairPosition.y, _crossairPosition.x + 3, _crossairPosition.y, white);
+
+ surface->drawLine(_crossairPosition.x, _crossairPosition.y - 3, _crossairPosition.x, _crossairPosition.y - 2, white);
+ surface->drawLine(_crossairPosition.x, _crossairPosition.y + 2, _crossairPosition.x, _crossairPosition.y + 3, white);
+}
+
+void FreescapeEngine::drawAmigaAtariSTUI(Graphics::Surface *surface) {
+}
+
+void FreescapeEngine::drawDOSUI(Graphics::Surface *surface) {
+}
+
+void FreescapeEngine::drawZXUI(Graphics::Surface *surface) {
+}
+
+void FreescapeEngine::drawCPCUI(Graphics::Surface *surface) {
+}
+
+void FreescapeEngine::drawC64UI(Graphics::Surface *surface) {
+}
+
+} // End of namespace Freescape
Commit: ec026a353ba9287e00ca03be699b23a2fdcdcdf0
https://github.com/scummvm/scummvm/commit/ec026a353ba9287e00ca03be699b23a2fdcdcdf0
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2023-03-11T11:37:38+01:00
Commit Message:
FREESCAPE: moved more functions to the main freescape class and reorganized game code
Changed paths:
engines/freescape/assets.cpp
engines/freescape/freescape.h
engines/freescape/games/castle.cpp
engines/freescape/games/dark/dark.cpp
engines/freescape/games/driller/driller.cpp
engines/freescape/games/eclipse.cpp
diff --git a/engines/freescape/assets.cpp b/engines/freescape/assets.cpp
index a43b59d02c1..813dfb45683 100644
--- a/engines/freescape/assets.cpp
+++ b/engines/freescape/assets.cpp
@@ -22,6 +22,8 @@
// Based on Phantasma code by Thomas Harte (2013),
// available at https://github.com/TomHarte/Phantasma/ (MIT)
+#include "common/file.h"
+
#include "freescape/freescape.h"
namespace Freescape {
@@ -33,7 +35,37 @@ void FreescapeEngine::loadAssets() {
loadAssetsFullGame();
}
+void FreescapeEngine::loadAssetsFullGame() {
+ Common::File file;
+ if (isAmiga()) {
+ loadAssetsAmigaFullGame();
+ } else if (isAtariST()) {
+ loadAssetsAtariFullGame();
+ } else if (isSpectrum()) {
+ loadAssetsZXFullGame();
+ } else if (isCPC()) {
+ loadAssetsCPCFullGame();
+ } else if (isC64()) {
+ //loadAssetsC64FullGame();
+ } else if (isDOS()) {
+ loadAssetsDOSFullGame();
+ } else
+ error("Invalid or unsupported render mode %s for Driller", Common::getRenderModeDescription(_renderMode));
+}
+
void FreescapeEngine::loadAssetsDemo() {
+ Common::File file;
+ if (isAmiga()) {
+ loadAssetsAmigaDemo();
+ } else if (isAtariST()) {
+ loadAssetsAtariDemo();
+ } else if (isDOS()) {
+ loadAssetsDOSDemo();
+ } else
+ error("Unsupported demo for Driller");
+
+ _demoMode = !_disableDemoMode;
+ _angleRotationIndex = 0;
}
void FreescapeEngine::loadAssetsAtariDemo() {
@@ -51,9 +83,6 @@ void FreescapeEngine::loadAssetsZXDemo() {
void FreescapeEngine::loadAssetsCPCDemo() {
}
-void FreescapeEngine::loadAssetsFullGame() {
-}
-
void FreescapeEngine::loadAssetsAtariFullGame() {
}
diff --git a/engines/freescape/freescape.h b/engines/freescape/freescape.h
index f0418c893f8..46d817799cb 100644
--- a/engines/freescape/freescape.h
+++ b/engines/freescape/freescape.h
@@ -459,7 +459,6 @@ private:
void removeDrill(Area *area);
void addSkanner(Area *area);
- void loadAssetsDemo() override;
void loadAssetsFullGame() override;
void loadAssetsAtariFullGame() override;
@@ -504,14 +503,14 @@ public:
void pressedKey(const int keycode) override;
void executePrint(FCLInstruction &instruction) override;
- void loadAssetsDemo();
- void loadAssetsFullGame();
+ void loadAssetsDOSFullGame() override;
+ void loadAssetsDOSDemo() override;
+
int _lastTenSeconds;
void updateTimeVariables() override;
void executeMovementConditions() override;
- void drawUI() override;
- void drawDOSUI(Graphics::Surface *surface);
+ void drawDOSUI(Graphics::Surface *surface) override;
void drawFullscreenMessage(Common::String message);
Common::Error saveGameStreamExtended(Common::WriteStream *stream, bool isAutosave = false) override;
Common::Error loadGameStreamExtended(Common::SeekableReadStream *stream) override;
@@ -524,12 +523,12 @@ class EclipseEngine : public FreescapeEngine {
public:
EclipseEngine(OSystem *syst, const ADGameDescription *gd);
- void loadAssetsFullGame() override;
void titleScreen() override;
-
void gotoArea(uint16 areaID, int entranceID) override;
+ void loadAssetsDOSFullGame() override;
void drawUI() override;
+
Common::Error saveGameStreamExtended(Common::WriteStream *stream, bool isAutosave = false) override;
Common::Error loadGameStreamExtended(Common::SeekableReadStream *stream) override;
};
@@ -538,7 +537,7 @@ class CastleEngine : public FreescapeEngine {
public:
CastleEngine(OSystem *syst, const ADGameDescription *gd);
- void loadAssetsFullGame() override;
+ void loadAssetsDOSFullGame() override;
void gotoArea(uint16 areaID, int entranceID) override;
Common::Error saveGameStreamExtended(Common::WriteStream *stream, bool isAutosave = false) override;
diff --git a/engines/freescape/games/castle.cpp b/engines/freescape/games/castle.cpp
index 1830891b8ed..e81afcff921 100644
--- a/engines/freescape/games/castle.cpp
+++ b/engines/freescape/games/castle.cpp
@@ -56,7 +56,7 @@ Common::SeekableReadStream *CastleEngine::decryptFile(const Common::String filen
return (new Common::MemoryReadStream(encryptedBuffer, size));
}
-void CastleEngine::loadAssetsFullGame() {
+void CastleEngine::loadAssetsDOSFullGame() {
Common::SeekableReadStream *stream = nullptr;
stream = decryptFile("CMLE");
diff --git a/engines/freescape/games/dark/dark.cpp b/engines/freescape/games/dark/dark.cpp
index eadc74d1c12..0cb8e2d2a9a 100644
--- a/engines/freescape/games/dark/dark.cpp
+++ b/engines/freescape/games/dark/dark.cpp
@@ -61,36 +61,6 @@ void DarkEngine::titleScreen() {
}
}
-void DarkEngine::loadAssetsDemo() {
- Common::File file;
- if (isDOS() && _renderMode == Common::kRenderEGA) {
- file.open("SCN1E.DAT");
- if (file.isOpen())
- _title = load8bitBinImage(&file, 0x0);
- file.close();
- file.open("DSIDEE.EXE");
-
- if (!file.isOpen())
- error("Failed to open DSIDEE.EXE");
- loadMessagesFixedSize(&file, 0x4525, 16, 27);
- loadMessagesFixedSize(&file, 0x9959, 307, 5);
- loadFonts(&file, 0xa598);
- loadGlobalObjects(&file, 0x3d04);
- load8bitBinary(&file, 0xa700, 16);
- _border = load8bitBinImage(&file, 0x210);
- } else if (isDOS() && _renderMode == Common::kRenderCGA) {
- //loadBundledImages();
- file.open("DSIDEC.EXE");
-
- if (!file.isOpen())
- error("Failed to open DSIDEC.EXE");
- loadFonts(&file, 0xa598);
- load8bitBinary(&file, 0x8a70, 4); // TODO
- } else
- error("Invalid or unsupported render mode %s for Dark Side", Common::getRenderModeDescription(_renderMode));
-}
-
-
void DarkEngine::loadGlobalObjects(Common::SeekableReadStream *file, int offset) {
assert(!_areaMap.contains(255));
ObjectMap *globalObjectsByID = new ObjectMap;
@@ -106,7 +76,6 @@ void DarkEngine::loadGlobalObjects(Common::SeekableReadStream *file, int offset)
_areaMap[255] = new Area(255, 0, globalObjectsByID, nullptr);
}
-
void DarkEngine::initGameState() {
_flyMode = false;
_noClipMode = false;
@@ -135,12 +104,48 @@ void DarkEngine::initGameState() {
_demoEvents.clear();
}
-void DarkEngine::loadAssetsFullGame() {
+extern byte kEGADefaultPaletteData[16][3];
+
+void DarkEngine::loadAssetsDOSDemo() {
Common::File file;
if (_renderMode == Common::kRenderEGA) {
file.open("SCN1E.DAT");
- if (file.isOpen())
+ if (file.isOpen()) {
_title = load8bitBinImage(&file, 0x0);
+ _title->setPalette((byte *)&kEGADefaultPaletteData, 0, 16);
+ }
+ file.close();
+ file.open("DSIDEE.EXE");
+
+ if (!file.isOpen())
+ error("Failed to open DSIDEE.EXE");
+ loadMessagesFixedSize(&file, 0x4525, 16, 27);
+ loadMessagesFixedSize(&file, 0x9959, 307, 5);
+ loadFonts(&file, 0xa598);
+ loadGlobalObjects(&file, 0x3d04);
+ load8bitBinary(&file, 0xa700, 16);
+ _border = load8bitBinImage(&file, 0x210);
+ _border->setPalette((byte *)&kEGADefaultPaletteData, 0, 16);
+ } else if (_renderMode == Common::kRenderCGA) {
+ //loadBundledImages();
+ file.open("DSIDEC.EXE");
+
+ if (!file.isOpen())
+ error("Failed to open DSIDEC.EXE");
+ loadFonts(&file, 0xa598);
+ load8bitBinary(&file, 0x8a70, 4); // TODO
+ } else
+ error("Invalid or unsupported render mode %s for Dark Side", Common::getRenderModeDescription(_renderMode));
+}
+
+void DarkEngine::loadAssetsDOSFullGame() {
+ Common::File file;
+ if (_renderMode == Common::kRenderEGA) {
+ file.open("SCN1E.DAT");
+ if (file.isOpen()) {
+ _title = load8bitBinImage(&file, 0x0);
+ _title->setPalette((byte *)&kEGADefaultPaletteData, 0, 16);
+ }
file.close();
file.open("DSIDEE.EXE");
@@ -152,6 +157,7 @@ void DarkEngine::loadAssetsFullGame() {
loadGlobalObjects(&file, 0x3d04);
load8bitBinary(&file, 0xa280, 16);
_border = load8bitBinImage(&file, 0x210);
+ _border->setPalette((byte *)&kEGADefaultPaletteData, 0, 16);
// TODO: load objects
/*for (auto &it : _areaMap) {
@@ -291,35 +297,6 @@ void DarkEngine::updateTimeVariables() {
}
}
-void DarkEngine::drawUI() {
- Graphics::Surface *surface = nullptr;
- if (_border) { // This can be removed when all the borders are loaded
- uint32 gray = _gfx->_texturePixelFormat.ARGBToColor(0x00, 0xA0, 0xA0, 0xA0);
- surface = new Graphics::Surface();
- surface->create(_screenW, _screenH, _gfx->_texturePixelFormat);
- surface->fillRect(_fullscreenViewArea, gray);
- drawCrossair(surface);
- } else
- return;
-
- if (isDOS())
- drawDOSUI(surface);
- else
- error("UI not implemented yet");
-
- if (!_uiTexture)
- _uiTexture = _gfx->createTexture(surface);
- else
- _uiTexture->update(surface);
-
- _gfx->setViewport(_fullscreenViewArea);
- _gfx->drawTexturedRect2D(_fullscreenViewArea, _fullscreenViewArea, _uiTexture);
- _gfx->setViewport(_viewArea);
-
- surface->free();
- delete surface;
-}
-
void DarkEngine::borderScreen() {
if (_border) {
drawBorder();
diff --git a/engines/freescape/games/driller/driller.cpp b/engines/freescape/games/driller/driller.cpp
index d132721d0ae..72e7f9e05a6 100644
--- a/engines/freescape/games/driller/driller.cpp
+++ b/engines/freescape/games/driller/driller.cpp
@@ -206,38 +206,8 @@ void DrillerEngine::loadGlobalObjects(Common::SeekableReadStream *file, int offs
_areaMap[255] = new Area(255, 0, globalObjectsByID, nullptr);
}
-void DrillerEngine::loadAssetsDemo() {
- Common::File file;
- if (isAmiga()) {
- loadAssetsAmigaDemo();
- } else if (isAtariST()) {
- loadAssetsAtariDemo();
- } else if (isDOS()) {
- loadAssetsDOSDemo();
- } else
- error("Unsupported demo for Driller");
-
- _demoMode = !_disableDemoMode;
- _angleRotationIndex = 0;
-}
-
void DrillerEngine::loadAssetsFullGame() {
- Common::File file;
- if (isAmiga()) {
- loadAssetsAmigaFullGame();
- } else if (isAtariST()) {
- loadAssetsAtariFullGame();
- } else if (isSpectrum()) {
- loadAssetsZXFullGame();
- } else if (isCPC()) {
- loadAssetsCPCFullGame();
- } else if (isC64()) {
- //loadAssetsC64FullGame();
- } else if (isDOS()) {
- loadAssetsDOSFullGame();
- } else
- error("Invalid or unsupported render mode %s for Driller", Common::getRenderModeDescription(_renderMode));
-
+ FreescapeEngine::loadAssetsFullGame();
/*
We are going to inject a small script in the
last area to force the game to end:
diff --git a/engines/freescape/games/eclipse.cpp b/engines/freescape/games/eclipse.cpp
index e8d67acbfb4..7f970e86209 100644
--- a/engines/freescape/games/eclipse.cpp
+++ b/engines/freescape/games/eclipse.cpp
@@ -111,12 +111,15 @@ void EclipseEngine::titleScreen() {
}
}
-void EclipseEngine::loadAssetsFullGame() {
+extern byte kEGADefaultPaletteData[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 *)&kEGADefaultPaletteData, 0, 16);
}
file.close();
file.open("TOTEE.EXE");
@@ -129,6 +132,7 @@ void EclipseEngine::loadAssetsFullGame() {
for (auto &it : _areaMap)
it._value->addStructure(_areaMap[255]);
_border = load8bitBinImage(&file, 0x210);
+ _border->setPalette((byte *)&kEGADefaultPaletteData, 0, 16);
} else if (_renderMode == Common::kRenderCGA) {
loadBundledImages();
file.open("TOTEC.EXE");
Commit: 80f6c6ed878b41856d615751484b218209e428e5
https://github.com/scummvm/scummvm/commit/80f6c6ed878b41856d615751484b218209e428e5
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2023-03-11T11:37:38+01:00
Commit Message:
FREESCAPE: moved code from dark dos release into its dedicated file
Changed paths:
engines/freescape/games/dark/dark.cpp
engines/freescape/games/dark/dos.cpp
diff --git a/engines/freescape/games/dark/dark.cpp b/engines/freescape/games/dark/dark.cpp
index 0cb8e2d2a9a..d628c4d4ef5 100644
--- a/engines/freescape/games/dark/dark.cpp
+++ b/engines/freescape/games/dark/dark.cpp
@@ -104,78 +104,6 @@ void DarkEngine::initGameState() {
_demoEvents.clear();
}
-extern byte kEGADefaultPaletteData[16][3];
-
-void DarkEngine::loadAssetsDOSDemo() {
- Common::File file;
- if (_renderMode == Common::kRenderEGA) {
- file.open("SCN1E.DAT");
- if (file.isOpen()) {
- _title = load8bitBinImage(&file, 0x0);
- _title->setPalette((byte *)&kEGADefaultPaletteData, 0, 16);
- }
- file.close();
- file.open("DSIDEE.EXE");
-
- if (!file.isOpen())
- error("Failed to open DSIDEE.EXE");
- loadMessagesFixedSize(&file, 0x4525, 16, 27);
- loadMessagesFixedSize(&file, 0x9959, 307, 5);
- loadFonts(&file, 0xa598);
- loadGlobalObjects(&file, 0x3d04);
- load8bitBinary(&file, 0xa700, 16);
- _border = load8bitBinImage(&file, 0x210);
- _border->setPalette((byte *)&kEGADefaultPaletteData, 0, 16);
- } else if (_renderMode == Common::kRenderCGA) {
- //loadBundledImages();
- file.open("DSIDEC.EXE");
-
- if (!file.isOpen())
- error("Failed to open DSIDEC.EXE");
- loadFonts(&file, 0xa598);
- load8bitBinary(&file, 0x8a70, 4); // TODO
- } else
- error("Invalid or unsupported render mode %s for Dark Side", Common::getRenderModeDescription(_renderMode));
-}
-
-void DarkEngine::loadAssetsDOSFullGame() {
- Common::File file;
- if (_renderMode == Common::kRenderEGA) {
- file.open("SCN1E.DAT");
- if (file.isOpen()) {
- _title = load8bitBinImage(&file, 0x0);
- _title->setPalette((byte *)&kEGADefaultPaletteData, 0, 16);
- }
- file.close();
- file.open("DSIDEE.EXE");
-
- if (!file.isOpen())
- error("Failed to open DSIDEE.EXE");
-
- loadFonts(&file, 0xa113);
- loadMessagesFixedSize(&file, 0x4525, 16, 27);
- loadGlobalObjects(&file, 0x3d04);
- load8bitBinary(&file, 0xa280, 16);
- _border = load8bitBinImage(&file, 0x210);
- _border->setPalette((byte *)&kEGADefaultPaletteData, 0, 16);
-
- // TODO: load objects
- /*for (auto &it : _areaMap) {
- if (!it._value->entranceWithID(255))
- continue;
- it._value->addStructure(_areaMap[255]);
- }*/
- } else if (_renderMode == Common::kRenderCGA) {
- loadBundledImages();
- file.open("DSIDEC.EXE");
-
- if (!file.isOpen())
- error("Failed to open DSIDEC.EXE");
- load8bitBinary(&file, 0x7bb0, 4); // TODO
- } else
- error("Invalid or unsupported render mode %s for Dark Side", Common::getRenderModeDescription(_renderMode));
-}
-
void DarkEngine::gotoArea(uint16 areaID, int entranceID) {
debugC(1, kFreescapeDebugMove, "Jumping to area: %d, entrance: %d", areaID, entranceID);
if (!_gameStateBits.contains(areaID))
diff --git a/engines/freescape/games/dark/dos.cpp b/engines/freescape/games/dark/dos.cpp
index 6a3c5aff2ae..24c4396d079 100644
--- a/engines/freescape/games/dark/dos.cpp
+++ b/engines/freescape/games/dark/dos.cpp
@@ -26,6 +26,78 @@
namespace Freescape {
+extern byte kEGADefaultPaletteData[16][3];
+
+void DarkEngine::loadAssetsDOSDemo() {
+ Common::File file;
+ if (_renderMode == Common::kRenderEGA) {
+ file.open("SCN1E.DAT");
+ if (file.isOpen()) {
+ _title = load8bitBinImage(&file, 0x0);
+ _title->setPalette((byte *)&kEGADefaultPaletteData, 0, 16);
+ }
+ file.close();
+ file.open("DSIDEE.EXE");
+
+ if (!file.isOpen())
+ error("Failed to open DSIDEE.EXE");
+ loadMessagesFixedSize(&file, 0x4525, 16, 27);
+ loadMessagesFixedSize(&file, 0x9959, 307, 5);
+ loadFonts(&file, 0xa598);
+ loadGlobalObjects(&file, 0x3d04);
+ load8bitBinary(&file, 0xa700, 16);
+ _border = load8bitBinImage(&file, 0x210);
+ _border->setPalette((byte *)&kEGADefaultPaletteData, 0, 16);
+ } else if (_renderMode == Common::kRenderCGA) {
+ //loadBundledImages();
+ file.open("DSIDEC.EXE");
+
+ if (!file.isOpen())
+ error("Failed to open DSIDEC.EXE");
+ loadFonts(&file, 0xa598);
+ load8bitBinary(&file, 0x8a70, 4); // TODO
+ } else
+ error("Invalid or unsupported render mode %s for Dark Side", Common::getRenderModeDescription(_renderMode));
+}
+
+void DarkEngine::loadAssetsDOSFullGame() {
+ Common::File file;
+ if (_renderMode == Common::kRenderEGA) {
+ file.open("SCN1E.DAT");
+ if (file.isOpen()) {
+ _title = load8bitBinImage(&file, 0x0);
+ _title->setPalette((byte *)&kEGADefaultPaletteData, 0, 16);
+ }
+ file.close();
+ file.open("DSIDEE.EXE");
+
+ if (!file.isOpen())
+ error("Failed to open DSIDEE.EXE");
+
+ loadFonts(&file, 0xa113);
+ loadMessagesFixedSize(&file, 0x4525, 16, 27);
+ loadGlobalObjects(&file, 0x3d04);
+ load8bitBinary(&file, 0xa280, 16);
+ _border = load8bitBinImage(&file, 0x210);
+ _border->setPalette((byte *)&kEGADefaultPaletteData, 0, 16);
+
+ // TODO: load objects
+ /*for (auto &it : _areaMap) {
+ if (!it._value->entranceWithID(255))
+ continue;
+ it._value->addStructure(_areaMap[255]);
+ }*/
+ } else if (_renderMode == Common::kRenderCGA) {
+ loadBundledImages();
+ file.open("DSIDEC.EXE");
+
+ if (!file.isOpen())
+ error("Failed to open DSIDEC.EXE");
+ load8bitBinary(&file, 0x7bb0, 4); // TODO
+ } else
+ error("Invalid or unsupported render mode %s for Dark Side", Common::getRenderModeDescription(_renderMode));
+}
+
void DarkEngine::drawDOSUI(Graphics::Surface *surface) {
uint32 color = _renderMode == Common::kRenderCGA ? 1 : 14;
uint8 r, g, b;
Commit: 4940669e24fe506e6ca5617ecae6f96fb198ef31
https://github.com/scummvm/scummvm/commit/4940669e24fe506e6ca5617ecae6f96fb198ef31
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2023-03-11T11:37:39+01:00
Commit Message:
FREESCAPE: simplified driller cpc color handling code
Changed paths:
engines/freescape/games/driller/cpc.cpp
engines/freescape/gfx.cpp
diff --git a/engines/freescape/games/driller/cpc.cpp b/engines/freescape/games/driller/cpc.cpp
index bd43a0a1d01..ced3e80c64e 100644
--- a/engines/freescape/games/driller/cpc.cpp
+++ b/engines/freescape/games/driller/cpc.cpp
@@ -41,6 +41,19 @@ byte kCPCPaletteBorderData[4][3] = {
{0x00, 0x80, 0x00},
};
+byte getCPCPixel(byte cpc_byte, int index) {
+ if (index == 0)
+ return ((cpc_byte & 0x08) >> 2) | ((cpc_byte & 0x80) >> 7);
+ else if (index == 1)
+ return ((cpc_byte & 0x04) >> 1) | ((cpc_byte & 0x40) >> 6);
+ else if (index == 2)
+ return (cpc_byte & 0x02) | ((cpc_byte & 0x20) >> 5);
+ else if (index == 3)
+ return ((cpc_byte & 0x01) << 1) | ((cpc_byte & 0x10) >> 4);
+ else
+ error("Invalid index %d requested", index);
+}
+
Graphics::ManagedSurface *readCPCImage(Common::SeekableReadStream *file) {
Graphics::ManagedSurface *surface = new Graphics::ManagedSurface();
surface->create(320, 200, Graphics::PixelFormat::createFormatCLUT8());
@@ -54,25 +67,25 @@ Graphics::ManagedSurface *readCPCImage(Common::SeekableReadStream *file) {
byte cpc_byte = file->readByte(); // Get CPC byte
// Process first pixel
- int pixel_0 = ((cpc_byte & 0x08) >> 2) | ((cpc_byte & 0x80) >> 7); // %Aa
+ int pixel_0 = getCPCPixel(cpc_byte, 0); // %Aa
y = line * 8 + block ; // Coord Y for the pixel
x = 4 * offset + 0; // Coord X for the pixel
surface->setPixel(x, y, pixel_0);
// Process second pixel
- int pixel_1 = ((cpc_byte & 0x04) >> 1) | ((cpc_byte & 0x40) >> 6); // %Bb
+ int pixel_1 = getCPCPixel(cpc_byte, 1); // %Bb
y = line * 8 + block ; // Coord Y for the pixel
x = 4 * offset + 1; // Coord X for the pixel
surface->setPixel(x, y, pixel_1);
// Process third pixel
- int pixel_2 = (cpc_byte & 0x02) | ((cpc_byte & 0x20) >> 5); // %Cc
+ int pixel_2 = getCPCPixel(cpc_byte, 2); // %Cc
y = line * 8 + block ; // Coord Y for the pixel
x = 4 * offset + 2; // Coord X for the pixel
surface->setPixel(x, y, pixel_2);
// Process fourth pixel
- int pixel_3 = ((cpc_byte & 0x01) << 1) | ((cpc_byte & 0x10) >> 4); // %Dd
+ int pixel_3 = getCPCPixel(cpc_byte, 3); // %Dd
y = line * 8 + block ; // Coord Y for the pixel
x = 4 * offset + 3; // Coord X for the pixel
surface->setPixel(x, y, pixel_3);
diff --git a/engines/freescape/gfx.cpp b/engines/freescape/gfx.cpp
index c0db20465c1..76cced96920 100644
--- a/engines/freescape/gfx.cpp
+++ b/engines/freescape/gfx.cpp
@@ -188,44 +188,6 @@ bool Renderer::getRGBAtZX(uint8 index, uint8 &r1, uint8 &g1, uint8 &b1, uint8 &r
return true;
}
-void Renderer::extractCPCIndexes(uint8 cm1, uint8 cm2, uint8 &i1, uint8 &i2) {
- if (cm1 == 0xb4 && cm2 == 0xe1) {
- i1 = 1;
- i2 = 2;
- } else if (cm1 == 0xb0 && cm2 == 0xe0) {
- i1 = 1;
- i2 = 0;
- } else if (cm1 == 0x05 && cm2 == 0x0a) {
- i1 = 2;
- i2 = 0;
- } else if (cm1 == 0x50 && cm2 == 0xa0) {
- i1 = 1;
- i2 = 0;
- } else if (cm1 == 0x55 && cm2 == 0xaa) {
- i1 = 3;
- i2 = 0;
- } else if (cm1 == 0xf5 && cm2 == 0xfa) {
- i1 = 3;
- i2 = 1;
- } else if (cm1 == 0x5a && cm2 == 0xa5) {
- i1 = 1;
- i2 = 2;
- } else if (cm1 == 0xbb && cm2 == 0xee) {
- i1 = 3;
- i2 = 0;
- } else if (cm1 == 0x5f && cm2 == 0xaf) {
- i1 = 3;
- i2 = 2;
- } else if (cm1 == 0xfb && cm2 == 0xfe) { // TODO
- i1 = 0;
- i2 = 0;
- } else if (cm1 == 0x40 && cm2 == 0x20) { // This one has a special stapple pattern
- i1 = 1;
- i2 = 0;
- } else
- error("%x %x", cm1, cm2);
-}
-
void Renderer::selectColorFromFourColorPalette(uint8 index, uint8 &r1, uint8 &g1, uint8 &b1) {
if (index == 0) {
r1 = 0;
@@ -241,6 +203,8 @@ void Renderer::selectColorFromFourColorPalette(uint8 index, uint8 &r1, uint8 &g1
error("Invalid color");
}
+extern byte getCPCPixel(byte cpc_byte, int index);
+
bool Renderer::getRGBAtCPC(uint8 index, uint8 &r1, uint8 &g1, uint8 &b1, uint8 &r2, uint8 &g2, uint8 &b2) {
if (index == _keyColor)
return false;
@@ -260,7 +224,8 @@ bool Renderer::getRGBAtCPC(uint8 index, uint8 &r1, uint8 &g1, uint8 &b1, uint8 &
entry++;
uint8 cm2 = *(entry);
- extractCPCIndexes(cm1, cm2, i1, i2);
+ i1 = getCPCPixel(cm1, 0);
+ i2 = getCPCPixel(cm1, 1);
selectColorFromFourColorPalette(i1, r1, g1, b1);
selectColorFromFourColorPalette(i2, r2, g2, b2);
return true;
Commit: f470ba3f6ef7ffbc01e392843f0760e486aa5771
https://github.com/scummvm/scummvm/commit/f470ba3f6ef7ffbc01e392843f0760e486aa5771
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2023-03-11T11:38:09+01:00
Commit Message:
FREESCAPE: commented unused variable
Changed paths:
engines/freescape/gfx.cpp
diff --git a/engines/freescape/gfx.cpp b/engines/freescape/gfx.cpp
index 76cced96920..d9765893090 100644
--- a/engines/freescape/gfx.cpp
+++ b/engines/freescape/gfx.cpp
@@ -222,7 +222,7 @@ bool Renderer::getRGBAtCPC(uint8 index, uint8 &r1, uint8 &g1, uint8 &b1, uint8 &
byte *entry = (*_colorMap)[index - 1];
uint8 cm1 = *(entry);
entry++;
- uint8 cm2 = *(entry);
+ //uint8 cm2 = *(entry);
i1 = getCPCPixel(cm1, 0);
i2 = getCPCPixel(cm1, 1);
More information about the Scummvm-git-logs
mailing list