diff options
author | Martin Kiewitz | 2016-02-05 16:41:02 +0100 |
---|---|---|
committer | Martin Kiewitz | 2016-02-05 16:41:02 +0100 |
commit | f09a15f27636149b267d0e0b23a9dcfa4bc8c854 (patch) | |
tree | 5ca958360f6ff0876dd522b8073bba1029c3f827 /engines/agi/graphics.cpp | |
parent | f954603f8d0ab7442dded19acaec8e597cbe478e (diff) | |
download | scummvm-rg350-f09a15f27636149b267d0e0b23a9dcfa4bc8c854.tar.gz scummvm-rg350-f09a15f27636149b267d0e0b23a9dcfa4bc8c854.tar.bz2 scummvm-rg350-f09a15f27636149b267d0e0b23a9dcfa4bc8c854.zip |
AGI: Render mode Macintosh added
Palette + mouse cursor + box frame color only atm
Thanks to wjp for gamma correction
Not sure, if our current color adjustment is correct
Should be checked by using actual hardware
Diffstat (limited to 'engines/agi/graphics.cpp')
-rw-r--r-- | engines/agi/graphics.cpp | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/engines/agi/graphics.cpp b/engines/agi/graphics.cpp index 7f367a0685..cfe65993cd 100644 --- a/engines/agi/graphics.cpp +++ b/engines/agi/graphics.cpp @@ -92,6 +92,9 @@ int GfxMgr::initVideo() { case Common::kRenderAtariST: initPalette(_paletteGfxMode, PALETTE_ATARI_ST, 16, 3); break; + case Common::kRenderMacintosh: + initPaletteCLUT(_paletteGfxMode, PALETTE_MACINTOSH_CLUT, 16); + break; default: error("initVideo: unsupported render mode"); break; @@ -118,6 +121,12 @@ int GfxMgr::initVideo() { initMouseCursor(&_mouseCursor, MOUSECURSOR_ATARI_ST, 11, 16, 1, 1); initMouseCursor(&_mouseCursorBusy, MOUSECURSOR_SCI_BUSY, 15, 16, 7, 8); break; + case Common::kRenderMacintosh: + // It looks like Atari ST + Macintosh used the same standard mouse cursor + // TODO: Verify by checking actual hardware + initMouseCursor(&_mouseCursor, MOUSECURSOR_ATARI_ST, 11, 16, 1, 1); + initMouseCursor(&_mouseCursorBusy, MOUSECURSOR_MACINTOSH_BUSY, 10, 14, 7, 8); + break; default: error("initVideo: unsupported render mode"); break; @@ -813,9 +822,21 @@ int16 GfxMgr::priorityFromY(int16 yPos) { void GfxMgr::initPalette(uint8 *destPalette, const uint8 *paletteData, uint colorCount, uint fromBits, uint toBits) { const uint srcMax = (1 << fromBits) - 1; const uint destMax = (1 << toBits) - 1; - for (uint col = 0; col < colorCount; col++) { - for (uint comp = 0; comp < 3; comp++) { // Convert RGB components - destPalette[col * 3 + comp] = (paletteData[col * 3 + comp] * destMax) / srcMax; + for (uint colorNr = 0; colorNr < colorCount; colorNr++) { + for (uint componentNr = 0; componentNr < 3; componentNr++) { // Convert RGB components + destPalette[colorNr * 3 + componentNr] = (paletteData[colorNr * 3 + componentNr] * destMax) / srcMax; + } + } +} + +// Converts CLUT data to a palette, that we can use +void GfxMgr::initPaletteCLUT(uint8 *destPalette, const uint16 *paletteCLUTData, uint colorCount) { + for (uint colorNr = 0; colorNr < colorCount; colorNr++) { + for (uint componentNr = 0; componentNr < 3; componentNr++) { // RGB component + byte component = (paletteCLUTData[colorNr * 3 + componentNr] >> 8); + // Adjust gamma (1.8 to 2.2) + component = (byte)(255 * powf(component / 255.0f, 0.8181f)); + destPalette[colorNr * 3 + componentNr] = component; } } } |