Added 3 different Amiga AGI palettes (From oldest to newest). Changed initPalette so its easier to enable the usage of those palettes later.
svn-id: r28114
This commit is contained in:
parent
86d015c055
commit
16529e58e6
2 changed files with 106 additions and 30 deletions
|
@ -67,6 +67,93 @@ uint8 egaPalette[16 * 3] = {
|
||||||
0x3f, 0x3f, 0x3f
|
0x3f, 0x3f, 0x3f
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* First generation Amiga AGI palette.
|
||||||
|
* A 16-color, 12-bit RGB palette.
|
||||||
|
*
|
||||||
|
* Used by at least the following Amiga AGI versions:
|
||||||
|
* 2.082 (King's Quest I v1.0U 1986)
|
||||||
|
* 2.082 (Space Quest I v1.2 1986)
|
||||||
|
* 2.090 (King's Quest III v1.01 1986-11-08)
|
||||||
|
* 2.107 (King's Quest II v2.0J 1987-01-29)
|
||||||
|
* x.yyy (Black Cauldron v2.00 1987-06-14)
|
||||||
|
* x.yyy (Larry I v1.05 1987-06-26)
|
||||||
|
*/
|
||||||
|
uint8 amigaAgiPaletteV1[16 * 3] = {
|
||||||
|
0x0, 0x0, 0x0,
|
||||||
|
0x0, 0x0, 0xF,
|
||||||
|
0x0, 0x8, 0x0,
|
||||||
|
0x0, 0xD, 0xB,
|
||||||
|
0xC, 0x0, 0x0,
|
||||||
|
0xB, 0x7, 0xD,
|
||||||
|
0x8, 0x5, 0x0,
|
||||||
|
0xB, 0xB, 0xB,
|
||||||
|
0x7, 0x7, 0x7,
|
||||||
|
0x0, 0xB, 0xF,
|
||||||
|
0x0, 0xE, 0x0,
|
||||||
|
0x0, 0xF, 0xD,
|
||||||
|
0xF, 0x9, 0x8,
|
||||||
|
0xF, 0x7, 0x0,
|
||||||
|
0xE, 0xE, 0x0,
|
||||||
|
0xF, 0xF, 0xF
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Second generation Amiga AGI palette.
|
||||||
|
* A 16-color, 12-bit RGB palette.
|
||||||
|
*
|
||||||
|
* Used by at least the following Amiga AGI versions:
|
||||||
|
* 2.202 (Space Quest II v2.0F. Intro says 1988. ScummVM 0.10.0 detects as 1986-12-09)
|
||||||
|
*/
|
||||||
|
uint8 amigaAgiPaletteV2[16 * 3] = {
|
||||||
|
0x0, 0x0, 0x0,
|
||||||
|
0x0, 0x0, 0xF,
|
||||||
|
0x0, 0x8, 0x0,
|
||||||
|
0x0, 0xD, 0xB,
|
||||||
|
0xC, 0x0, 0x0,
|
||||||
|
0xB, 0x7, 0xD,
|
||||||
|
0x8, 0x5, 0x0,
|
||||||
|
0xB, 0xB, 0xB,
|
||||||
|
0x7, 0x7, 0x7,
|
||||||
|
0x0, 0xB, 0xF,
|
||||||
|
0x0, 0xE, 0x0,
|
||||||
|
0x0, 0xF, 0xD,
|
||||||
|
0xF, 0x9, 0x8,
|
||||||
|
0xD, 0x0, 0xF,
|
||||||
|
0xE, 0xE, 0x0,
|
||||||
|
0xF, 0xF, 0xF
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Third generation Amiga AGI palette.
|
||||||
|
* A 16-color, 12-bit RGB palette.
|
||||||
|
*
|
||||||
|
* Used by at least the following Amiga AGI versions:
|
||||||
|
* 2.310 (Police Quest I v2.0B 1989-02-22)
|
||||||
|
* 2.316 (Gold Rush! v2.05 1989-03-09)
|
||||||
|
* x.yyy (Manhunter I v1.06 1989-03-18)
|
||||||
|
* 2.333 (Manhunter II v3.06 1989-08-17)
|
||||||
|
* 2.333 (King's Quest III v2.15 1989-11-15)
|
||||||
|
*/
|
||||||
|
uint8 amigaAgiPaletteV3[16 * 3] = {
|
||||||
|
0x0, 0x0, 0x0,
|
||||||
|
0x0, 0x0, 0xB,
|
||||||
|
0x0, 0xB, 0x0,
|
||||||
|
0x0, 0xB, 0xB,
|
||||||
|
0xB, 0x0, 0x0,
|
||||||
|
0xB, 0x0, 0xB,
|
||||||
|
0xC, 0x7, 0x0,
|
||||||
|
0xB, 0xB, 0xB,
|
||||||
|
0x7, 0x7, 0x7,
|
||||||
|
0x0, 0x0, 0xF,
|
||||||
|
0x0, 0xF, 0x0,
|
||||||
|
0x0, 0xF, 0xF,
|
||||||
|
0xF, 0x0, 0x0,
|
||||||
|
0xF, 0x0, 0xF,
|
||||||
|
0xF, 0xF, 0x0,
|
||||||
|
0xF, 0xF, 0xF
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 16 color amiga-ish palette.
|
* 16 color amiga-ish palette.
|
||||||
*/
|
*/
|
||||||
|
@ -656,39 +743,26 @@ int GfxMgr::keypress() {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize the color palette
|
* Initialize the color palette
|
||||||
* This function initializes the color palette using the specified 16-color
|
* This function initializes the color palette using the specified
|
||||||
* RGB palette.
|
* RGB palette.
|
||||||
* @param p A pointer to the 16-color RGB palette.
|
* @param p A pointer to the source RGB palette.
|
||||||
|
* @param colorCount Count of colors in the source palette.
|
||||||
|
* @param fromBits Bits per source color component.
|
||||||
|
* @param toBits Bits per destination color component.
|
||||||
*/
|
*/
|
||||||
void GfxMgr::initPalette(uint8 *p) {
|
void GfxMgr::initPalette(uint8 *p, uint colorCount, uint fromBits, uint toBits) {
|
||||||
int i;
|
const uint srcMax = (1 << fromBits) - 1;
|
||||||
|
const uint destMax = (1 << toBits) - 1;
|
||||||
for (i = 0; i < 48; i++) {
|
for (uint col = 0; col < colorCount; col++) {
|
||||||
_palette[i] = p[i];
|
for (uint comp = 0; comp < 3; comp++) { // Convert RGB components
|
||||||
|
_palette[col * 4 + comp] = (p[col * 3 + comp] * destMax) / srcMax;
|
||||||
|
}
|
||||||
|
_palette[col * 4 + 3] = 0; // Set alpha to zero
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GfxMgr::gfxSetPalette() {
|
void GfxMgr::gfxSetPalette() {
|
||||||
int i;
|
g_system->setPalette(_palette, 0, 256);
|
||||||
byte pal[256 * 4];
|
|
||||||
|
|
||||||
if (!(_vm->getFeatures() & (GF_AGI256 | GF_AGI256_2))) {
|
|
||||||
for (i = 0; i < 16; i++) {
|
|
||||||
pal[i * 4 + 0] = _palette[i * 3 + 0] << 2;
|
|
||||||
pal[i * 4 + 1] = _palette[i * 3 + 1] << 2;
|
|
||||||
pal[i * 4 + 2] = _palette[i * 3 + 2] << 2;
|
|
||||||
pal[i * 4 + 3] = 0;
|
|
||||||
}
|
|
||||||
g_system->setPalette(pal, 0, 16);
|
|
||||||
} else {
|
|
||||||
for (i = 0; i < 256; i++) {
|
|
||||||
pal[i * 4 + 0] = vgaPalette[i * 3 + 0];
|
|
||||||
pal[i * 4 + 1] = vgaPalette[i * 3 + 1];
|
|
||||||
pal[i * 4 + 2] = vgaPalette[i * 3 + 2];
|
|
||||||
pal[i * 4 + 3] = 0;
|
|
||||||
}
|
|
||||||
g_system->setPalette(pal, 0, 256);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Gets AGIPAL Data
|
//Gets AGIPAL Data
|
||||||
|
@ -852,7 +926,9 @@ void GfxMgr::setCursor(bool amigaStyleCursor) {
|
||||||
* @see deinit_video()
|
* @see deinit_video()
|
||||||
*/
|
*/
|
||||||
int GfxMgr::initVideo() {
|
int GfxMgr::initVideo() {
|
||||||
if (_vm->_renderMode == Common::kRenderEGA)
|
if (_vm->getFeatures() & (GF_AGI256 | GF_AGI256_2))
|
||||||
|
initPalette(vgaPalette, 256, 8);
|
||||||
|
else if (_vm->_renderMode == Common::kRenderEGA)
|
||||||
initPalette(egaPalette);
|
initPalette(egaPalette);
|
||||||
else
|
else
|
||||||
initPalette(newPalette);
|
initPalette(newPalette);
|
||||||
|
|
|
@ -41,7 +41,7 @@ class GfxMgr {
|
||||||
private:
|
private:
|
||||||
AgiEngine *_vm;
|
AgiEngine *_vm;
|
||||||
|
|
||||||
uint8 _palette[16 * 3];
|
uint8 _palette[256 * 4];
|
||||||
uint8 *_agiScreen;
|
uint8 *_agiScreen;
|
||||||
unsigned char *_screen;
|
unsigned char *_screen;
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ public:
|
||||||
void drawRectangle(int, int, int, int, int);
|
void drawRectangle(int, int, int, int, int);
|
||||||
void saveBlock(int, int, int, int, uint8 *);
|
void saveBlock(int, int, int, int, uint8 *);
|
||||||
void restoreBlock(int, int, int, int, uint8 *);
|
void restoreBlock(int, int, int, int, uint8 *);
|
||||||
void initPalette(uint8 *);
|
void initPalette(uint8 *p, uint colorCount = 16, uint fromBits = 6, uint toBits = 8);
|
||||||
void setAGIPal(int);
|
void setAGIPal(int);
|
||||||
int getAGIPalFileNum();
|
int getAGIPalFileNum();
|
||||||
void drawFrame(int x1, int y1, int x2, int y2, int c1, int c2);
|
void drawFrame(int x1, int y1, int x2, int y2, int c1, int c2);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue