[Scummvm-git-logs] scummvm master -> 0a6618b438bc1aa46babcdf35eabb4c69ef70d8c
neuromancer
noreply at scummvm.org
Sat Oct 5 18:55:41 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:
9a75ba4c5e FREESCAPE: correctly implement aspect ratio correction
e605ee16d3 NEWS: Added freescape changes
0a6618b438 FREESCAPE: improved getCPCPixelMode0 function and used palette for dark title screen
Commit: 9a75ba4c5eacd11abf3bece289dc9d6a728b0489
https://github.com/scummvm/scummvm/commit/9a75ba4c5eacd11abf3bece289dc9d6a728b0489
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-10-05T20:57:14+02:00
Commit Message:
FREESCAPE: correctly implement aspect ratio correction
Changed paths:
engines/freescape/gfx.cpp
diff --git a/engines/freescape/gfx.cpp b/engines/freescape/gfx.cpp
index 0a69fee5ecd..4f4cfe17d02 100644
--- a/engines/freescape/gfx.cpp
+++ b/engines/freescape/gfx.cpp
@@ -583,8 +583,8 @@ bool Renderer::computeScreenViewport() {
Common::Rect viewport;
if (g_system->getFeatureState(OSystem::kFeatureAspectRatioCorrection)) {
// Aspect ratio correction
- int32 viewportWidth = MIN<int32>(screenWidth, screenHeight * float(_screenW) / _screenH);
- int32 viewportHeight = MIN<int32>(screenHeight, screenWidth * float(_screenH) / _screenW);
+ int32 viewportWidth = MIN<int32>(screenWidth, screenHeight * float(4) / 3);
+ int32 viewportHeight = MIN<int32>(screenHeight, screenWidth * float(3) / 3);
viewport = Common::Rect(viewportWidth, viewportHeight);
// Pillarboxing
Commit: e605ee16d38680db7a177ac8f7b584d29ce2d1a3
https://github.com/scummvm/scummvm/commit/e605ee16d38680db7a177ac8f7b584d29ce2d1a3
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-10-05T20:57:14+02:00
Commit Message:
NEWS: Added freescape changes
Changed paths:
NEWS.md
diff --git a/NEWS.md b/NEWS.md
index df9c4bf5fd3..96b76c269bb 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -37,6 +37,7 @@ For a more comprehensive changelog of the latest experimental code, see:
- Refactored sound handling for different games.
- Refactored font handling to use common classes.
- Improved keymapper support coverage.
+ - Correctly implement aspect ratio correction following dosbox implementation.
MM:
- Added MT32/LAPC-1 support for Xeen engine.
Commit: 0a6618b438bc1aa46babcdf35eabb4c69ef70d8c
https://github.com/scummvm/scummvm/commit/0a6618b438bc1aa46babcdf35eabb4c69ef70d8c
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-10-05T20:57:14+02:00
Commit Message:
FREESCAPE: improved getCPCPixelMode0 function and used palette for dark title screen
Changed paths:
engines/freescape/games/dark/cpc.cpp
engines/freescape/games/driller/cpc.cpp
diff --git a/engines/freescape/games/dark/cpc.cpp b/engines/freescape/games/dark/cpc.cpp
index 184b94111b3..eeb4cc57f29 100644
--- a/engines/freescape/games/dark/cpc.cpp
+++ b/engines/freescape/games/dark/cpc.cpp
@@ -35,6 +35,25 @@ void DarkEngine::initCPC() {
extern byte kCPCPaletteTitleData[4][3];
extern byte kCPCPaletteBorderData[4][3];
+byte kCPCPaletteDarkTitle[16][3] = {
+ {0x00, 0x00, 0x00}, // 0: X
+ {0xff, 0xff, 0xff}, // 1: ?
+ {0x80, 0x80, 0x80}, // 2: X
+ {0xff, 0x00, 0xff}, // 3: X
+ {0x80, 0x80, 0x80}, // 4: X
+ {0xff, 0xff, 0x00}, // 5: X
+ {0x80, 0x00, 0x00}, // 6: X
+ {0xff, 0x00, 0x00}, // 7: X
+ {0x00, 0x80, 0x80}, // 8: X
+ {0xff, 0x00, 0x80}, // 9: X
+ {0xff, 0x80, 0x00}, // 10: X
+ {0xff, 0x80, 0x80}, // 11: X
+ {0x00, 0xff, 0x00}, // 12: X
+ {0x00, 0x00, 0x80}, // 13: X
+ {0x00, 0x00, 0xff}, // 14: X
+ {0x00, 0x80, 0x00}, // 15: X
+};
+
extern Graphics::ManagedSurface *readCPCImage(Common::SeekableReadStream *file, bool mode0);
void DarkEngine::loadAssetsCPCFullGame() {
@@ -45,7 +64,7 @@ void DarkEngine::loadAssetsCPCFullGame() {
error("Failed to open DARK1.SCR");
_title = readCPCImage(&file, false);
- _title->setPalette((byte*)&kCPCPaletteTitleData, 0, 4);
+ _title->setPalette((byte*)&kCPCPaletteDarkTitle, 0, 16);
file.close();
file.open("DARK2.SCR");
diff --git a/engines/freescape/games/driller/cpc.cpp b/engines/freescape/games/driller/cpc.cpp
index 8d4e6a41b7c..aae02badd89 100644
--- a/engines/freescape/games/driller/cpc.cpp
+++ b/engines/freescape/games/driller/cpc.cpp
@@ -46,7 +46,7 @@ byte kCPCPaletteBorderData[4][3] = {
{0x00, 0x80, 0x00},
};
-byte getCPCPixelMode0(byte cpc_byte, int index) {
+byte getCPCPixelMode1(byte cpc_byte, int index) {
if (index == 0)
return ((cpc_byte & 0x08) >> 2) | ((cpc_byte & 0x80) >> 7);
else if (index == 1)
@@ -59,24 +59,34 @@ byte getCPCPixelMode0(byte cpc_byte, int index) {
error("Invalid index %d requested", index);
}
-byte getCPCPixelMode1(byte cpc_byte, int index) {
- if (index == 0)
- return ((cpc_byte & 0x08) >> 0) | ((cpc_byte & 0x80) >> 5) |
- ((cpc_byte & 0x20) >> 4) | ((cpc_byte & 0x02) >> 1);
- else if (index == 2)
- return ((cpc_byte & 0x04) >> 1) | ((cpc_byte & 0x40) >> 6);
- else
- return 0;//error("Invalid index %d requested", index);
+byte getCPCPixelMode0(byte cpc_byte, int index) {
+ if (index == 0) {
+ // Extract Pixel 0 from the byte
+ return ((cpc_byte & 0x02) >> 1) | // Bit 1 -> Bit 3 (MSB)
+ ((cpc_byte & 0x20) >> 4) | // Bit 5 -> Bit 2
+ ((cpc_byte & 0x08) >> 1) | // Bit 3 -> Bit 1
+ ((cpc_byte & 0x80) >> 7); // Bit 7 -> Bit 0 (LSB)
+ }
+ else if (index == 2) {
+ // Extract Pixel 1 from the byte
+ return ((cpc_byte & 0x01) << 3) | // Bit 0 -> Bit 3 (MSB)
+ ((cpc_byte & 0x10) >> 2) | // Bit 4 -> Bit 2
+ ((cpc_byte & 0x04) >> 1) | // Bit 2 -> Bit 1
+ ((cpc_byte & 0x40) >> 6); // Bit 6 -> Bit 0 (LSB)
+ }
+ else {
+ error("Invalid index %d requested", index);
+ }
}
-byte getCPCPixel(byte cpc_byte, int index, bool mode0) {
- if (mode0)
- return getCPCPixelMode0(cpc_byte, index);
- else
+byte getCPCPixel(byte cpc_byte, int index, bool mode1) {
+ if (mode1)
return getCPCPixelMode1(cpc_byte, index);
+ else
+ return getCPCPixelMode0(cpc_byte, index);
}
-Graphics::ManagedSurface *readCPCImage(Common::SeekableReadStream *file, bool mode0) {
+Graphics::ManagedSurface *readCPCImage(Common::SeekableReadStream *file, bool mode1) {
Graphics::ManagedSurface *surface = new Graphics::ManagedSurface();
surface->create(320, 200, Graphics::PixelFormat::createFormatCLUT8());
surface->fillRect(Common::Rect(0, 0, 320, 200), 0);
@@ -89,7 +99,7 @@ Graphics::ManagedSurface *readCPCImage(Common::SeekableReadStream *file, bool mo
byte cpc_byte = file->readByte(); // Get CPC byte
// Process first pixel
- int pixel_0 = getCPCPixel(cpc_byte, 0, mode0); // %Aa
+ int pixel_0 = getCPCPixel(cpc_byte, 0, mode1); // %Aa
y = line * 8 + block ; // Coord Y for the pixel
x = 4 * offset + 0; // Coord X for the pixel
surface->setPixel(x, y, pixel_0);
@@ -97,14 +107,14 @@ Graphics::ManagedSurface *readCPCImage(Common::SeekableReadStream *file, bool mo
// Process second pixel
y = line * 8 + block ; // Coord Y for the pixel
x = 4 * offset + 1; // Coord X for the pixel
- if (mode0) {
- int pixel_1 = getCPCPixel(cpc_byte, 1, mode0); // %Bb
+ if (mode1) {
+ int pixel_1 = getCPCPixel(cpc_byte, 1, mode1); // %Bb
surface->setPixel(x, y, pixel_1);
} else
surface->setPixel(x, y, pixel_0);
// Process third pixel
- int pixel_2 = getCPCPixel(cpc_byte, 2, mode0); // %Cc
+ int pixel_2 = getCPCPixel(cpc_byte, 2, mode1); // %Cc
y = line * 8 + block ; // Coord Y for the pixel
x = 4 * offset + 2; // Coord X for the pixel
surface->setPixel(x, y, pixel_2);
@@ -112,8 +122,8 @@ Graphics::ManagedSurface *readCPCImage(Common::SeekableReadStream *file, bool mo
// Process fourth pixel
y = line * 8 + block ; // Coord Y for the pixel
x = 4 * offset + 3; // Coord X for the pixel
- if (mode0) {
- int pixel_3 = getCPCPixel(cpc_byte, 3, mode0); // %Dd
+ if (mode1) {
+ int pixel_3 = getCPCPixel(cpc_byte, 3, mode1); // %Dd
surface->setPixel(x, y, pixel_3);
} else
surface->setPixel(x, y, pixel_2);
More information about the Scummvm-git-logs
mailing list