diff options
-rw-r--r-- | engines/cge/bitmap.cpp | 9 | ||||
-rw-r--r-- | engines/cge/general.cpp | 2 | ||||
-rw-r--r-- | engines/cge/mouse.cpp | 6 | ||||
-rw-r--r-- | engines/cge/vga13h.cpp | 26 |
4 files changed, 25 insertions, 18 deletions
diff --git a/engines/cge/bitmap.cpp b/engines/cge/bitmap.cpp index 64a89e9381..959301bf50 100644 --- a/engines/cge/bitmap.cpp +++ b/engines/cge/bitmap.cpp @@ -409,9 +409,16 @@ bool Bitmap::loadVBM(XFile *f) { if (f->_error == 0) { if (p) { if (_pal) { + // Read in the palette byte palData[PAL_SIZ]; f->read(palData, PAL_SIZ); - VGA::pal2DAC(palData, _pal); + + const byte *srcP = palData; + for (int idx = 0; idx < PAL_CNT; ++idx, srcP += 3) { + _pal[idx]._r = *srcP; + _pal[idx]._g = *(srcP + 1); + _pal[idx]._b = *(srcP + 2); + } } else f->seek(f->mark() + PAL_SIZ); } diff --git a/engines/cge/general.cpp b/engines/cge/general.cpp index 0b761f2299..803100d0d4 100644 --- a/engines/cge/general.cpp +++ b/engines/cge/general.cpp @@ -136,7 +136,7 @@ char *ForceExt(char *buf, const char *nam, const char *ext) { return buf; } -static unsigned Seed = 1; +static unsigned Seed = 0xA5; unsigned FastRand(void) { return Seed = 257 * Seed + 817; diff --git a/engines/cge/mouse.cpp b/engines/cge/mouse.cpp index 5bdf7449fc..b16f4f52b2 100644 --- a/engines/cge/mouse.cpp +++ b/engines/cge/mouse.cpp @@ -53,11 +53,11 @@ MOUSE::MOUSE(CGEEngine *vm, Bitmap **shpl) : Sprite(vm, shpl), Busy(NULL), Hold( __int__(0x33); Exist = (_AX != 0); Buttons = _BX; - +*/ Goto(SCR_WID/2, SCR_HIG/2); - Z = 127; + _z = 127; Step(1); - */ + Exist = true; warning("STUB: MOUSE::MOUSE"); } diff --git a/engines/cge/vga13h.cpp b/engines/cge/vga13h.cpp index d12bb9596c..e1bea9a15c 100644 --- a/engines/cge/vga13h.cpp +++ b/engines/cge/vga13h.cpp @@ -1070,9 +1070,9 @@ void VGA::GetColors(Dac *tab) { void VGA::pal2DAC(const byte *palData, Dac *tab) { const byte *colP = palData; for (int idx = 0; idx < PAL_CNT; ++idx, colP += 3) { - tab[idx]._r = *colP; - tab[idx]._g = *(colP + 1); - tab[idx]._b = *(colP + 2); + tab[idx]._r = *colP >> 2; + tab[idx]._g = *(colP + 1) >> 2; + tab[idx]._b = *(colP + 2) >> 2; } } @@ -1085,21 +1085,21 @@ void VGA::DAC2pal(const Dac *tab, byte *palData) { } void VGA::SetColors(Dac *tab, int lum) { - Dac *palP = tab; - for (int idx = 0; idx < PAL_CNT; ++idx, ++palP) { - palP->_r = (palP->_r * lum) >> 6; - palP->_g = (palP->_g * lum) >> 6; - palP->_b = (palP->_b * lum) >> 6; + Dac *palP = tab, *destP = NewColors; + for (int idx = 0; idx < PAL_CNT; ++idx, ++palP, ++destP) { + destP->_r = (palP->_r * lum) >> 6; + destP->_g = (palP->_g * lum) >> 6; + destP->_b = (palP->_b * lum) >> 6; } if (Mono) { - palP = tab; + destP = NewColors; for (int idx = 0; idx < PAL_CNT; ++idx, ++palP) { // Form a greyscalce colour from 30% R, 59% G, 11% B - uint8 intensity = (palP->_r * 77) + (palP->_g * 151) + (palP->_b * 28); - palP->_r = intensity; - palP->_g = intensity; - palP->_b = intensity; + uint8 intensity = (destP->_r * 77) + (destP->_g * 151) + (destP->_b * 28); + destP->_r = intensity; + destP->_g = intensity; + destP->_b = intensity; } } |