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
This commit is contained in:
Martin Kiewitz 2016-02-05 16:41:02 +01:00
parent f954603f8d
commit f09a15f276
5 changed files with 76 additions and 3 deletions

View File

@ -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;
}

View File

@ -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;
}
}
}

View File

@ -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);

View File

@ -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 */

View File

@ -234,6 +234,28 @@ static const uint8 PALETTE_AMIGA_ALT[16 * 3] = {
0x3F, 0x3F, 0x3F
};
/**
* 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.