[Scummvm-git-logs] scummvm master -> 05e320fec97a5ef90757b49673d7da21e2ac7f89
neuromancer
noreply at scummvm.org
Tue Dec 20 11:29:06 UTC 2022
This automated email contains information about 11 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
2b2ffa3e79 FREESCAPE: change the color of the laser according to the current screen in the OpenGL renderer
ac236fd663 FREESCAPE: properly render background when the player is under fire (DOS)
52f5960d77 FREESCAPE: save, load and displayer total score per area in driller
bfabd96633 FREESCAPE: detection of driller demo for DOS
8d2004f7f4 FREESCAPE: basic loading of driller demo for DOS
43911004a4 FREESCAPE: improved data loading and palette for driller DOS (CGA)
20529cbb30 FREESCAPE: first iteration of the CGA renderer for driller DOS (CGA)
49cbc6f624 FREESCAPE: preliminary code to swap colors from border in driller DOS (CGA)
7abb3e32ae FREESCAPE: recreated border image from driller (CGA) and regenerated engine data
53e4bfc388 FREESCAPE: adjusted viewport in driller (CGA)
05e320fec9 FREESCAPE: improve CGA renderer
Commit: 2b2ffa3e79e8935d6fae9c7ea1ee37cd57039720
https://github.com/scummvm/scummvm/commit/2b2ffa3e79e8935d6fae9c7ea1ee37cd57039720
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2022-12-20T08:26:44-03:00
Commit Message:
FREESCAPE: change the color of the laser according to the current screen in the OpenGL renderer
Changed paths:
engines/freescape/gfx.cpp
engines/freescape/gfx.h
engines/freescape/gfx_opengl.cpp
diff --git a/engines/freescape/gfx.cpp b/engines/freescape/gfx.cpp
index 231ea0fea73..fbdcbcde340 100644
--- a/engines/freescape/gfx.cpp
+++ b/engines/freescape/gfx.cpp
@@ -55,6 +55,15 @@ void Renderer::readFromPalette(uint8 index, uint8 &r, uint8 &g, uint8 &b) {
b = _palette[3 * index + 2];
}
+uint8 Renderer::indexFromColor(uint8 r, uint8 g, uint8 b) {
+ for (int i = 0; i < 16; i++) {
+ if (r == _palette[3 * i + 0] && g == _palette[3 * i + 1] && b == _palette[3 * i + 2])
+ return i;
+ }
+ warning("color %x %x %x not found", r, g, b);
+ return 0;
+}
+
void Renderer::setColorRemaps(ColorReMap *colorRemaps) {
_colorRemaps = colorRemaps;
}
diff --git a/engines/freescape/gfx.h b/engines/freescape/gfx.h
index 2ddddce6b42..513914874b4 100644
--- a/engines/freescape/gfx.h
+++ b/engines/freescape/gfx.h
@@ -97,6 +97,7 @@ public:
// palette
void readFromPalette(uint8 index, uint8 &r, uint8 &g, uint8 &b);
+ uint8 indexFromColor(uint8 r, uint8 g, uint8 b);
bool getRGBAt(uint8 index, uint8 &r, uint8 &g, uint8 &b);
byte *_palette;
ColorMap *_colorMap;
diff --git a/engines/freescape/gfx_opengl.cpp b/engines/freescape/gfx_opengl.cpp
index dfae983809e..dba1047c308 100644
--- a/engines/freescape/gfx_opengl.cpp
+++ b/engines/freescape/gfx_opengl.cpp
@@ -184,8 +184,7 @@ void OpenGLRenderer::renderSensorShoot(byte color, const Math::Vector3d sensor,
}
void OpenGLRenderer::renderPlayerShoot(byte color, const Common::Point position, const Common::Rect viewArea) {
- uint8 r, g, b;
- readFromPalette(color, r, g, b); // TODO: should use opposite color
+ uint8 a, r, g, b;
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
@@ -193,6 +192,12 @@ void OpenGLRenderer::renderPlayerShoot(byte color, const Common::Point position,
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
+ uint32 pixel = 0x0;
+ glReadPixels(g_system->getWidth() / 2, g_system->getHeight() / 2, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, &pixel);
+ _texturePixelFormat.colorToARGB(pixel, a, r, g, b);
+ color = indexFromColor(r, g, b);
+ readFromPalette((color + 3) % 16, r, g, b);
+
glDisable(GL_DEPTH_TEST);
glDepthMask(GL_FALSE);
Commit: ac236fd663070896f376855532461535dc91c690
https://github.com/scummvm/scummvm/commit/ac236fd663070896f376855532461535dc91c690
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2022-12-20T08:26:44-03:00
Commit Message:
FREESCAPE: properly render background when the player is under fire (DOS)
Changed paths:
engines/freescape/games/driller.cpp
engines/freescape/gfx.cpp
engines/freescape/language/instruction.cpp
diff --git a/engines/freescape/games/driller.cpp b/engines/freescape/games/driller.cpp
index c181613a4cb..ffcebf8ebca 100644
--- a/engines/freescape/games/driller.cpp
+++ b/engines/freescape/games/driller.cpp
@@ -422,34 +422,41 @@ void DrillerEngine::drawUI() {
void DrillerEngine::drawDOSUI(Graphics::Surface *surface) {
uint32 yellow = _gfx->_texturePixelFormat.ARGBToColor(0xFF, 0xFF, 0xFF, 0x55);
- uint32 black = _gfx->_texturePixelFormat.ARGBToColor(0xFF, 0x00, 0x00, 0x00);
+ uint8 color = _currentArea->_usualBackgroundColor;
+ if (_gfx->_colorRemaps && _gfx->_colorRemaps->contains(color)) {
+ color = (*_gfx->_colorRemaps)[color];
+ }
+
+ uint8 r, g, b;
+ _gfx->readFromPalette(color, r, g, b);
+ uint32 back = _gfx->_texturePixelFormat.ARGBToColor(0xFF, r, g, b);
int score = _gameStateVars[k8bitVariableScore];
- drawStringInSurface(_currentArea->_name, 196, 185, yellow, black, surface);
- drawStringInSurface(Common::String::format("%04d", 2 * int(_position.x())), 150, 145, yellow, black, surface);
- drawStringInSurface(Common::String::format("%04d", 2 * int(_position.z())), 150, 153, yellow, black, surface);
- drawStringInSurface(Common::String::format("%04d", 2 * int(_position.y())), 150, 161, yellow, black, surface);
+ drawStringInSurface(_currentArea->_name, 196, 185, yellow, back, surface);
+ drawStringInSurface(Common::String::format("%04d", 2 * int(_position.x())), 150, 145, yellow, back, surface);
+ drawStringInSurface(Common::String::format("%04d", 2 * int(_position.z())), 150, 153, yellow, back, surface);
+ drawStringInSurface(Common::String::format("%04d", 2 * int(_position.y())), 150, 161, yellow, back, surface);
if (_playerHeightNumber >= 0)
- drawStringInSurface(Common::String::format("%d", _playerHeightNumber), 57, 161, yellow, black, surface);
+ drawStringInSurface(Common::String::format("%d", _playerHeightNumber), 57, 161, yellow, back, surface);
else
- drawStringInSurface(Common::String::format("%s", "J"), 57, 161, yellow, black, surface);
+ drawStringInSurface(Common::String::format("%s", "J"), 57, 161, yellow, back, surface);
- drawStringInSurface(Common::String::format("%02d", int(_angleRotations[_angleRotationIndex])), 46, 145, yellow, black, surface);
- drawStringInSurface(Common::String::format("%3d", _playerSteps[_playerStepIndex]), 46, 153, yellow, black, surface);
- drawStringInSurface(Common::String::format("%07d", score), 238, 129, yellow, black, surface);
+ drawStringInSurface(Common::String::format("%02d", int(_angleRotations[_angleRotationIndex])), 46, 145, yellow, back, surface);
+ drawStringInSurface(Common::String::format("%3d", _playerSteps[_playerStepIndex]), 46, 153, yellow, back, surface);
+ drawStringInSurface(Common::String::format("%07d", score), 238, 129, yellow, back, surface);
int hours = _countdown <= 0 ? 0 : _countdown / 3600;
- drawStringInSurface(Common::String::format("%02d", hours), 208, 8, yellow, black, surface);
+ drawStringInSurface(Common::String::format("%02d", hours), 208, 8, yellow, back, surface);
int minutes = _countdown <= 0 ? 0 : (_countdown - hours * 3600) / 60;
- drawStringInSurface(Common::String::format("%02d", minutes), 230, 8, yellow, black, surface);
+ drawStringInSurface(Common::String::format("%02d", minutes), 230, 8, yellow, back, surface);
int seconds = _countdown <= 0 ? 0 : _countdown - hours * 3600 - minutes * 60;
- drawStringInSurface(Common::String::format("%02d", seconds), 254, 8, yellow, black, surface);
+ drawStringInSurface(Common::String::format("%02d", seconds), 254, 8, yellow, back, surface);
Common::String message;
int deadline;
getLatestMessages(message, deadline);
if (deadline <= _countdown) {
- drawStringInSurface(message, 190, 177, black, yellow, surface);
+ drawStringInSurface(message, 190, 177, back, yellow, surface);
_temporaryMessages.push_back(message);
_temporaryMessageDeadlines.push_back(deadline);
} else {
@@ -460,22 +467,22 @@ void DrillerEngine::drawDOSUI(Graphics::Surface *surface) {
else
message = _messagesList[1];
- drawStringInSurface(message, 191, 177, yellow, black, surface);
+ drawStringInSurface(message, 191, 177, yellow, back, surface);
}
int energy = _gameStateVars[k8bitVariableEnergy];
int shield = _gameStateVars[k8bitVariableShield];
if (_renderMode == Common::kRenderEGA) {
if (energy >= 0) {
- Common::Rect back(20, 185, 88 - energy, 191);
- surface->fillRect(back, black);
+ Common::Rect backBar(20, 185, 88 - energy, 191);
+ surface->fillRect(backBar, back);
Common::Rect energyBar(87 - energy, 185, 88, 191);
surface->fillRect(energyBar, yellow);
}
if (shield >= 0) {
- Common::Rect back(20, 177, 88 - shield, 183);
- surface->fillRect(back, black);
+ Common::Rect backBar(20, 177, 88 - shield, 183);
+ surface->fillRect(backBar, back);
Common::Rect shieldBar(87 - shield, 177, 88, 183);
surface->fillRect(shieldBar, yellow);
diff --git a/engines/freescape/gfx.cpp b/engines/freescape/gfx.cpp
index fbdcbcde340..4f9d126d090 100644
--- a/engines/freescape/gfx.cpp
+++ b/engines/freescape/gfx.cpp
@@ -72,6 +72,8 @@ bool Renderer::getRGBAt(uint8 index, uint8 &r, uint8 &g, uint8 &b) {
if (_colorRemaps && _colorRemaps->contains(index)) {
index = (*_colorRemaps)[index];
+ readFromPalette(index, r, g, b);
+ return true;
}
if (index == _keyColor)
diff --git a/engines/freescape/language/instruction.cpp b/engines/freescape/language/instruction.cpp
index 9093a928676..11cae2147a1 100644
--- a/engines/freescape/language/instruction.cpp
+++ b/engines/freescape/language/instruction.cpp
@@ -236,7 +236,12 @@ void FreescapeEngine::executeSPFX(FCLInstruction &instruction) {
_currentArea->remapColor(i, color);
} else if (isDOS()) {
debugC(1, kFreescapeDebugCode, "Switching palette from position %d to %d", src, dst);
- _currentArea->remapColor(src, dst);
+ if (src == 0 && dst == 1)
+ _currentArea->remapColor(_currentArea->_usualBackgroundColor, _currentArea->_underFireBackgroundColor);
+ else if (src == 0 && dst == 0)
+ _currentArea->unremapColor(_currentArea->_usualBackgroundColor);
+ else
+ _currentArea->remapColor(src, dst);
}
executeRedraw(instruction);
}
Commit: 52f5960d77448856f920becdb8f62be34dcc9329
https://github.com/scummvm/scummvm/commit/52f5960d77448856f920becdb8f62be34dcc9329
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2022-12-20T08:26:44-03:00
Commit Message:
FREESCAPE: save, load and displayer total score per area in driller
Changed paths:
engines/freescape/freescape.h
engines/freescape/games/driller.cpp
diff --git a/engines/freescape/freescape.h b/engines/freescape/freescape.h
index 8ac5aba14d3..43241faee9c 100644
--- a/engines/freescape/freescape.h
+++ b/engines/freescape/freescape.h
@@ -79,9 +79,6 @@ struct soundFx {
};
class FreescapeEngine : public Engine {
-private:
- // We need random numbers
- Common::RandomSource *_rnd;
public:
FreescapeEngine(OSystem *syst, const ADGameDescription *gd);
@@ -331,6 +328,9 @@ public:
// Cheats
bool _useExtendedTimer;
bool _disableSensors;
+
+ // Random
+ Common::RandomSource *_rnd;
};
enum DrillerReleaseFlags {
@@ -350,6 +350,8 @@ public:
bool _useAutomaticDrilling;
+ Common::HashMap<uint16, uint32> _areaScores;
+
void initGameState() override;
bool checkIfGameEnded() override;
diff --git a/engines/freescape/games/driller.cpp b/engines/freescape/games/driller.cpp
index ffcebf8ebca..32d8698539d 100644
--- a/engines/freescape/games/driller.cpp
+++ b/engines/freescape/games/driller.cpp
@@ -22,6 +22,7 @@
#include "common/config-manager.h"
#include "common/events.h"
#include "common/file.h"
+#include "common/random.h"
#include "freescape/freescape.h"
#include "freescape/language/8bitDetokeniser.h"
@@ -627,8 +628,9 @@ void DrillerEngine::pressedKey(const int keycode) {
insertTemporaryMessage(_messagesList[9], _countdown - 4);
return;
}
-
- insertTemporaryMessage(_messagesList[5], _countdown - 4);
+ Common::String maxScoreMessage = _messagesList[5];
+ maxScoreMessage.replace(2, 6, Common::String::format("%d", _areaScores[_currentArea->getAreaID()]));
+ insertTemporaryMessage(maxScoreMessage, _countdown - 4);
Common::String successMessage = _messagesList[6];
successMessage.replace(0, 4, Common::String::format("%d", int(success)));
while (successMessage.size() < 14)
@@ -876,6 +878,9 @@ void DrillerEngine::initGameState() {
if (_drilledAreas[it._key] != kDrillerNoRig)
removeDrill(it._value);
_drilledAreas[it._key] = kDrillerNoRig;
+ if (it._key != 255) {
+ _areaScores[it._key] = (10 + _rnd->getRandomNumber(89)) * 1000;
+ }
}
_gameStateVars[k8bitVariableEnergy] = _initialTankEnergy;
@@ -947,6 +952,7 @@ Common::Error DrillerEngine::saveGameStreamExtended(Common::WriteStream *stream,
continue;
stream->writeUint16LE(it._key);
stream->writeUint32LE(_drilledAreas[it._key]);
+ stream->writeUint32LE(_areaScores[it._key]);
}
return Common::kNoError;
@@ -961,6 +967,8 @@ Common::Error DrillerEngine::loadGameStreamExtended(Common::SeekableReadStream *
if (_drilledAreas[key] == kDrillerNoRig)
if (drillDeployed(_areaMap[key]))
removeDrill(_areaMap[key]);
+
+ _areaScores[key] = stream->readUint32LE();
}
return Common::kNoError;
Commit: bfabd9663312a570677c58d56e766a0c765ac0cd
https://github.com/scummvm/scummvm/commit/bfabd9663312a570677c58d56e766a0c765ac0cd
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2022-12-20T08:26:44-03:00
Commit Message:
FREESCAPE: detection of driller demo for DOS
Changed paths:
engines/freescape/detection.cpp
diff --git a/engines/freescape/detection.cpp b/engines/freescape/detection.cpp
index bad113db552..ce0ee0ab5ad 100644
--- a/engines/freescape/detection.cpp
+++ b/engines/freescape/detection.cpp
@@ -87,6 +87,20 @@ static const ADGameDescription gameDescriptions[] = {
ADGF_AMIGA_BUDGET | ADGF_TESTING,
GUIO2(GUIO_NOMIDI, GAMEOPTION_AUTOMATIC_DRILLING)
},
+ {
+ "driller",
+ "Rolling Demo",
+ {
+ {"drilldem.com", 0, "5188a7ae06f72263634a107685f52cbe", 889},
+ {"d1", 0, "edd57153197ef457f08eeea4d9339208", 16384},
+ {"d2", 0, "3690e6461bfc5434bab8969c6cdbb297", 41488},
+ AD_LISTEND
+ },
+ Common::EN_ANY,
+ Common::kPlatformDOS,
+ ADGF_TESTING | ADGF_DEMO,
+ GUIO2(GUIO_NOMIDI, GAMEOPTION_AUTOMATIC_DRILLING)
+ },
{
"driller",
"Rolling Demo",
Commit: 8d2004f7f4d5532ac104f9b11064f695825741b7
https://github.com/scummvm/scummvm/commit/8d2004f7f4d5532ac104f9b11064f695825741b7
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2022-12-20T08:26:44-03:00
Commit Message:
FREESCAPE: basic loading of driller demo for DOS
Changed paths:
engines/freescape/games/driller.cpp
engines/freescape/loaders/8bitBinaryLoader.cpp
diff --git a/engines/freescape/games/driller.cpp b/engines/freescape/games/driller.cpp
index 32d8698539d..f89f5c44438 100644
--- a/engines/freescape/games/driller.cpp
+++ b/engines/freescape/games/driller.cpp
@@ -258,6 +258,18 @@ void DrillerEngine::loadAssetsDemo() {
error("Failed to open 'soundfx' executable for AtariST demo");
loadSoundsFx(&file, 0, 25);
+ } else if (isDOS()) {
+ _renderMode = Common::kRenderCGA; // DOS demos is CGA only
+ loadBundledImages();
+ file.open("d2");
+ if (!file.isOpen())
+ error("Failed to open 'd2' file");
+
+ loadFonts(&file, 0x4eb0);
+ loadMessagesFixedSize(&file, 0x636, 14, 20);
+ load8bitBinary(&file, 0x55b0, 4);
+
+ file.close();
} else
error("Unsupported demo for Driller");
diff --git a/engines/freescape/loaders/8bitBinaryLoader.cpp b/engines/freescape/loaders/8bitBinaryLoader.cpp
index 89d44ca586c..e7303723729 100644
--- a/engines/freescape/loaders/8bitBinaryLoader.cpp
+++ b/engines/freescape/loaders/8bitBinaryLoader.cpp
@@ -577,7 +577,11 @@ void FreescapeEngine::load8bitBinary(Common::SeekableReadStream *file, int offse
void FreescapeEngine::loadBundledImages() {
Image::BitmapDecoder decoder;
- Common::String borderFilename = _targetName + "_" + Common::getRenderModeDescription(_renderMode) + ".bmp";
+ Common::String targetName = _targetName;
+ if (isDOS() && isDemo())
+ Common::replace(targetName, "-demo", "");
+
+ Common::String borderFilename = targetName + "_" + Common::getRenderModeDescription(_renderMode) + ".bmp";
if (_dataBundle->hasFile(borderFilename)) {
Common::SeekableReadStream *borderFile = _dataBundle->createReadStreamForMember(borderFilename);
decoder.loadStream(*borderFile);
Commit: 43911004a437017404e19f47939e785dcda04928
https://github.com/scummvm/scummvm/commit/43911004a437017404e19f47939e785dcda04928
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2022-12-20T08:26:44-03:00
Commit Message:
FREESCAPE: improved data loading and palette for driller DOS (CGA)
Changed paths:
engines/freescape/games/driller.cpp
engines/freescape/games/palettes.cpp
engines/freescape/loaders/8bitBinaryLoader.cpp
diff --git a/engines/freescape/games/driller.cpp b/engines/freescape/games/driller.cpp
index f89f5c44438..6921713a807 100644
--- a/engines/freescape/games/driller.cpp
+++ b/engines/freescape/games/driller.cpp
@@ -376,6 +376,9 @@ void DrillerEngine::loadAssetsFullGame() {
if (!file.isOpen())
error("Failed to open DRILLC.EXE");
+
+ loadFonts(&file, 0x07a4a);
+ loadMessagesFixedSize(&file, 0x2585, 14, 20);
load8bitBinary(&file, 0x7bb0, 4);
} else
error("Invalid or unsupported render mode %s for Driller", Common::getRenderModeDescription(_renderMode));
diff --git a/engines/freescape/games/palettes.cpp b/engines/freescape/games/palettes.cpp
index c8f78d91407..506d82efea3 100644
--- a/engines/freescape/games/palettes.cpp
+++ b/engines/freescape/games/palettes.cpp
@@ -41,18 +41,11 @@ byte dos_EGA_palette[16][3] = {
{0xff, 0xff, 0x55},
{0xff, 0xff, 0xff}};
-byte dos_CGA_palette[4][3] = {
- {0x00, 0x00, 0x00},
- {0xff, 0xff, 0xff},
- {0xa8, 0x00, 0xa8},
- {0x00, 0xa8, 0xa8},
-};
-
void FreescapeEngine::loadColorPalette() {
if (_renderMode == Common::kRenderEGA) {
_gfx->_palette = (byte *)&dos_EGA_palette;
} else if (_renderMode == Common::kRenderCGA) {
- _gfx->_palette = (byte *)&dos_CGA_palette;
+ _gfx->_palette = (byte *)&dos_EGA_palette;
} else if (_renderMode == Common::kRenderAmiga || _renderMode == Common::kRenderAtariST) {
_gfx->_palette = nullptr; // palette depends on the area
} else
diff --git a/engines/freescape/loaders/8bitBinaryLoader.cpp b/engines/freescape/loaders/8bitBinaryLoader.cpp
index e7303723729..e77cc66b19c 100644
--- a/engines/freescape/loaders/8bitBinaryLoader.cpp
+++ b/engines/freescape/loaders/8bitBinaryLoader.cpp
@@ -317,11 +317,6 @@ Area *FreescapeEngine::load8bitArea(Common::SeekableReadStream *file, uint16 nco
// skyColor = file->readByte() & 15;
// debugC(1, kFreescapeDebugParser, "Colors: %d %d", skyColor, groundColor);
- if (_renderMode == Common::kRenderCGA) {
- skyColor = skyColor % 4;
- groundColor = groundColor % 4;
- }
-
// Graphics::PixelBuffer *palette = getPalette(areaNumber, ci1, ci2, skyColor, groundColor, ncolors);
debugC(1, kFreescapeDebugParser, "Area %d", areaNumber);
Commit: 20529cbb30d331e38a5e90a5c3e6cc102e5d37d8
https://github.com/scummvm/scummvm/commit/20529cbb30d331e38a5e90a5c3e6cc102e5d37d8
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2022-12-20T08:26:44-03:00
Commit Message:
FREESCAPE: first iteration of the CGA renderer for driller DOS (CGA)
Changed paths:
engines/freescape/games/driller.cpp
engines/freescape/games/palettes.cpp
engines/freescape/gfx.cpp
engines/freescape/gfx.h
engines/freescape/gfx_opengl.cpp
engines/freescape/gfx_opengl.h
engines/freescape/gfx_tinygl.cpp
engines/freescape/loaders/8bitBinaryLoader.cpp
diff --git a/engines/freescape/games/driller.cpp b/engines/freescape/games/driller.cpp
index 6921713a807..cacdd9df46d 100644
--- a/engines/freescape/games/driller.cpp
+++ b/engines/freescape/games/driller.cpp
@@ -260,6 +260,7 @@ void DrillerEngine::loadAssetsDemo() {
loadSoundsFx(&file, 0, 25);
} else if (isDOS()) {
_renderMode = Common::kRenderCGA; // DOS demos is CGA only
+ _gfx->_renderMode = _renderMode;
loadBundledImages();
file.open("d2");
if (!file.isOpen())
diff --git a/engines/freescape/games/palettes.cpp b/engines/freescape/games/palettes.cpp
index 506d82efea3..edfece45d2b 100644
--- a/engines/freescape/games/palettes.cpp
+++ b/engines/freescape/games/palettes.cpp
@@ -41,11 +41,18 @@ byte dos_EGA_palette[16][3] = {
{0xff, 0xff, 0x55},
{0xff, 0xff, 0xff}};
+byte dos_CGA_palette[4][3] = {
+ {0x00, 0x00, 0x00},
+ {0x00, 0xaa, 0x00},
+ {0xaa, 0x00, 0x00},
+ {0xaa, 0x55, 0x00},
+};
+
void FreescapeEngine::loadColorPalette() {
if (_renderMode == Common::kRenderEGA) {
_gfx->_palette = (byte *)&dos_EGA_palette;
} else if (_renderMode == Common::kRenderCGA) {
- _gfx->_palette = (byte *)&dos_EGA_palette;
+ _gfx->_palette = (byte *)&dos_CGA_palette;
} else if (_renderMode == Common::kRenderAmiga || _renderMode == Common::kRenderAtariST) {
_gfx->_palette = nullptr; // palette depends on the area
} else
diff --git a/engines/freescape/gfx.cpp b/engines/freescape/gfx.cpp
index 4f9d126d090..f68abc6f125 100644
--- a/engines/freescape/gfx.cpp
+++ b/engines/freescape/gfx.cpp
@@ -68,38 +68,37 @@ void Renderer::setColorRemaps(ColorReMap *colorRemaps) {
_colorRemaps = colorRemaps;
}
-bool Renderer::getRGBAt(uint8 index, uint8 &r, uint8 &g, uint8 &b) {
-
- if (_colorRemaps && _colorRemaps->contains(index)) {
- index = (*_colorRemaps)[index];
- readFromPalette(index, r, g, b);
- return true;
- }
-
+bool Renderer::getRGBAtCGA(uint8 index, uint8 &r1, uint8 &g1, uint8 &b1, uint8 &r2, uint8 &g2, uint8 &b2) {
if (index == _keyColor)
return false;
- if (index == 0) {
- readFromPalette(0, r, g, b);
+ assert (_renderMode == Common::kRenderCGA);
+ if (index <= 4) { // Solid colors
+ readFromPalette(index - 1, r1, g1, b1);
+ r2 = r1;
+ g2 = g1;
+ b2 = b1;
return true;
}
- if (_renderMode == Common::kRenderAmiga || _renderMode == Common::kRenderAtariST) {
- readFromPalette(index, r, g, b);
- return true;
- }
+ byte *entry = (*_colorMap)[index - 1];
+ byte be = *(entry);
+ readFromPalette((be >> 4) % 4, r1, g1, b1);
+ entry++;
+ be = *(entry);
+ readFromPalette((be >> 4) % 4, r2, g2, b2);
+ return true;
+}
+
- // assert(index-1 < _colorMap->size());
+bool Renderer::getRGBAtEGA(uint8 index, uint8 &r1, uint8 &g1, uint8 &b1, uint8 &r2, uint8 &g2, uint8 &b2) {
+ // assert(index-1 < _colorMap->size());
byte *entry = (*_colorMap)[index - 1];
uint8 color = 0;
uint8 acc = 1;
for (int i = 0; i < 4; i++) {
byte be = *entry;
- if (be != 0 && be != 0xff) {
- readFromPalette(index, r, g, b);
- return true;
- }
-
+ assert (be == 0 || be == 0xff);
if (be == 0xff)
color = color + acc;
@@ -107,10 +106,46 @@ bool Renderer::getRGBAt(uint8 index, uint8 &r, uint8 &g, uint8 &b) {
entry++;
}
assert(color < 16);
- readFromPalette(color, r, g, b);
+ readFromPalette(color, r1, g1, b1);
+ r2 = r1;
+ g2 = g1;
+ b2 = b1;
return true;
}
+bool Renderer::getRGBAt(uint8 index, uint8 &r1, uint8 &g1, uint8 &b1, uint8 &r2, uint8 &g2, uint8 &b2) {
+
+ /*if (_colorRemaps && _colorRemaps->contains(index)) {
+ index = (*_colorRemaps)[index];
+ readFromPalette(index, r, g, b);
+ return true;
+ }*/
+
+ if (index == _keyColor)
+ return false;
+
+ if (index == 0) {
+ readFromPalette(0, r1, g1, b1);
+ r2 = r1;
+ g2 = g1;
+ b2 = b1;
+ return true;
+ }
+
+ if (_renderMode == Common::kRenderAmiga || _renderMode == Common::kRenderAtariST) {
+ readFromPalette(index, r1, g1, b1);
+ r2 = r1;
+ g2 = g1;
+ b2 = b1;
+ return true;
+ } else if (_renderMode == Common::kRenderEGA)
+ return getRGBAtEGA(index, r1, g1, b1, r2, g2, b2);
+ else if (_renderMode == Common::kRenderCGA)
+ return getRGBAtCGA(index, r1, g1, b1, r2, g2, b2);
+
+ error("Invalid or unsupported render mode");
+}
+
void Renderer::flipVertical(Graphics::Surface *s) {
for (int y = 0; y < s->h / 2; ++y) {
// Flip the lines
@@ -237,9 +272,9 @@ void Renderer::renderPyramid(const Math::Vector3d &origin, const Math::Vector3d
}
Common::Array<Math::Vector3d> face;
- uint8 r, g, b;
- if (getRGBAt((*colours)[0], r, g, b)) {
- useColor(r, g, b);
+ uint8 r1, g1, b1, r2, g2, b2;
+ if (getRGBAt((*colours)[0], r1, g1, b1, r1, g2, b2)) {
+ useColor(r1, g1, b1);
face.push_back(vertices[4]);
face.push_back(vertices[5]);
@@ -250,8 +285,8 @@ void Renderer::renderPyramid(const Math::Vector3d &origin, const Math::Vector3d
face.clear();
}
- if (getRGBAt((*colours)[1], r, g, b)) {
- useColor(r, g, b);
+ if (getRGBAt((*colours)[1], r1, g1, b1, r2, g2, b2)) {
+ useColor(r1, g1, b1);
face.push_back(vertices[5]);
face.push_back(vertices[6]);
@@ -262,8 +297,8 @@ void Renderer::renderPyramid(const Math::Vector3d &origin, const Math::Vector3d
face.clear();
}
- if (getRGBAt((*colours)[2], r, g, b)) {
- useColor(r, g, b);
+ if (getRGBAt((*colours)[2], r1, g1, b1, r2, g2, b2)) {
+ useColor(r1, g1, b1);
face.push_back(vertices[6]);
face.push_back(vertices[7]);
@@ -273,8 +308,8 @@ void Renderer::renderPyramid(const Math::Vector3d &origin, const Math::Vector3d
face.clear();
}
- if (getRGBAt((*colours)[3], r, g, b)) {
- useColor(r, g, b);
+ if (getRGBAt((*colours)[3], r1, g1, b1, r2, g2, b2)) {
+ useColor(r1, g1, b1);
face.push_back(vertices[7]);
face.push_back(vertices[4]);
@@ -285,8 +320,8 @@ void Renderer::renderPyramid(const Math::Vector3d &origin, const Math::Vector3d
face.clear();
}
- if (getRGBAt((*colours)[4], r, g, b)) {
- useColor(r, g, b);
+ if (getRGBAt((*colours)[4], r1, g1, b1, r2, g2, b2)) {
+ useColor(r1, g1, b1);
face.push_back(vertices[0]);
face.push_back(vertices[1]);
@@ -296,8 +331,8 @@ void Renderer::renderPyramid(const Math::Vector3d &origin, const Math::Vector3d
face.clear();
}
- if (getRGBAt((*colours)[5], r, g, b)) {
- useColor(r, g, b);
+ if (getRGBAt((*colours)[5], r1, g1, b1, r2, g2, b2)) {
+ useColor(r1, g1, b1);
face.push_back(vertices[7]);
face.push_back(vertices[6]);
@@ -308,66 +343,102 @@ void Renderer::renderPyramid(const Math::Vector3d &origin, const Math::Vector3d
}
void Renderer::renderCube(const Math::Vector3d &origin, const Math::Vector3d &size, Common::Array<uint8> *colours) {
- uint8 r, g, b;
+ uint8 r1, g1, b1, r2, g2, b2;
Common::Array<Math::Vector3d> face;
- if (getRGBAt((*colours)[0], r, g, b)) {
- useColor(r, g, b);
+ if (getRGBAt((*colours)[0], r1, g1, b1, r2, g2, b2)) {
+ useColor(r1, g1, b1);
face.push_back(origin);
face.push_back(Math::Vector3d(origin.x(), origin.y(), origin.z() + size.z()));
face.push_back(Math::Vector3d(origin.x(), origin.y() + size.y(), origin.z() + size.z()));
face.push_back(Math::Vector3d(origin.x(), origin.y() + size.y(), origin.z()));
renderFace(face);
+ if (r1 != r2 || g1 != g2 || b1 != b2) {
+ useStipple(true);
+ useColor(r2, g2, b2);
+ renderFace(face);
+ useStipple(false);
+ }
}
- if (getRGBAt((*colours)[1], r, g, b)) {
- useColor(r, g, b);
+ if (getRGBAt((*colours)[1], r1, g1, b1, r2, g2, b2)) {
+ useColor(r1, g1, b1);
face.clear();
face.push_back(Math::Vector3d(origin.x() + size.x(), origin.y() + size.y(), origin.z()));
face.push_back(Math::Vector3d(origin.x() + size.x(), origin.y() + size.y(), origin.z() + size.z()));
face.push_back(Math::Vector3d(origin.x() + size.x(), origin.y(), origin.z() + size.z()));
face.push_back(Math::Vector3d(origin.x() + size.x(), origin.y(), origin.z()));
renderFace(face);
+ if (r1 != r2 || g1 != g2 || b1 != b2) {
+ useStipple(true);
+ useColor(r2, g2, b2);
+ renderFace(face);
+ useStipple(false);
+ }
}
- if (getRGBAt((*colours)[2], r, g, b)) {
- useColor(r, g, b);
+ if (getRGBAt((*colours)[2], r1, g1, b1, r2, g2, b2)) {
+ useColor(r1, g1, b1);
face.clear();
face.push_back(Math::Vector3d(origin.x() + size.x(), origin.y(), origin.z()));
face.push_back(Math::Vector3d(origin.x() + size.x(), origin.y(), origin.z() + size.z()));
face.push_back(Math::Vector3d(origin.x(), origin.y(), origin.z() + size.z()));
face.push_back(Math::Vector3d(origin.x(), origin.y(), origin.z()));
renderFace(face);
+ if (r1 != r2 || g1 != g2 || b1 != b2) {
+ useStipple(true);
+ useColor(r2, g2, b2);
+ renderFace(face);
+ useStipple(false);
+ }
}
- if (getRGBAt((*colours)[3], r, g, b)) {
- useColor(r, g, b);
+ if (getRGBAt((*colours)[3], r1, g1, b1, r2, g2, b2)) {
+ useColor(r1, g1, b1);
face.clear();
face.push_back(Math::Vector3d(origin.x(), origin.y() + size.y(), origin.z()));
face.push_back(Math::Vector3d(origin.x(), origin.y() + size.y(), origin.z() + size.z()));
face.push_back(Math::Vector3d(origin.x() + size.x(), origin.y() + size.y(), origin.z() + size.z()));
face.push_back(Math::Vector3d(origin.x() + size.x(), origin.y() + size.y(), origin.z()));
renderFace(face);
+ if (r1 != r2 || g1 != g2 || b1 != b2) {
+ useStipple(true);
+ useColor(r2, g2, b2);
+ renderFace(face);
+ useStipple(false);
+ }
}
- if (getRGBAt((*colours)[4], r, g, b)) {
- useColor(r, g, b);
+ if (getRGBAt((*colours)[4], r1, g1, b1, r2, g2, b2)) {
+ useColor(r1, g1, b1);
face.clear();
face.push_back(Math::Vector3d(origin.x(), origin.y() + size.y(), origin.z()));
face.push_back(Math::Vector3d(origin.x() + size.x(), origin.y() + size.y(), origin.z()));
face.push_back(Math::Vector3d(origin.x() + size.x(), origin.y(), origin.z()));
face.push_back(origin);
renderFace(face);
+ if (r1 != r2 || g1 != g2 || b1 != b2) {
+ useStipple(true);
+ useColor(r2, g2, b2);
+ renderFace(face);
+ useStipple(false);
+ }
}
- if (getRGBAt((*colours)[5], r, g, b)) {
- useColor(r, g, b);
+ if (getRGBAt((*colours)[5], r1, g1, b1, r2, g2, b2)) {
+ useColor(r1, g1, b1);
face.clear();
face.push_back(Math::Vector3d(origin.x(), origin.y(), origin.z() + size.z()));
face.push_back(Math::Vector3d(origin.x() + size.x(), origin.y(), origin.z() + size.z()));
face.push_back(Math::Vector3d(origin.x() + size.x(), origin.y() + size.y(), origin.z() + size.z()));
face.push_back(Math::Vector3d(origin.x(), origin.y() + size.y(), origin.z() + size.z()));
renderFace(face);
+ if (r1 != r2 || g1 != g2 || b1 != b2) {
+ useStipple(true);
+ useColor(r2, g2, b2);
+ renderFace(face);
+ useStipple(false);
+ }
}
}
@@ -377,13 +448,13 @@ void Renderer::renderRectangle(const Math::Vector3d &origin, const Math::Vector3
polygonOffset(true);
float dx, dy, dz;
- uint8 r, g, b;
+ uint8 r1, g1, b1, r2, g2, b2;
Common::Array<Math::Vector3d> vertices;
for (int i = 0; i < 2; i++) {
// debug("rec color: %d", (*colours)[i]);
- if (getRGBAt((*colours)[i], r, g, b)) {
- useColor(r, g, b);
+ if (getRGBAt((*colours)[i], r1, g1, b1, r2, g2, b2)) {
+ useColor(r1, g1, b1);
vertices.clear();
vertices.push_back(Math::Vector3d(origin.x(), origin.y(), origin.z()));
@@ -421,7 +492,7 @@ void Renderer::renderRectangle(const Math::Vector3d &origin, const Math::Vector3
}
void Renderer::renderPolygon(const Math::Vector3d &origin, const Math::Vector3d &size, const Common::Array<uint16> *ordinates, Common::Array<uint8> *colours) {
- uint8 r, g, b;
+ uint8 r1, g1, b1, r2, g2, b2;
if (ordinates->size() % 3 > 0 && ordinates->size() > 0)
error("Invalid polygon with size %f %f %f and ordinates %d", size.x(), size.y(), size.z(), ordinates->size());
@@ -429,30 +500,30 @@ void Renderer::renderPolygon(const Math::Vector3d &origin, const Math::Vector3d
polygonOffset(true);
if (ordinates->size() == 6) { // Line
- assert(getRGBAt((*colours)[0], r, g, b)); // It will never return false?
- useColor(r, g, b);
+ assert(getRGBAt((*colours)[0], r1, g1, b1, r2, g2, b2)); // It will never return false?
+ useColor(r1, g1, b1);
for (uint i = 0; i < ordinates->size(); i = i + 3)
vertices.push_back(Math::Vector3d((*ordinates)[i], (*ordinates)[i + 1], (*ordinates)[i + 2]));
renderFace(vertices);
vertices.clear();
- assert(getRGBAt((*colours)[1], r, g, b)); // It will never return false?
- useColor(r, g, b);
+ assert(getRGBAt((*colours)[1], r1, g1, b1, r2, g2, b2)); // It will never return false?
+ useColor(r1, g1, b1);
for (int i = ordinates->size(); i > 0; i = i - 3)
vertices.push_back(Math::Vector3d((*ordinates)[i - 3], (*ordinates)[i - 2], (*ordinates)[i - 1]));
renderFace(vertices);
} else {
- if (getRGBAt((*colours)[0], r, g, b)) {
- useColor(r, g, b);
+ if (getRGBAt((*colours)[0], r1, g1, b1, r2, g2, b2)) {
+ useColor(r1, g1, b1);
for (uint i = 0; i < ordinates->size(); i = i + 3) {
vertices.push_back(Math::Vector3d((*ordinates)[i], (*ordinates)[i + 1], (*ordinates)[i + 2]));
}
renderFace(vertices);
}
vertices.clear();
- if (getRGBAt((*colours)[1], r, g, b)) {
- useColor(r, g, b);
+ if (getRGBAt((*colours)[1], r1, g1, b1, r2, g2, b2)) {
+ useColor(r1, g1, b1);
for (int i = ordinates->size(); i > 0; i = i - 3) {
vertices.push_back(Math::Vector3d((*ordinates)[i - 3], (*ordinates)[i - 2], (*ordinates)[i - 1]));
}
diff --git a/engines/freescape/gfx.h b/engines/freescape/gfx.h
index 513914874b4..8aaf8119b86 100644
--- a/engines/freescape/gfx.h
+++ b/engines/freescape/gfx.h
@@ -98,7 +98,11 @@ public:
// palette
void readFromPalette(uint8 index, uint8 &r, uint8 &g, uint8 &b);
uint8 indexFromColor(uint8 r, uint8 g, uint8 b);
- bool getRGBAt(uint8 index, uint8 &r, uint8 &g, uint8 &b);
+ bool getRGBAt(uint8 index, uint8 &r1, uint8 &g1, uint8 &b1, uint8 &r2, uint8 &g2, uint8 &b2);
+ bool getRGBAtCGA(uint8 index, uint8 &r1, uint8 &g1, uint8 &b1, uint8 &r2, uint8 &g2, uint8 &b2);
+ bool getRGBAtEGA(uint8 index, uint8 &r1, uint8 &g1, uint8 &b1, uint8 &r2, uint8 &g2, uint8 &b2);
+
+ virtual void useStipple(bool enabled) {};
byte *_palette;
ColorMap *_colorMap;
ColorReMap *_colorRemaps;
diff --git a/engines/freescape/gfx_opengl.cpp b/engines/freescape/gfx_opengl.cpp
index dba1047c308..e2798af00e4 100644
--- a/engines/freescape/gfx_opengl.cpp
+++ b/engines/freescape/gfx_opengl.cpp
@@ -196,7 +196,7 @@ void OpenGLRenderer::renderPlayerShoot(byte color, const Common::Point position,
glReadPixels(g_system->getWidth() / 2, g_system->getHeight() / 2, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, &pixel);
_texturePixelFormat.colorToARGB(pixel, a, r, g, b);
color = indexFromColor(r, g, b);
- readFromPalette((color + 3) % 16, r, g, b);
+ readFromPalette((color + 3) % (_renderMode == Common::kRenderCGA ? 4 : 16), r, g, b);
glDisable(GL_DEPTH_TEST);
glDepthMask(GL_FALSE);
@@ -268,6 +268,19 @@ void OpenGLRenderer::polygonOffset(bool enabled) {
}
}
+void OpenGLRenderer::useStipple(bool enabled) {
+ if (enabled) {
+ glEnable(GL_POLYGON_OFFSET_FILL);
+ glPolygonOffset(-5.0f, 1.0f);
+ glEnable(GL_POLYGON_STIPPLE);
+ glPolygonStipple(_stippleArray);
+ } else {
+ glPolygonOffset(0, 0);
+ glDisable(GL_POLYGON_OFFSET_FILL);
+ glDisable(GL_POLYGON_STIPPLE);
+ }
+}
+
void OpenGLRenderer::useColor(uint8 r, uint8 g, uint8 b) {
glColor3ub(r, g, b);
}
@@ -285,9 +298,9 @@ void OpenGLRenderer::clear(uint8 color) {
}
void OpenGLRenderer::drawFloor(uint8 color) {
- uint8 r, g, b;
- assert(getRGBAt(color, r, g, b)); // TODO: move check inside this function
- glColor3ub(r, g, b);
+ uint8 r1, g1, b1, r2, g2, b2;
+ assert(getRGBAt(color, r1, g1, b1, r2, g2, b2)); // TODO: move check inside this function
+ glColor3ub(r1, g1, b1);
glEnableClientState(GL_VERTEX_ARRAY);
copyToVertexArray(0, Math::Vector3d(-100000.0, 0.0, -100000.0));
diff --git a/engines/freescape/gfx_opengl.h b/engines/freescape/gfx_opengl.h
index aa3669a8f38..2dd0deaec3e 100644
--- a/engines/freescape/gfx_opengl.h
+++ b/engines/freescape/gfx_opengl.h
@@ -60,6 +60,25 @@ public:
_coords[idx].x = src.getValue(0); _coords[idx].y = src.getValue(1);
}
+ GLubyte _stippleArray[128] = {
+ 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC,
+ 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33,
+ 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC,
+ 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33,
+ 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC,
+ 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33,
+ 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC,
+ 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33,
+ 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC,
+ 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33,
+ 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC,
+ 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33,
+ 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC,
+ 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33,
+ 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC,
+ 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33,
+ };
+
virtual void init() override;
virtual void clear(uint8 color) override;
virtual void setViewport(const Common::Rect &rect) override;
@@ -68,6 +87,7 @@ public:
virtual void useColor(uint8 r, uint8 g, uint8 b) override;
virtual void polygonOffset(bool enabled) override;
+ virtual void useStipple(bool enabled) override;
Texture *createTexture(const Graphics::Surface *surface) override;
void freeTexture(Texture *texture) override;
diff --git a/engines/freescape/gfx_tinygl.cpp b/engines/freescape/gfx_tinygl.cpp
index fd599676509..6cc77743985 100644
--- a/engines/freescape/gfx_tinygl.cpp
+++ b/engines/freescape/gfx_tinygl.cpp
@@ -226,9 +226,9 @@ void TinyGLRenderer::clear(uint8 color) {
}
void TinyGLRenderer::drawFloor(uint8 color) {
- uint8 r, g, b;
- assert(getRGBAt(color, r, g, b)); // TODO: move check inside this function
- tglColor3ub(r, g, b);
+ uint8 r1, g1, b1, r2, g2, b2;
+ assert(getRGBAt(color, r1, g1, b1, r2, g2, b2)); // TODO: move check inside this function
+ tglColor3ub(r1, g1, b1);
tglEnableClientState(TGL_VERTEX_ARRAY);
copyToVertexArray(0, Math::Vector3d(-100000.0, 0.0, -100000.0));
diff --git a/engines/freescape/loaders/8bitBinaryLoader.cpp b/engines/freescape/loaders/8bitBinaryLoader.cpp
index e77cc66b19c..b32e6000e70 100644
--- a/engines/freescape/loaders/8bitBinaryLoader.cpp
+++ b/engines/freescape/loaders/8bitBinaryLoader.cpp
@@ -130,15 +130,15 @@ Object *FreescapeEngine::load8bitObject(Common::SeekableReadStream *file) {
for (uint8 colour = 0; colour < numberOfColours / 2; colour++) {
uint8 data = readField(file, 8);
entry = data & 0xf;
- if (_renderMode == Common::kRenderCGA)
- entry = entry % 4; // TODO: use dithering
+ //if (_renderMode == Common::kRenderCGA)
+ // entry = entry % 4; // TODO: use dithering
colours->push_back(entry);
debugC(1, kFreescapeDebugParser, "color[%d] = %x", 2 * colour, entry);
entry = data >> 4;
- if (_renderMode == Common::kRenderCGA)
- entry = entry % 4; // TODO: use dithering
+ //if (_renderMode == Common::kRenderCGA)
+ // entry = entry % 4; // TODO: use dithering
colours->push_back(entry);
debugC(1, kFreescapeDebugParser, "color[%d] = %x", 2 * colour + 1, entry);
Commit: 49cbc6f6244c8be9b05581f42afb4f8da91a4b18
https://github.com/scummvm/scummvm/commit/49cbc6f6244c8be9b05581f42afb4f8da91a4b18
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2022-12-20T08:26:44-03:00
Commit Message:
FREESCAPE: preliminary code to swap colors from border in driller DOS (CGA)
Changed paths:
engines/freescape/games/driller.cpp
diff --git a/engines/freescape/games/driller.cpp b/engines/freescape/games/driller.cpp
index cacdd9df46d..b607fab5696 100644
--- a/engines/freescape/games/driller.cpp
+++ b/engines/freescape/games/driller.cpp
@@ -131,6 +131,26 @@ void DrillerEngine::gotoArea(uint16 areaID, int entranceID) {
if (isAmiga() || isAtariST())
swapPalette(areaID);
+ else if (isDOS() && _renderMode == Common::kRenderCGA) {
+ delete _borderTexture;
+ // Replace black pixel for transparent ones
+ uint32 color1 = _border->format.ARGBToColor(0xFF, 0xAA, 0x00, 0xAA);
+ uint32 color2 = _border->format.ARGBToColor(0xFF, 0xAA, 0x55, 0x00);
+
+ uint32 colorA = _border->format.ARGBToColor(0xFF, 0x00, 0xAA, 0xAA);
+ uint32 colorB = _border->format.ARGBToColor(0xFF, 0x00, 0xAA, 0x00);
+
+ for (int i = 0; i < _border->w; i++) {
+ for (int j = 0; j < _border->h; j++) {
+ if (_border->getPixel(i, j) == color1)
+ _border->setPixel(i, j, color2);
+ else if (_border->getPixel(i, j) == colorA)
+ _border->setPixel(i, j, colorB);
+
+ }
+ }
+ _borderTexture = _gfx->createTexture(_border);
+ }
_currentArea->_skyColor = 0;
_currentArea->_usualBackgroundColor = 0;
Commit: 7abb3e32ae3fb9819addd1977f1cd62e89b0815f
https://github.com/scummvm/scummvm/commit/7abb3e32ae3fb9819addd1977f1cd62e89b0815f
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2022-12-20T08:26:44-03:00
Commit Message:
FREESCAPE: recreated border image from driller (CGA) and regenerated engine data
Changed paths:
devtools/create_freescape/driller_cga.bmp
dists/engine-data/freescape.dat
diff --git a/devtools/create_freescape/driller_cga.bmp b/devtools/create_freescape/driller_cga.bmp
index 180d239aa9a..4234daf00ac 100644
Binary files a/devtools/create_freescape/driller_cga.bmp and b/devtools/create_freescape/driller_cga.bmp differ
diff --git a/dists/engine-data/freescape.dat b/dists/engine-data/freescape.dat
index 18a4415c695..87eff18683e 100644
Binary files a/dists/engine-data/freescape.dat and b/dists/engine-data/freescape.dat differ
Commit: 53e4bfc38828d6cb2d0d80b2b13d9bfe7352e7e7
https://github.com/scummvm/scummvm/commit/53e4bfc38828d6cb2d0d80b2b13d9bfe7352e7e7
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2022-12-20T08:26:44-03:00
Commit Message:
FREESCAPE: adjusted viewport in driller (CGA)
Changed paths:
engines/freescape/games/driller.cpp
diff --git a/engines/freescape/games/driller.cpp b/engines/freescape/games/driller.cpp
index b607fab5696..395bc6821a3 100644
--- a/engines/freescape/games/driller.cpp
+++ b/engines/freescape/games/driller.cpp
@@ -40,8 +40,14 @@ DrillerEngine::DrillerEngine(OSystem *syst, const ADGameDescription *gd) : Frees
if (!Common::parseBool(ConfMan.get("automatic_drilling"), _useAutomaticDrilling))
error("Failed to parse bool from automatic_drilling option");
- if (isDOS())
- _viewArea = Common::Rect(40, 16, 280, 117);
+ if (isDOS()) {
+ if (_renderMode == Common::kRenderEGA)
+ _viewArea = Common::Rect(40, 16, 280, 117);
+ else if (_renderMode == Common::kRenderCGA)
+ _viewArea = Common::Rect(36, 16, 284, 117);
+ else
+ error("Invalid or unknown render mode");
+ }
else if (isAmiga() || isAtariST())
_viewArea = Common::Rect(36, 16, 284, 118);
Commit: 05e320fec97a5ef90757b49673d7da21e2ac7f89
https://github.com/scummvm/scummvm/commit/05e320fec97a5ef90757b49673d7da21e2ac7f89
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2022-12-20T08:26:44-03:00
Commit Message:
FREESCAPE: improve CGA renderer
Changed paths:
engines/freescape/gfx.cpp
diff --git a/engines/freescape/gfx.cpp b/engines/freescape/gfx.cpp
index f68abc6f125..bcf978d41e9 100644
--- a/engines/freescape/gfx.cpp
+++ b/engines/freescape/gfx.cpp
@@ -282,6 +282,14 @@ void Renderer::renderPyramid(const Math::Vector3d &origin, const Math::Vector3d
face.push_back(vertices[0]);
renderFace(face);
+
+ if (r1 != r2 || g1 != g2 || b1 != b2) {
+ useStipple(true);
+ useColor(r2, g2, b2);
+ renderFace(face);
+ useStipple(false);
+ }
+
face.clear();
}
@@ -294,6 +302,13 @@ void Renderer::renderPyramid(const Math::Vector3d &origin, const Math::Vector3d
face.push_back(vertices[1]);
renderFace(face);
+ if (r1 != r2 || g1 != g2 || b1 != b2) {
+ useStipple(true);
+ useColor(r2, g2, b2);
+ renderFace(face);
+ useStipple(false);
+ }
+
face.clear();
}
@@ -305,6 +320,13 @@ void Renderer::renderPyramid(const Math::Vector3d &origin, const Math::Vector3d
face.push_back(vertices[3]);
face.push_back(vertices[2]);
renderFace(face);
+ if (r1 != r2 || g1 != g2 || b1 != b2) {
+ useStipple(true);
+ useColor(r2, g2, b2);
+ renderFace(face);
+ useStipple(false);
+ }
+
face.clear();
}
@@ -317,6 +339,13 @@ void Renderer::renderPyramid(const Math::Vector3d &origin, const Math::Vector3d
face.push_back(vertices[3]);
renderFace(face);
+ if (r1 != r2 || g1 != g2 || b1 != b2) {
+ useStipple(true);
+ useColor(r2, g2, b2);
+ renderFace(face);
+ useStipple(false);
+ }
+
face.clear();
}
@@ -328,6 +357,13 @@ void Renderer::renderPyramid(const Math::Vector3d &origin, const Math::Vector3d
face.push_back(vertices[2]);
face.push_back(vertices[3]);
renderFace(face);
+ if (r1 != r2 || g1 != g2 || b1 != b2) {
+ useStipple(true);
+ useColor(r2, g2, b2);
+ renderFace(face);
+ useStipple(false);
+ }
+
face.clear();
}
@@ -339,6 +375,12 @@ void Renderer::renderPyramid(const Math::Vector3d &origin, const Math::Vector3d
face.push_back(vertices[5]);
face.push_back(vertices[4]);
renderFace(face);
+ if (r1 != r2 || g1 != g2 || b1 != b2) {
+ useStipple(true);
+ useColor(r2, g2, b2);
+ renderFace(face);
+ useStipple(false);
+ }
}
}
@@ -470,6 +512,12 @@ void Renderer::renderRectangle(const Math::Vector3d &origin, const Math::Vector3
vertices.push_back(Math::Vector3d(origin.x() + dx, origin.y() + dy, origin.z() + dz));
vertices.push_back(Math::Vector3d(origin.x() + size.x(), origin.y() + size.y(), origin.z() + size.z()));
renderFace(vertices);
+ if (r1 != r2 || g1 != g2 || b1 != b2) {
+ useStipple(true);
+ useColor(r2, g2, b2);
+ renderFace(vertices);
+ useStipple(false);
+ }
vertices.clear();
vertices.push_back(Math::Vector3d(origin.x(), origin.y(), origin.z()));
@@ -486,6 +534,12 @@ void Renderer::renderRectangle(const Math::Vector3d &origin, const Math::Vector3
vertices.push_back(Math::Vector3d(origin.x() + dx, origin.y() + dy, origin.z() + dz));
vertices.push_back(Math::Vector3d(origin.x() + size.x(), origin.y() + size.y(), origin.z() + size.z()));
renderFace(vertices);
+ if (r1 != r2 || g1 != g2 || b1 != b2) {
+ useStipple(true);
+ useColor(r2, g2, b2);
+ renderFace(vertices);
+ useStipple(false);
+ }
}
}
polygonOffset(false);
@@ -505,6 +559,12 @@ void Renderer::renderPolygon(const Math::Vector3d &origin, const Math::Vector3d
for (uint i = 0; i < ordinates->size(); i = i + 3)
vertices.push_back(Math::Vector3d((*ordinates)[i], (*ordinates)[i + 1], (*ordinates)[i + 2]));
renderFace(vertices);
+ if (r1 != r2 || g1 != g2 || b1 != b2) {
+ useStipple(true);
+ useColor(r2, g2, b2);
+ renderFace(vertices);
+ useStipple(false);
+ }
vertices.clear();
assert(getRGBAt((*colours)[1], r1, g1, b1, r2, g2, b2)); // It will never return false?
@@ -512,6 +572,12 @@ void Renderer::renderPolygon(const Math::Vector3d &origin, const Math::Vector3d
for (int i = ordinates->size(); i > 0; i = i - 3)
vertices.push_back(Math::Vector3d((*ordinates)[i - 3], (*ordinates)[i - 2], (*ordinates)[i - 1]));
renderFace(vertices);
+ if (r1 != r2 || g1 != g2 || b1 != b2) {
+ useStipple(true);
+ useColor(r2, g2, b2);
+ renderFace(vertices);
+ useStipple(false);
+ }
} else {
if (getRGBAt((*colours)[0], r1, g1, b1, r2, g2, b2)) {
@@ -520,6 +586,12 @@ void Renderer::renderPolygon(const Math::Vector3d &origin, const Math::Vector3d
vertices.push_back(Math::Vector3d((*ordinates)[i], (*ordinates)[i + 1], (*ordinates)[i + 2]));
}
renderFace(vertices);
+ if (r1 != r2 || g1 != g2 || b1 != b2) {
+ useStipple(true);
+ useColor(r2, g2, b2);
+ renderFace(vertices);
+ useStipple(false);
+ }
}
vertices.clear();
if (getRGBAt((*colours)[1], r1, g1, b1, r2, g2, b2)) {
@@ -528,6 +600,12 @@ void Renderer::renderPolygon(const Math::Vector3d &origin, const Math::Vector3d
vertices.push_back(Math::Vector3d((*ordinates)[i - 3], (*ordinates)[i - 2], (*ordinates)[i - 1]));
}
renderFace(vertices);
+ if (r1 != r2 || g1 != g2 || b1 != b2) {
+ useStipple(true);
+ useColor(r2, g2, b2);
+ renderFace(vertices);
+ useStipple(false);
+ }
}
}
More information about the Scummvm-git-logs
mailing list