diff options
-rw-r--r-- | engines/agi/agi.cpp | 6 | ||||
-rw-r--r-- | engines/agi/graphics.cpp | 27 | ||||
-rw-r--r-- | engines/agi/graphics.h | 1 | ||||
-rw-r--r-- | engines/agi/mouse_cursor.h | 23 | ||||
-rw-r--r-- | engines/agi/palette.h | 22 |
5 files changed, 76 insertions, 3 deletions
diff --git a/engines/agi/agi.cpp b/engines/agi/agi.cpp index 933aa50b1c..9eeca62acc 100644 --- a/engines/agi/agi.cpp +++ b/engines/agi/agi.cpp @@ -305,6 +305,9 @@ void AgiBase::initRenderMode() { case Common::kPlatformAtariST: _renderMode = Common::kRenderAtariST; break; + case Common::kPlatformMacintosh: + _renderMode = Common::kRenderMacintosh; + break; default: break; } @@ -320,6 +323,9 @@ void AgiBase::initRenderMode() { case Common::kRenderAtariST: _renderMode = Common::kRenderAtariST; break; + case Common::kRenderMacintosh: + _renderMode = Common::kRenderMacintosh; + break; default: break; } 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; } } } diff --git a/engines/agi/graphics.h b/engines/agi/graphics.h index 7a7d340df6..fb596626c6 100644 --- a/engines/agi/graphics.h +++ b/engines/agi/graphics.h @@ -69,6 +69,7 @@ public: int initVideo(); int deinitVideo(); void initPalette(uint8 *destPalette, const uint8 *paletteData, uint colorCount = 16, uint fromBits = 6, uint toBits = 8); + void initPaletteCLUT(uint8 *destPalette, const uint16 *paletteCLUTData, uint colorCount = 16); void setAGIPal(int); int getAGIPalFileNum(); void setPalette(bool GfxModePalette); diff --git a/engines/agi/mouse_cursor.h b/engines/agi/mouse_cursor.h index 381ad9fcb7..c086359b0f 100644 --- a/engines/agi/mouse_cursor.h +++ b/engines/agi/mouse_cursor.h @@ -178,6 +178,29 @@ static const byte MOUSECURSOR_AMIGA_BUSY[] = { 1,1,1,1,1,1,1,1,1,1,1,1,1 }; +/** + * A Macintosh-style busy cursor showing an hourglass (10x14). + * 0 = Transparent. + * 1 = Black (#000000 in 24-bit RGB). + * 2 = White (#FFFFFF in 24-bit RGB). + */ +static const byte MOUSECURSOR_MACINTOSH_BUSY[] = { + 0,0,1,1,1,1,1,1,0,0, + 0,0,1,1,1,1,1,1,0,0, + 0,0,1,1,1,1,1,1,0,0, + 0,1,2,2,2,2,2,2,1,0, + 1,2,2,2,2,1,2,2,2,1, + 1,2,2,2,2,1,2,2,2,1, + 1,2,2,2,2,1,2,2,2,1, + 1,2,2,1,1,1,2,2,2,1, + 1,2,2,2,2,2,2,2,2,1, + 1,2,2,2,2,2,2,2,2,1, + 0,1,2,2,2,2,2,2,1,0, + 0,0,1,1,1,1,1,1,0,0, + 0,0,1,1,1,1,1,1,0,0, + 0,0,1,1,1,1,1,1,0,0 +}; + } // End of namespace Agi #endif /* AGI_MOUSE_CURSOR_H */ diff --git a/engines/agi/palette.h b/engines/agi/palette.h index 88ccce7441..4be29e4678 100644 --- a/engines/agi/palette.h +++ b/engines/agi/palette.h @@ -235,6 +235,28 @@ static const uint8 PALETTE_AMIGA_ALT[16 * 3] = { }; /** + * 16 color Macintosh palette (CLUT format). + */ +static const uint16 PALETTE_MACINTOSH_CLUT[16 * 3] = { + 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0xC000, + 0x0000, 0xA800, 0x0000, + 0x0000, 0xA000, 0xA000, + 0xCE50, 0x0000, 0x0000, + 0xC080, 0x0000, 0xFFFF, + 0xD000, 0x6130, 0x32D0, + 0xC000, 0xC000, 0xC000, + 0x6000, 0x6000, 0x6000, + 0x6800, 0x6800, 0xFFFF, + 0x0000, 0xFFFF, 0x0000, + 0x0000, 0xFFFF, 0xFFFF, + 0xFFFF, 0x5390, 0x64B0, + 0xFFFF, 0x8000, 0x0000, + 0xFFFF, 0xFFFF, 0x0000, + 0xFFFF, 0xFFFF, 0xFFFF +}; + +/** * 256 color palette used with AGI256 and AGI256-2 games. * Uses full 8 bits per color component. * This is NOT the standard VGA palette. |