[Scummvm-git-logs] scummvm master -> 2ce1359e5d0d07abe25429fb356b9209525a02a3
neuromancer
noreply at scummvm.org
Wed Dec 21 10:29:39 UTC 2022
This automated email contains information about 5 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
80b38c85a3 FREESCAPE: fix crash in CGA renderer when shooting
63df3b62fb FREESCAPE: correctly load border and palette in CGA mode
d03ab98029 FREESCAPE: fixed incorrect parameter when rendering pyramids in EGA/CGA mode
0e9e395247 FREESCAPE: fixed incorrect color in one of the CGA palettes from Driller (DOS)
2ce1359e5d FREESCAPE: small fix for driller (DOS) UI when using CGA mode
Commit: 80b38c85a34e97e5e57113d08d141441da61d1c6
https://github.com/scummvm/scummvm/commit/80b38c85a34e97e5e57113d08d141441da61d1c6
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2022-12-21T07:29:11-03:00
Commit Message:
FREESCAPE: fix crash in CGA renderer when shooting
Changed paths:
engines/freescape/gfx_opengl.cpp
diff --git a/engines/freescape/gfx_opengl.cpp b/engines/freescape/gfx_opengl.cpp
index e2798af00e4..5c2b35d6f05 100644
--- a/engines/freescape/gfx_opengl.cpp
+++ b/engines/freescape/gfx_opengl.cpp
@@ -191,12 +191,15 @@ void OpenGLRenderer::renderPlayerShoot(byte color, const Common::Point position,
glOrtho(0, _screenW, _screenH, 0, 0, 1);
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) % (_renderMode == Common::kRenderCGA ? 4 : 16), r, g, b);
+ if (_renderMode == Common::kRenderCGA) {
+ r = g = b = 255;
+ } else {
+ 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) % (_renderMode == Common::kRenderCGA ? 4 : 16), r, g, b);
+ }
glDisable(GL_DEPTH_TEST);
glDepthMask(GL_FALSE);
Commit: 63df3b62fb2cb3f98a49a77e097dc84a674f5a5a
https://github.com/scummvm/scummvm/commit/63df3b62fb2cb3f98a49a77e097dc84a674f5a5a
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2022-12-21T07:29:11-03:00
Commit Message:
FREESCAPE: correctly load border and palette in CGA mode
Changed paths:
engines/freescape/freescape.cpp
engines/freescape/freescape.h
engines/freescape/games/driller.cpp
engines/freescape/games/palettes.cpp
diff --git a/engines/freescape/freescape.cpp b/engines/freescape/freescape.cpp
index e03044dfda6..6e8431a00a2 100644
--- a/engines/freescape/freescape.cpp
+++ b/engines/freescape/freescape.cpp
@@ -512,11 +512,7 @@ Common::Error FreescapeEngine::run() {
}
}
- if (_border) {
- _borderTexture = nullptr;
- uint32 gray = _gfx->_texturePixelFormat.ARGBToColor(0x00, 0xA0, 0xA0, 0xA0);
- _border->fillRect(_viewArea, gray);
- }
+ prepareBorder();
if (saveSlot >= 0) { // load the savegame
loadGameState(saveSlot);
} else
@@ -555,6 +551,14 @@ Common::Error FreescapeEngine::run() {
return Common::kNoError;
}
+void FreescapeEngine::prepareBorder() {
+ if (_border) {
+ _borderTexture = nullptr;
+ uint32 gray = _gfx->_texturePixelFormat.ARGBToColor(0x00, 0xA0, 0xA0, 0xA0);
+ _border->fillRect(_viewArea, gray);
+ }
+}
+
bool FreescapeEngine::checkIfGameEnded() {
return false; // TODO
}
diff --git a/engines/freescape/freescape.h b/engines/freescape/freescape.h
index 43241faee9c..0e94bc02952 100644
--- a/engines/freescape/freescape.h
+++ b/engines/freescape/freescape.h
@@ -104,7 +104,7 @@ public:
Common::Rect _fullscreenViewArea;
void centerCrossair();
- void convertBorder();
+ virtual void prepareBorder();
void drawBorder();
void drawTitle();
void drawBackground();
@@ -115,6 +115,8 @@ public:
Texture *_borderTexture;
Texture *_titleTexture;
Texture *_uiTexture;
+ Common::HashMap<uint16, Texture *> _borderCGAByArea;
+ Common::HashMap<uint16, byte *> _paletteCGAByArea;
// Parsing assets
uint8 _binaryBits;
@@ -357,6 +359,7 @@ public:
void gotoArea(uint16 areaID, int entranceID) override;
+ void prepareBorder() override;
void loadAssets() override;
void drawUI() override;
diff --git a/engines/freescape/games/driller.cpp b/engines/freescape/games/driller.cpp
index 395bc6821a3..fe2f628ce0b 100644
--- a/engines/freescape/games/driller.cpp
+++ b/engines/freescape/games/driller.cpp
@@ -29,6 +29,20 @@
namespace Freescape {
+byte dos_CGA_palette[4][3] = {
+ {0x00, 0x00, 0x00},
+ {0x00, 0xaa, 0xaa},
+ {0xaa, 0x00, 0x00},
+ {0xaa, 0xaa, 0xaa},
+};
+
+byte dos_CGA_palette_alt[4][3] = {
+ {0x00, 0x00, 0x00},
+ {0x00, 0xaa, 0x00},
+ {0xaa, 0x00, 0x00},
+ {0xaa, 0x55, 0x00},
+};
+
enum {
kDrillerNoRig = 0,
kDrillerRigInPlace = 1,
@@ -135,29 +149,7 @@ void DrillerEngine::gotoArea(uint16 areaID, int entranceID) {
_gfx->_keyColor = 0;
_gfx->setColorRemaps(&_currentArea->_colorRemaps);
- 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);
- }
-
+ swapPalette(areaID);
_currentArea->_skyColor = 0;
_currentArea->_usualBackgroundColor = 0;
@@ -434,6 +426,45 @@ void DrillerEngine::loadAssetsFullGame() {
_areaMap[18]->_conditionSources.push_back(conditionSource);
}
+void DrillerEngine::prepareBorder() {
+ FreescapeEngine::prepareBorder();
+ if (isDOS() && _renderMode == Common::kRenderCGA) { // Replace some colors for the CGA borders
+ 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);
+
+ uint32 colorX = _border->format.ARGBToColor(0xFF, 0xAA, 0xAA, 0xAA);
+ uint32 colorY = _border->format.ARGBToColor(0xFF, 0xAA, 0x00, 0x00);
+
+ Graphics::Surface *borderCopy = new Graphics::Surface();
+ borderCopy->create(1, 1, _border->format);
+ borderCopy->copyFrom(*_border);
+
+ for (int i = 0; i < _border->w; i++) {
+ for (int j = 0; j < _border->h; j++) {
+ if (borderCopy->getPixel(i, j) == color1)
+ borderCopy->setPixel(i, j, color2);
+ else if (borderCopy->getPixel(i, j) == colorA)
+ borderCopy->setPixel(i, j, colorB);
+ else if (borderCopy->getPixel(i, j) == colorX)
+ borderCopy->setPixel(i, j, colorY);
+
+ }
+ }
+ Texture *borderTextureAlterative = _gfx->createTexture(borderCopy);
+ _borderCGAByArea[1] = borderTextureAlterative;
+ _paletteCGAByArea[1] = (byte *)dos_CGA_palette_alt;
+
+ _borderCGAByArea[2] = _borderTexture;
+ _paletteCGAByArea[2] = (byte *)dos_CGA_palette;
+
+ _borderCGAByArea[8] = _borderTexture;
+ _borderCGAByArea[14] = _borderTexture;
+ }
+}
+
void DrillerEngine::drawUI() {
Graphics::Surface *surface = nullptr;
if (_border) { // This can be removed when all the borders are loaded
@@ -464,42 +495,46 @@ void DrillerEngine::drawUI() {
}
void DrillerEngine::drawDOSUI(Graphics::Surface *surface) {
- uint32 yellow = _gfx->_texturePixelFormat.ARGBToColor(0xFF, 0xFF, 0xFF, 0x55);
- uint8 color = _currentArea->_usualBackgroundColor;
+ 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];
}
- 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, 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);
+ drawStringInSurface(_currentArea->_name, 196, 185, front, back, surface);
+ drawStringInSurface(Common::String::format("%04d", 2 * int(_position.x())), 150, 145, front, back, surface);
+ drawStringInSurface(Common::String::format("%04d", 2 * int(_position.z())), 150, 153, front, back, surface);
+ drawStringInSurface(Common::String::format("%04d", 2 * int(_position.y())), 150, 161, front, back, surface);
if (_playerHeightNumber >= 0)
- drawStringInSurface(Common::String::format("%d", _playerHeightNumber), 57, 161, yellow, back, surface);
+ drawStringInSurface(Common::String::format("%d", _playerHeightNumber), 57, 161, front, back, surface);
else
- drawStringInSurface(Common::String::format("%s", "J"), 57, 161, yellow, back, surface);
+ drawStringInSurface(Common::String::format("%s", "J"), 57, 161, front, back, 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);
+ drawStringInSurface(Common::String::format("%02d", int(_angleRotations[_angleRotationIndex])), 46, 145, front, back, surface);
+ drawStringInSurface(Common::String::format("%3d", _playerSteps[_playerStepIndex]), 46, 153, front, back, surface);
+ drawStringInSurface(Common::String::format("%07d", score), 238, 129, front, back, surface);
int hours = _countdown <= 0 ? 0 : _countdown / 3600;
- drawStringInSurface(Common::String::format("%02d", hours), 208, 8, yellow, back, surface);
+ drawStringInSurface(Common::String::format("%02d", hours), 208, 8, front, back, surface);
int minutes = _countdown <= 0 ? 0 : (_countdown - hours * 3600) / 60;
- drawStringInSurface(Common::String::format("%02d", minutes), 230, 8, yellow, back, surface);
+ drawStringInSurface(Common::String::format("%02d", minutes), 230, 8, front, back, surface);
int seconds = _countdown <= 0 ? 0 : _countdown - hours * 3600 - minutes * 60;
- drawStringInSurface(Common::String::format("%02d", seconds), 254, 8, yellow, back, surface);
+ drawStringInSurface(Common::String::format("%02d", seconds), 254, 8, front, back, surface);
Common::String message;
int deadline;
getLatestMessages(message, deadline);
if (deadline <= _countdown) {
- drawStringInSurface(message, 190, 177, back, yellow, surface);
+ drawStringInSurface(message, 190, 177, back, front, surface);
_temporaryMessages.push_back(message);
_temporaryMessageDeadlines.push_back(deadline);
} else {
@@ -510,7 +545,7 @@ void DrillerEngine::drawDOSUI(Graphics::Surface *surface) {
else
message = _messagesList[1];
- drawStringInSurface(message, 191, 177, yellow, back, surface);
+ drawStringInSurface(message, 191, 177, front, back, surface);
}
int energy = _gameStateVars[k8bitVariableEnergy];
@@ -520,7 +555,7 @@ void DrillerEngine::drawDOSUI(Graphics::Surface *surface) {
Common::Rect backBar(20, 185, 88 - energy, 191);
surface->fillRect(backBar, back);
Common::Rect energyBar(87 - energy, 185, 88, 191);
- surface->fillRect(energyBar, yellow);
+ surface->fillRect(energyBar, front);
}
if (shield >= 0) {
@@ -528,7 +563,7 @@ void DrillerEngine::drawDOSUI(Graphics::Surface *surface) {
surface->fillRect(backBar, back);
Common::Rect shieldBar(87 - shield, 177, 88, 183);
- surface->fillRect(shieldBar, yellow);
+ surface->fillRect(shieldBar, front);
}
}
}
diff --git a/engines/freescape/games/palettes.cpp b/engines/freescape/games/palettes.cpp
index edfece45d2b..75f4b509717 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},
- {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_CGA_palette;
+ _gfx->_palette = nullptr; // palette depends on the area
} else if (_renderMode == Common::kRenderAmiga || _renderMode == Common::kRenderAtariST) {
_gfx->_palette = nullptr; // palette depends on the area
} else
@@ -90,7 +83,14 @@ void FreescapeEngine::loadPalettes(Common::SeekableReadStream *file, int offset)
}
void FreescapeEngine::swapPalette(uint16 levelID) {
- _gfx->_palette = _paletteByArea[levelID];
+ if (isAmiga() || isAtariST())
+ _gfx->_palette = _paletteByArea[levelID];
+ else if (isDOS() && _renderMode == Common::kRenderCGA) {
+ assert(_borderCGAByArea.contains(levelID));
+ assert(_paletteCGAByArea.contains(levelID));
+ _borderTexture = _borderCGAByArea.getVal(levelID);
+ _gfx->_palette = _paletteCGAByArea.getVal(levelID);
+ }
}
} // End of namespace Freescape
Commit: d03ab98029f79125cd0d05349bf7e1bbd86b9ba6
https://github.com/scummvm/scummvm/commit/d03ab98029f79125cd0d05349bf7e1bbd86b9ba6
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2022-12-21T07:29:11-03:00
Commit Message:
FREESCAPE: fixed incorrect parameter when rendering pyramids in EGA/CGA mode
Changed paths:
engines/freescape/gfx.cpp
diff --git a/engines/freescape/gfx.cpp b/engines/freescape/gfx.cpp
index bcf978d41e9..a64b0e885b1 100644
--- a/engines/freescape/gfx.cpp
+++ b/engines/freescape/gfx.cpp
@@ -273,7 +273,7 @@ void Renderer::renderPyramid(const Math::Vector3d &origin, const Math::Vector3d
Common::Array<Math::Vector3d> face;
uint8 r1, g1, b1, r2, g2, b2;
- if (getRGBAt((*colours)[0], r1, g1, b1, r1, g2, b2)) {
+ if (getRGBAt((*colours)[0], r1, g1, b1, r2, g2, b2)) {
useColor(r1, g1, b1);
face.push_back(vertices[4]);
Commit: 0e9e395247f803593ec55cf9252017a951e0eec0
https://github.com/scummvm/scummvm/commit/0e9e395247f803593ec55cf9252017a951e0eec0
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2022-12-21T07:29:11-03:00
Commit Message:
FREESCAPE: fixed incorrect color in one of the CGA palettes from Driller (DOS)
Changed paths:
engines/freescape/games/driller.cpp
diff --git a/engines/freescape/games/driller.cpp b/engines/freescape/games/driller.cpp
index fe2f628ce0b..860f68a6e0c 100644
--- a/engines/freescape/games/driller.cpp
+++ b/engines/freescape/games/driller.cpp
@@ -32,7 +32,7 @@ namespace Freescape {
byte dos_CGA_palette[4][3] = {
{0x00, 0x00, 0x00},
{0x00, 0xaa, 0xaa},
- {0xaa, 0x00, 0x00},
+ {0xaa, 0x00, 0xaa},
{0xaa, 0xaa, 0xaa},
};
Commit: 2ce1359e5d0d07abe25429fb356b9209525a02a3
https://github.com/scummvm/scummvm/commit/2ce1359e5d0d07abe25429fb356b9209525a02a3
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2022-12-21T07:29:12-03:00
Commit Message:
FREESCAPE: small fix for driller (DOS) UI when using CGA mode
Changed paths:
engines/freescape/games/driller.cpp
diff --git a/engines/freescape/games/driller.cpp b/engines/freescape/games/driller.cpp
index 860f68a6e0c..fa2cbb6393f 100644
--- a/engines/freescape/games/driller.cpp
+++ b/engines/freescape/games/driller.cpp
@@ -520,7 +520,7 @@ void DrillerEngine::drawDOSUI(Graphics::Surface *surface) {
drawStringInSurface(Common::String::format("%s", "J"), 57, 161, front, back, surface);
drawStringInSurface(Common::String::format("%02d", int(_angleRotations[_angleRotationIndex])), 46, 145, front, back, surface);
- drawStringInSurface(Common::String::format("%3d", _playerSteps[_playerStepIndex]), 46, 153, front, back, surface);
+ drawStringInSurface(Common::String::format("%3d", _playerSteps[_playerStepIndex]), _renderMode == Common::kRenderCGA ? 44 : 46, 153, front, back, surface);
drawStringInSurface(Common::String::format("%07d", score), 238, 129, front, back, surface);
int hours = _countdown <= 0 ? 0 : _countdown / 3600;
More information about the Scummvm-git-logs
mailing list