[Scummvm-git-logs] scummvm master -> 7e991362e86560be3fab8a0b5b21a02256d6f1f6
neuromancer
noreply at scummvm.org
Sun Jun 2 19:10:42 UTC 2024
This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
1d358645b5 FREESCAPE: better shoot rays in software renderer
a16d971797 FREESCAPE: correctly load different fonts in dark side for atari
7e991362e8 FREESCAPE: refactor loadFonts and fixes for dark side
Commit: 1d358645b5d5e650974c76564a9530cb92be93c3
https://github.com/scummvm/scummvm/commit/1d358645b5d5e650974c76564a9530cb92be93c3
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-06-02T21:11:30+02:00
Commit Message:
FREESCAPE: better shoot rays in software renderer
Changed paths:
engines/freescape/gfx_tinygl.cpp
diff --git a/engines/freescape/gfx_tinygl.cpp b/engines/freescape/gfx_tinygl.cpp
index a38c6e95bf4..3ad1a6b44c3 100644
--- a/engines/freescape/gfx_tinygl.cpp
+++ b/engines/freescape/gfx_tinygl.cpp
@@ -146,6 +146,14 @@ void TinyGLRenderer::renderPlayerShootRay(byte color, const Common::Point positi
tglMatrixMode(TGL_MODELVIEW);
tglLoadIdentity();
+ if (_renderMode == Common::kRenderCGA || _renderMode == Common::kRenderZX) {
+ r = g = b = 255;
+ } else {
+ r = g = b = 255;
+ tglEnable(TGL_BLEND);
+ tglBlendFunc(TGL_ONE_MINUS_DST_COLOR, TGL_ZERO);
+ }
+
tglDisable(TGL_DEPTH_TEST);
tglDepthMask(TGL_FALSE);
@@ -169,6 +177,7 @@ void TinyGLRenderer::renderPlayerShootRay(byte color, const Common::Point positi
tglDrawArrays(TGL_LINES, 0, 8);
tglDisableClientState(TGL_VERTEX_ARRAY);
+ tglDisable(TGL_BLEND);
tglEnable(TGL_DEPTH_TEST);
tglDepthMask(TGL_TRUE);
}
Commit: a16d971797b986e9ec764d8fff6f19c3b679b674
https://github.com/scummvm/scummvm/commit/a16d971797b986e9ec764d8fff6f19c3b679b674
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-06-02T21:11:30+02:00
Commit Message:
FREESCAPE: correctly load different fonts in dark side for atari
Changed paths:
engines/freescape/games/dark/amiga.cpp
engines/freescape/games/dark/atari.cpp
engines/freescape/games/dark/dark.h
diff --git a/engines/freescape/games/dark/amiga.cpp b/engines/freescape/games/dark/amiga.cpp
index e29c252a8fa..7b01674cd06 100644
--- a/engines/freescape/games/dark/amiga.cpp
+++ b/engines/freescape/games/dark/amiga.cpp
@@ -133,24 +133,24 @@ void DarkEngine::drawAmigaAtariSTUI(Graphics::Surface *surface) {
int score = _gameStateVars[k8bitVariableScore];
int ecds = _gameStateVars[kVariableActiveECDs];
- //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);
+ drawStringSmallInSurface(Common::String::format("%04d", int(2 * _position.x())), 18, 178, red, red, black, surface);
+ drawStringSmallInSurface(Common::String::format("%04d", int(2 * _position.z())), 18, 184, red, red, black, surface);
+ drawStringSmallInSurface(Common::String::format("%04d", int(2 * _position.y())), 18, 190, red, red, black, surface);
- drawStringInSurface(Common::String::format("%02d", int(_angleRotations[_angleRotationIndex])), 73, 178, red, black, surface);
- drawStringInSurface(Common::String::format("%3d", _playerSteps[_playerStepIndex]), 73, 186, red, black, surface);
- drawStringInSurface(Common::String::format("%07d", score), 93, 16, yellow, orange, black, surface);
- drawStringInSurface(Common::String::format("%3d%%", ecds), 181, 16, yellow, orange, black, surface);
+ drawStringBigInSurface(Common::String::format("%02d", int(_angleRotations[_angleRotationIndex])), 73, 178, red, red, black, surface);
+ drawStringBigInSurface(Common::String::format("%3d", _playerSteps[_playerStepIndex]), 73, 186, red, red, black, surface);
+ drawStringBigInSurface(Common::String::format("%07d", score), 93, 16, yellow, orange, black, surface);
+ drawStringBigInSurface(Common::String::format("%3d%%", ecds), 181, 16, yellow, orange, black, surface);
Common::String message;
int deadline;
getLatestMessages(message, deadline);
if (deadline <= _countdown) {
- drawStringInSurface(message, 32, 150, white, black, surface);
+ drawStringSmallInSurface(message, 32, 150, white, white, black, surface);
_temporaryMessages.push_back(message);
_temporaryMessageDeadlines.push_back(deadline);
} else
- drawStringInSurface(_currentArea->_name, 32, 150, white, black, surface);
+ drawStringSmallInSurface(_currentArea->_name, 32, 150, white, white, black, surface);
drawBinaryClock(surface, 6, 110, white, grey);
}
@@ -159,4 +159,111 @@ void DarkEngine::initAmigaAtari() {
_viewArea = Common::Rect(32, 33, 287, 130);
}
+void DarkEngine::loadFontsCustom(Common::SeekableReadStream *file, int offset, Common::BitArray &font) {
+ file->seek(offset);
+ int charNumber = 85;
+ byte *fontBuffer = nullptr;
+ if (isDOS() || isSpectrum() || isCPC() || isC64()) {
+ fontBuffer = (byte *)malloc(6 * charNumber);
+ file->read(fontBuffer, 6 * charNumber);
+
+ font.set_size(48 * charNumber);
+ font.set_bits(fontBuffer);
+ } else if (isAmiga() || isAtariST()) {
+ int fontSize = 4654; // Driller
+ fontBuffer = (byte *)malloc(fontSize);
+ file->read(fontBuffer, fontSize);
+
+ font.set_size(fontSize * 8);
+ font.set_bits(fontBuffer);
+ } else {
+ _fontLoaded = false;
+ }
+ _fontLoaded = true;
+ free(fontBuffer);
+}
+
+void DarkEngine::drawStringMediumInSurface(const Common::String &str, int x, int y, uint32 primaryColor, uint32 secondaryColor, uint32 backColor, Graphics::Surface *surface, int offset) {
+ if (!_fontLoaded)
+ return;
+
+ _font = _fontMedium;
+
+ Common::String ustr = str;
+ ustr.toUppercase();
+
+ int multiplier1 = 10;
+
+ for (uint32 c = 0; c < ustr.size(); c++) {
+ assert(ustr[c] >= 32);
+ int position = 8 * (multiplier1*(offset + ustr[c] - 32) + 1);
+ for (int j = 0; j < 8; j++) {
+ for (int i = 0; i < 8; i++) {
+ /*if (_font.get(position + j * multiplier2 + i + 8)) {
+ surface->setPixel(x + 8 - i + 8 * c, y + j, secondaryColor);
+ } else*/ if (_font.get(position + j * 8 + i + 8)) {
+ surface->setPixel(x + 8 - i + 8 * c, y + j, primaryColor);
+ } else {
+ surface->setPixel(x + 8 - i + 8 * c, y + j, backColor);
+ }
+ }
+ }
+ }
+}
+
+void DarkEngine::drawStringSmallInSurface(const Common::String &str, int x, int y, uint32 primaryColor, uint32 secondaryColor, uint32 backColor, Graphics::Surface *surface, int offset) {
+ if (!_fontLoaded)
+ return;
+
+ Common::String ustr = str;
+ ustr.toUppercase();
+
+ int multiplier1 = 10;
+ int multiplier2 = 16;
+
+ for (uint32 c = 0; c < ustr.size(); c++) {
+ assert(ustr[c] >= 32);
+ int position = 8 * (multiplier1*(offset + ustr[c] - 32));
+
+ for (int j = 0; j < 5; j++) {
+ for (int i = 0; i < 8; i++) {
+ if (_fontSmall.get(position + j * multiplier2 + i)) {
+ surface->setPixel(x + 8 - i + 4 * c, y + j, primaryColor);
+ } /*else if (_font.get(position + j * multiplier2 + i)) {
+ surface->setPixel(x + 8 - i + 8 * c, y + j, primaryColor);
+ }*/ else {
+ surface->setPixel(x + 8 - i + 4 * c, y + j, backColor);
+ }
+ }
+ }
+ }
+}
+
+void DarkEngine::drawStringBigInSurface(const Common::String &str, int x, int y, uint32 primaryColor, uint32 secondaryColor, uint32 backColor, Graphics::Surface *surface, int offset) {
+ if (!_fontLoaded)
+ return;
+ Common::String ustr = str;
+ ustr.toUppercase();
+
+ int multiplier1 = 16;
+ int multiplier2 = 16;
+
+ for (uint32 c = 0; c < ustr.size(); c++) {
+ assert(ustr[c] >= 32);
+ int position = 8 * (multiplier1*(offset + ustr[c] - 32) + 1);
+ for (int j = 0; j < 8; j++) {
+ for (int i = 0; i < 8; i++) {
+ if (_fontBig.get(position + j * multiplier2 + i + 8)) {
+ surface->setPixel(x + 8 - i + 8 * c, y + j, secondaryColor);
+ } /*else if (_font.get(position + j * multiplier2 + i)) {
+ surface->setPixel(x + 8 - i + 8 * c, y + j, primaryColor);
+ }*/ else {
+ surface->setPixel(x + 8 - i + 8 * c, y + j, backColor);
+ }
+ }
+ }
+ }
+}
+
+
} // End of namespace Freescape
diff --git a/engines/freescape/games/dark/atari.cpp b/engines/freescape/games/dark/atari.cpp
index d9bfd8d1e0d..f0bed60147e 100644
--- a/engines/freescape/games/dark/atari.cpp
+++ b/engines/freescape/games/dark/atari.cpp
@@ -32,7 +32,13 @@ void DarkEngine::loadAssetsAtariFullGame() {
parseAmigaAtariHeader(stream);
_border = loadAndConvertNeoImage(stream, 0xd710);
- loadFonts(stream, 0xd06a); //0x7f0);
+ loadFontsCustom(stream, 0xd06a, _fontBig); //0x7f0);
+ //loadFonts(stream, 0xd06a + 0x500 + 10 - 100 - 40 - 30 - 80); //%
+ loadFontsCustom(stream, 0xd499, _fontMedium);
+ loadFontsCustom(stream, 0xd49b, _fontSmall);
+
+ //loadFonts(stream, 0xd06a + 0x500 + 10 - 100 - 40 - 30 - 5 - 12 - 10 - 1 - 1 - 10 - 10/*- 80 - 30 - 20*/); //%
+
load8bitBinary(stream, 0x20918, 16);
loadMessagesVariableSize(stream, 0x3f6f, 66);
loadPalettes(stream, 0x204d6);
diff --git a/engines/freescape/games/dark/dark.h b/engines/freescape/games/dark/dark.h
index ad8e160da2f..a5050d4134b 100644
--- a/engines/freescape/games/dark/dark.h
+++ b/engines/freescape/games/dark/dark.h
@@ -87,6 +87,14 @@ public:
void drawCPCUI(Graphics::Surface *surface) override;
void drawAmigaAtariSTUI(Graphics::Surface *surface) override;
+ void loadFontsCustom(Common::SeekableReadStream *file, int offset, Common::BitArray &font);
+ Common::BitArray _fontBig;
+ Common::BitArray _fontMedium;
+ Common::BitArray _fontSmall;
+
+ void drawStringMediumInSurface(const Common::String &str, int x, int y, uint32 primaryColor, uint32 secondaryColor, uint32 backColor, Graphics::Surface *surface, int offset = 0);
+ void drawStringSmallInSurface(const Common::String &str, int x, int y, uint32 primaryColor, uint32 secondaryColor, uint32 backColor, Graphics::Surface *surface, int offset = 0);
+ void drawStringBigInSurface(const Common::String &str, int x, int y, uint32 primaryColor, uint32 secondaryColor, uint32 backColor, Graphics::Surface *surface, int offset = 0);
void drawInfoMenu() override;
Commit: 7e991362e86560be3fab8a0b5b21a02256d6f1f6
https://github.com/scummvm/scummvm/commit/7e991362e86560be3fab8a0b5b21a02256d6f1f6
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-06-02T21:11:31+02:00
Commit Message:
FREESCAPE: refactor loadFonts and fixes for dark side
Changed paths:
engines/freescape/freescape.h
engines/freescape/games/dark/amiga.cpp
engines/freescape/games/dark/atari.cpp
engines/freescape/games/dark/cpc.cpp
engines/freescape/games/dark/dark.h
engines/freescape/games/dark/dos.cpp
engines/freescape/games/dark/zx.cpp
engines/freescape/games/driller/amiga.cpp
engines/freescape/games/driller/atari.cpp
engines/freescape/games/driller/cpc.cpp
engines/freescape/games/driller/dos.cpp
engines/freescape/games/driller/zx.cpp
engines/freescape/games/eclipse/cpc.cpp
engines/freescape/games/eclipse/dos.cpp
engines/freescape/games/eclipse/zx.cpp
engines/freescape/loaders/8bitBinaryLoader.cpp
diff --git a/engines/freescape/freescape.h b/engines/freescape/freescape.h
index d034e8407e2..b7ff4919681 100644
--- a/engines/freescape/freescape.h
+++ b/engines/freescape/freescape.h
@@ -434,7 +434,7 @@ public:
void drawFullscreenMessage(Common::String message, uint32 front, Graphics::Surface *surface);
// Font loading and rendering
- void loadFonts(Common::SeekableReadStream *file, int offset);
+ void loadFonts(Common::SeekableReadStream *file, int offset, Common::BitArray &font);
void loadFonts(byte *font, int charNumber);
Common::StringArray _currentAreaMessages;
Common::StringArray _currentEphymeralMessages;
diff --git a/engines/freescape/games/dark/amiga.cpp b/engines/freescape/games/dark/amiga.cpp
index 7b01674cd06..96595a30844 100644
--- a/engines/freescape/games/dark/amiga.cpp
+++ b/engines/freescape/games/dark/amiga.cpp
@@ -123,12 +123,35 @@ void DarkEngine::loadAssetsAmigaFullGame() {
loadMessagesVariableSize(stream, 0x3d37, 66);
}
+Common::String centerAndPadString(const Common::String &str, int size) {
+ Common::String result;
+
+ if (int(str.size()) >= size)
+ return str;
+
+ int padding = (size - str.size()) / 2;
+ for (int i = 0; i < padding; i++)
+ result += " ";
+
+ result += str;
+
+ if (int(result.size()) >= size)
+ return result;
+
+ padding = size - result.size();
+
+ for (int i = 0; i < padding; i++)
+ result += " ";
+ return result;
+}
+
void DarkEngine::drawAmigaAtariSTUI(Graphics::Surface *surface) {
uint32 white = _gfx->_texturePixelFormat.ARGBToColor(0xFF, 0xFF, 0xFF, 0xFF);
uint32 yellow = _gfx->_texturePixelFormat.ARGBToColor(0xFF, 0xEE, 0xCC, 0x00);
uint32 orange = _gfx->_texturePixelFormat.ARGBToColor(0xFF, 0xEE, 0x88, 0x00);
uint32 red = _gfx->_texturePixelFormat.ARGBToColor(0xFF, 0xEE, 0x00, 0x00);
uint32 black = _gfx->_texturePixelFormat.ARGBToColor(0xFF, 0x00, 0x00, 0x00);
+ uint32 transparent = _gfx->_texturePixelFormat.ARGBToColor(0x00, 0x00, 0x00, 0x00);
uint32 grey = _gfx->_texturePixelFormat.ARGBToColor(0xFF, 0x60, 0x60, 0x60);
int score = _gameStateVars[k8bitVariableScore];
@@ -146,12 +169,12 @@ void DarkEngine::drawAmigaAtariSTUI(Graphics::Surface *surface) {
int deadline;
getLatestMessages(message, deadline);
if (deadline <= _countdown) {
- drawStringSmallInSurface(message, 32, 150, white, white, black, surface);
+ drawStringSmallInSurface(message, 32, 156, white, white, transparent, surface);
_temporaryMessages.push_back(message);
_temporaryMessageDeadlines.push_back(deadline);
- } else
- drawStringSmallInSurface(_currentArea->_name, 32, 150, white, white, black, surface);
+ }
+ drawStringSmallInSurface(centerAndPadString(_currentArea->_name, 26), 32, 150, white, white, transparent, surface);
drawBinaryClock(surface, 6, 110, white, grey);
}
@@ -159,30 +182,6 @@ void DarkEngine::initAmigaAtari() {
_viewArea = Common::Rect(32, 33, 287, 130);
}
-void DarkEngine::loadFontsCustom(Common::SeekableReadStream *file, int offset, Common::BitArray &font) {
- file->seek(offset);
- int charNumber = 85;
- byte *fontBuffer = nullptr;
- if (isDOS() || isSpectrum() || isCPC() || isC64()) {
- fontBuffer = (byte *)malloc(6 * charNumber);
- file->read(fontBuffer, 6 * charNumber);
-
- font.set_size(48 * charNumber);
- font.set_bits(fontBuffer);
- } else if (isAmiga() || isAtariST()) {
- int fontSize = 4654; // Driller
- fontBuffer = (byte *)malloc(fontSize);
- file->read(fontBuffer, fontSize);
-
- font.set_size(fontSize * 8);
- font.set_bits(fontBuffer);
- } else {
- _fontLoaded = false;
- }
- _fontLoaded = true;
- free(fontBuffer);
-}
-
void DarkEngine::drawStringMediumInSurface(const Common::String &str, int x, int y, uint32 primaryColor, uint32 secondaryColor, uint32 backColor, Graphics::Surface *surface, int offset) {
if (!_fontLoaded)
return;
diff --git a/engines/freescape/games/dark/atari.cpp b/engines/freescape/games/dark/atari.cpp
index f0bed60147e..4a7a049dcff 100644
--- a/engines/freescape/games/dark/atari.cpp
+++ b/engines/freescape/games/dark/atari.cpp
@@ -32,12 +32,9 @@ void DarkEngine::loadAssetsAtariFullGame() {
parseAmigaAtariHeader(stream);
_border = loadAndConvertNeoImage(stream, 0xd710);
- loadFontsCustom(stream, 0xd06a, _fontBig); //0x7f0);
- //loadFonts(stream, 0xd06a + 0x500 + 10 - 100 - 40 - 30 - 80); //%
- loadFontsCustom(stream, 0xd499, _fontMedium);
- loadFontsCustom(stream, 0xd49b, _fontSmall);
-
- //loadFonts(stream, 0xd06a + 0x500 + 10 - 100 - 40 - 30 - 5 - 12 - 10 - 1 - 1 - 10 - 10/*- 80 - 30 - 20*/); //%
+ loadFonts(stream, 0xd06a, _fontBig); //0x7f0);
+ loadFonts(stream, 0xd499, _fontMedium);
+ loadFonts(stream, 0xd49b, _fontSmall);
load8bitBinary(stream, 0x20918, 16);
loadMessagesVariableSize(stream, 0x3f6f, 66);
diff --git a/engines/freescape/games/dark/cpc.cpp b/engines/freescape/games/dark/cpc.cpp
index d910283ec3f..c5dc8880fc2 100644
--- a/engines/freescape/games/dark/cpc.cpp
+++ b/engines/freescape/games/dark/cpc.cpp
@@ -62,7 +62,7 @@ void DarkEngine::loadAssetsCPCFullGame() {
error("Failed to open DARKCODE.BIN");
loadMessagesFixedSize(&file, 0x5d9, 16, 27);
- loadFonts(&file, 0x60f3);
+ loadFonts(&file, 0x60f3, _font);
loadGlobalObjects(&file, 0x9a, 23);
load8bitBinary(&file, 0x6255, 16);
_indicators.push_back(loadBundledImage("dark_fallen_indicator"));
diff --git a/engines/freescape/games/dark/dark.h b/engines/freescape/games/dark/dark.h
index a5050d4134b..081c45b7490 100644
--- a/engines/freescape/games/dark/dark.h
+++ b/engines/freescape/games/dark/dark.h
@@ -87,7 +87,6 @@ public:
void drawCPCUI(Graphics::Surface *surface) override;
void drawAmigaAtariSTUI(Graphics::Surface *surface) override;
- void loadFontsCustom(Common::SeekableReadStream *file, int offset, Common::BitArray &font);
Common::BitArray _fontBig;
Common::BitArray _fontMedium;
Common::BitArray _fontSmall;
diff --git a/engines/freescape/games/dark/dos.cpp b/engines/freescape/games/dark/dos.cpp
index 046aa2649df..6aa28fff15b 100644
--- a/engines/freescape/games/dark/dos.cpp
+++ b/engines/freescape/games/dark/dos.cpp
@@ -108,7 +108,7 @@ void DarkEngine::loadAssetsDOSDemo() {
loadSpeakerFxDOS(&file, 0x4837 + 0x200, 0x46e8 + 0x200);
loadMessagesFixedSize(&file, 0x4525, 16, 27);
loadMessagesFixedSize(&file, 0x993f - 2, 308, 5);
- loadFonts(&file, 0xa598);
+ loadFonts(&file, 0xa598, _font);
loadGlobalObjects(&file, 0x3d04, 23);
load8bitBinary(&file, 0xa700, 16);
_border = load8bitBinImage(&file, 0x210);
@@ -135,7 +135,7 @@ void DarkEngine::loadAssetsDOSDemo() {
error("Failed to open DSIDEC.EXE");
loadSpeakerFxDOS(&file, 0x3077 + 0x200, 0x2f28 + 0x200);
- loadFonts(&file, 0x8907);
+ loadFonts(&file, 0x8907, _font);
loadMessagesFixedSize(&file, 0x2d65, 16, 27);
loadMessagesFixedSize(&file, 0x7c3a, 308, 5);
loadGlobalObjects(&file, 0x2554, 23);
@@ -163,7 +163,7 @@ void DarkEngine::loadAssetsDOSFullGame() {
error("Failed to open DSIDEE.EXE");
loadSpeakerFxDOS(&file, 0x4837 + 0x200, 0x46e8 + 0x200);
- loadFonts(&file, 0xa113);
+ loadFonts(&file, 0xa113, _font);
loadMessagesFixedSize(&file, 0x4525, 16, 27);
loadGlobalObjects(&file, 0x3d04, 23);
load8bitBinary(&file, 0xa280, 16);
@@ -191,7 +191,7 @@ void DarkEngine::loadAssetsDOSFullGame() {
error("Failed to open DSIDEC.EXE");
loadSpeakerFxDOS(&file, 0x3077 + 0x200, 0x2f28 + 0x200);
- loadFonts(&file, 0x8496);
+ loadFonts(&file, 0x8496, _font);
loadMessagesFixedSize(&file, 0x2d65, 16, 27);
loadGlobalObjects(&file, 0x2554, 23);
load8bitBinary(&file, 0x8600, 16);
diff --git a/engines/freescape/games/dark/zx.cpp b/engines/freescape/games/dark/zx.cpp
index 85b013276a8..d92048f42f2 100644
--- a/engines/freescape/games/dark/zx.cpp
+++ b/engines/freescape/games/dark/zx.cpp
@@ -56,7 +56,7 @@ void DarkEngine::loadAssetsZXFullGame() {
loadMessagesFixedSize(&file, 0x56b - 6, 16, 27);
- loadFonts(&file, 0x5d60 - 6);
+ loadFonts(&file, 0x5d60 - 6, _font);
loadGlobalObjects(&file, 0x1a, 23);
load8bitBinary(&file, 0x5ec0 - 4, 4);
for (auto &it : _areaMap) {
@@ -100,7 +100,7 @@ void DarkEngine::loadAssetsZXDemo() {
loadMessagesFixedSize(&file, 0x5761, 264, 5);
loadSpeakerFxZX(&file, 0x9c7, 0xa5b);
- loadFonts(&file, 0x6164);
+ loadFonts(&file, 0x6164, _font);
loadGlobalObjects(&file, 0x20, 23);
load8bitBinary(&file, 0x62c6, 4);
for (auto &it : _areaMap) {
diff --git a/engines/freescape/games/driller/amiga.cpp b/engines/freescape/games/driller/amiga.cpp
index 881c7d1fa76..634be9cf66d 100644
--- a/engines/freescape/games/driller/amiga.cpp
+++ b/engines/freescape/games/driller/amiga.cpp
@@ -43,7 +43,7 @@ void DrillerEngine::loadAssetsAmigaFullGame() {
}
_title = loadAndConvertNeoImage(&file, 0x10, palette);
- loadFonts(&file, 0x8940);
+ loadFonts(&file, 0x8940, _font);
loadMessagesFixedSize(&file, 0xc66e, 14, 20);
loadGlobalObjects(&file, 0xbd62, 8);
load8bitBinary(&file, 0x29c16, 16);
@@ -68,7 +68,7 @@ void DrillerEngine::loadAssetsAmigaFullGame() {
if (!file.isOpen())
error("Failed to open 'driller' executable for Amiga");
- loadFonts(&file, 0xa62);
+ loadFonts(&file, 0xa62, _font);
loadMessagesFixedSize(&file, 0x499a, 14, 20);
loadGlobalObjects(&file, 0x4098, 8);
load8bitBinary(&file, 0x21a3e, 16);
@@ -120,12 +120,12 @@ void DrillerEngine::loadAssetsAmigaDemo() {
error("Failed to open 'driller' file");
if (_variant & GF_AMIGA_MAGAZINE_DEMO) {
- loadFonts(&file, 0xa62);
+ loadFonts(&file, 0xa62, _font);
loadMessagesFixedSize(&file, 0x3df0, 14, 20);
loadGlobalObjects(&file, 0x3ba6, 8);
_demoMode = false;
} else {
- loadFonts(&file, 0xa30);
+ loadFonts(&file, 0xa30, _font);
loadMessagesFixedSize(&file, 0x3960, 14, 20);
loadGlobalObjects(&file, 0x3716, 8);
}
diff --git a/engines/freescape/games/driller/atari.cpp b/engines/freescape/games/driller/atari.cpp
index c4bad291d8d..f5a3bdd76a8 100644
--- a/engines/freescape/games/driller/atari.cpp
+++ b/engines/freescape/games/driller/atari.cpp
@@ -68,7 +68,7 @@ void DrillerEngine::loadAssetsAtariFullGame() {
_border = loadAndConvertNeoImage(stream, 0x14b96);
_title = loadAndConvertNeoImage(stream, 0x1c916);
- loadFonts(stream, 0x8a92);
+ loadFonts(stream, 0x8a92, _font);
loadMessagesFixedSize(stream, 0xda22, 14, 20);
loadGlobalObjects(stream, 0xd116, 8);
load8bitBinary(stream, 0x2afb8, 16);
@@ -91,7 +91,7 @@ void DrillerEngine::loadAssetsAtariFullGame() {
}
_title = loadAndConvertNeoImage(&file, 0x10, palette);
- loadFonts(&file, 0x8a32 - 0x1d6);
+ loadFonts(&file, 0x8a32 - 0x1d6, _font);
loadMessagesFixedSize(&file, 0xc5d8 - 0x1da, 14, 20);
loadGlobalObjects(&file, 0xbccc - 0x1da, 8);
load8bitBinary(&file, 0x29b3c - 0x1d6, 16);
@@ -107,7 +107,7 @@ void DrillerEngine::loadAssetsAtariFullGame() {
}
_title = loadAndConvertNeoImage(&file, 0x10, palette);
- loadFonts(&file, 0x8a32);
+ loadFonts(&file, 0x8a32, _font);
loadMessagesFixedSize(&file, 0xc5d8, 14, 20);
loadGlobalObjects(&file, 0xbccc, 8);
load8bitBinary(&file, 0x29b3c, 16);
@@ -161,11 +161,11 @@ void DrillerEngine::loadAssetsAtariDemo() {
}
if (_variant & GF_ATARI_MAGAZINE_DEMO) {
- loadFonts(&file, 0x7ee);
+ loadFonts(&file, 0x7ee, _font);
loadMessagesFixedSize(&file, 0x40d2, 14, 20);
loadGlobalObjects(&file, 0x3e88, 8);
} else {
- loadFonts(&file, 0x7bc);
+ loadFonts(&file, 0x7bc, _font);
loadMessagesFixedSize(&file, 0x3b90, 14, 20);
loadGlobalObjects(&file, 0x3946, 8);
}
diff --git a/engines/freescape/games/driller/cpc.cpp b/engines/freescape/games/driller/cpc.cpp
index 47d79e63ed6..48e9257d4ae 100644
--- a/engines/freescape/games/driller/cpc.cpp
+++ b/engines/freescape/games/driller/cpc.cpp
@@ -150,7 +150,7 @@ void DrillerEngine::loadAssetsCPCFullGame() {
error("Failed to open DRILL.BIN");
loadMessagesFixedSize(&file, 0x214c, 14, 20);
- loadFonts(&file, 0x5b69);
+ loadFonts(&file, 0x5b69, _font);
loadGlobalObjects(&file, 0x1d07, 8);
load8bitBinary(&file, 0x5ccb, 16);
}
diff --git a/engines/freescape/games/driller/dos.cpp b/engines/freescape/games/driller/dos.cpp
index 73b25a9b735..3b898af5c2d 100644
--- a/engines/freescape/games/driller/dos.cpp
+++ b/engines/freescape/games/driller/dos.cpp
@@ -318,7 +318,7 @@ void DrillerEngine::loadAssetsDOSFullGame() {
loadSpeakerFxDOS(&file, 0x4397 + 0x200, 0x4324 + 0x200);
loadMessagesFixedSize(&file, 0x4135, 14, 20);
- loadFonts(&file, 0x99dd);
+ loadFonts(&file, 0x99dd, _font);
loadGlobalObjects(&file, 0x3b42, 8);
load8bitBinary(&file, 0x9b40, 16);
_border = load8bitBinImage(&file, 0x210);
@@ -343,7 +343,7 @@ void DrillerEngine::loadAssetsDOSFullGame() {
loadSpeakerFxDOS(&file, 0x27e7 + 0x200, 0x2774 + 0x200);
- loadFonts(&file, 0x07a4a);
+ loadFonts(&file, 0x07a4a, _font);
loadMessagesFixedSize(&file, 0x2585, 14, 20);
load8bitBinary(&file, 0x7bb0, 4);
loadGlobalObjects(&file, 0x1fa2, 8);
@@ -377,7 +377,7 @@ void DrillerEngine::loadAssetsDOSDemo() {
if (!file.isOpen())
error("Failed to open 'd2' file");
- loadFonts(&file, 0x4eb0);
+ loadFonts(&file, 0x4eb0, _font);
loadMessagesFixedSize(&file, 0x636, 14, 20);
load8bitBinary(&file, 0x55b0, 4);
loadGlobalObjects(&file, 0x8c, 5);
diff --git a/engines/freescape/games/driller/zx.cpp b/engines/freescape/games/driller/zx.cpp
index 82cf37b975d..3beca9441a8 100644
--- a/engines/freescape/games/driller/zx.cpp
+++ b/engines/freescape/games/driller/zx.cpp
@@ -58,11 +58,11 @@ void DrillerEngine::loadAssetsZXFullGame() {
loadMessagesFixedSize(&file, 0x20e4, 14, 20);
if (_variant & GF_ZX_RETAIL)
- loadFonts(&file, 0x62ca);
+ loadFonts(&file, 0x62ca, _font);
else if (_variant & GF_ZX_BUDGET)
- loadFonts(&file, 0x5aa8);
+ loadFonts(&file, 0x5aa8, _font);
else if (_variant & GF_ZX_DISC)
- loadFonts(&file, 0x63f0);
+ loadFonts(&file, 0x63f0, _font);
if (_variant & GF_ZX_DISC)
loadGlobalObjects(&file, 0x1d13, 8);
diff --git a/engines/freescape/games/eclipse/cpc.cpp b/engines/freescape/games/eclipse/cpc.cpp
index 34f2151b451..0c14996f6ef 100644
--- a/engines/freescape/games/eclipse/cpc.cpp
+++ b/engines/freescape/games/eclipse/cpc.cpp
@@ -73,11 +73,11 @@ void EclipseEngine::loadAssetsCPCFullGame() {
error("Failed to open TECODE.BIN/TE2.BI2");
if (isEclipse2()) {
- loadFonts(&file, 0x60bc);
+ loadFonts(&file, 0x60bc, _font);
loadMessagesFixedSize(&file, 0x326, 16, 30);
load8bitBinary(&file, 0x62b4, 16);
} else {
- loadFonts(&file, 0x6076);
+ loadFonts(&file, 0x6076, _font);
loadMessagesFixedSize(&file, 0x326, 16, 30);
load8bitBinary(&file, 0x626e, 16);
}
@@ -119,7 +119,7 @@ void EclipseEngine::loadAssetsCPCDemo() {
if (!file.isOpen())
error("Failed to open TEPROG.BIN");
- loadFonts(&file, 0x63ce);
+ loadFonts(&file, 0x63ce, _font);
loadMessagesFixedSize(&file, 0x362, 16, 23);
loadMessagesFixedSize(&file, 0x570b, 264, 5);
load8bitBinary(&file, 0x65c6, 16);
diff --git a/engines/freescape/games/eclipse/dos.cpp b/engines/freescape/games/eclipse/dos.cpp
index 2efa176b82c..06dfb8196a8 100644
--- a/engines/freescape/games/eclipse/dos.cpp
+++ b/engines/freescape/games/eclipse/dos.cpp
@@ -93,7 +93,7 @@ void EclipseEngine::loadAssetsDOSFullGame() {
loadMessagesFixedSize(&file, 0x710f, 16, 17);
loadSoundsFx(&file, 0xd670, 1);
loadSpeakerFxDOS(&file, 0x7396 + 0x200, 0x72a1 + 0x200);
- loadFonts(&file, 0xd403);
+ loadFonts(&file, 0xd403, _font);
load8bitBinary(&file, 0x3ce0, 16);
for (auto &it : _areaMap) {
it._value->addStructure(_areaMap[255]);
@@ -122,7 +122,7 @@ void EclipseEngine::loadAssetsDOSFullGame() {
loadMessagesFixedSize(&file, 0x594f, 16, 17);
load1bPCM(&file, 0xd038 - 4);
- loadFonts(&file, 0xb785);
+ loadFonts(&file, 0xb785, _font);
load8bitBinary(&file, 0x2530, 4);
for (auto &it : _areaMap) {
it._value->addStructure(_areaMap[255]);
diff --git a/engines/freescape/games/eclipse/zx.cpp b/engines/freescape/games/eclipse/zx.cpp
index 5849cb3be4b..630436bec49 100644
--- a/engines/freescape/games/eclipse/zx.cpp
+++ b/engines/freescape/games/eclipse/zx.cpp
@@ -57,12 +57,12 @@ void EclipseEngine::loadAssetsZXFullGame() {
if (isTotalEclipse2) {
loadMessagesFixedSize(&file, 0x2ac, 16, 30);
- loadFonts(&file, 0x61c3);
+ loadFonts(&file, 0x61c3, _font);
loadSpeakerFxZX(&file, 0x8c6, 0x91a);
load8bitBinary(&file, 0x63bb, 4);
} else {
loadMessagesFixedSize(&file, 0x2ac, 16, 23);
- loadFonts(&file, 0x6163);
+ loadFonts(&file, 0x6163, _font);
loadSpeakerFxZX(&file, 0x816, 0x86a);
load8bitBinary(&file, 0x635b, 4);
}
@@ -110,13 +110,13 @@ void EclipseEngine::loadAssetsZXDemo() {
if (_variant & GF_ZX_DEMO_MICROHOBBY) {
loadMessagesFixedSize(&file, 0x2ac, 16, 23);
loadMessagesFixedSize(&file, 0x56e6, 264, 1);
- loadFonts(&file, 0x5f7b);
+ loadFonts(&file, 0x5f7b, _font);
load8bitBinary(&file, 0x6173, 4);
} else if (_variant & GF_ZX_DEMO_CRASH) {
loadSpeakerFxZX(&file, 0x65c, 0x6b0);
loadMessagesFixedSize(&file, 0x364, 16, 9);
loadMessagesFixedSize(&file, 0x5901, 264, 5);
- loadFonts(&file, 0x6589);
+ loadFonts(&file, 0x6589, _font);
load8bitBinary(&file, 0x6781, 4);
} else
error("Unknown ZX Spectrum demo variant");
diff --git a/engines/freescape/loaders/8bitBinaryLoader.cpp b/engines/freescape/loaders/8bitBinaryLoader.cpp
index e4b7e79f35c..539085f136e 100644
--- a/engines/freescape/loaders/8bitBinaryLoader.cpp
+++ b/engines/freescape/loaders/8bitBinaryLoader.cpp
@@ -865,29 +865,28 @@ void FreescapeEngine::loadFonts(byte *font, int charNumber) {
_fontLoaded = true;
}
-
-void FreescapeEngine::loadFonts(Common::SeekableReadStream *file, int offset) {
+void FreescapeEngine::loadFonts(Common::SeekableReadStream *file, int offset, Common::BitArray &font) {
file->seek(offset);
int charNumber = 85;
- byte *font = nullptr;
+ byte *fontBuffer = nullptr;
if (isDOS() || isSpectrum() || isCPC() || isC64()) {
- font = (byte *)malloc(6 * charNumber);
- file->read(font, 6 * charNumber);
+ fontBuffer = (byte *)malloc(6 * charNumber);
+ file->read(fontBuffer, 6 * charNumber);
- _font.set_size(48 * charNumber);
- _font.set_bits((byte *)font);
+ font.set_size(48 * charNumber);
+ font.set_bits(fontBuffer);
} else if (isAmiga() || isAtariST()) {
int fontSize = 4654; // Driller
- font = (byte *)malloc(fontSize);
- file->read(font, fontSize);
+ fontBuffer = (byte *)malloc(fontSize);
+ file->read(fontBuffer, fontSize);
- _font.set_size(fontSize * 8);
- _font.set_bits((byte *)font);
+ font.set_size(fontSize * 8);
+ font.set_bits(fontBuffer);
} else {
_fontLoaded = false;
}
_fontLoaded = true;
- free(font);
+ free(fontBuffer);
}
void FreescapeEngine::loadMessagesFixedSize(Common::SeekableReadStream *file, int offset, int size, int number) {
More information about the Scummvm-git-logs
mailing list