diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/lab/lab.h | 10 | ||||
-rw-r--r-- | engines/lab/map.cpp | 5 | ||||
-rw-r--r-- | engines/lab/vga.cpp | 36 |
3 files changed, 12 insertions, 39 deletions
diff --git a/engines/lab/lab.h b/engines/lab/lab.h index afe191b60b..9586a48a36 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -74,7 +74,7 @@ public: int _screenWidth; int _screenHeight; - int _screenBytesPerPage; + uint32 _screenBytesPerPage; // timing.cpp @@ -151,8 +151,6 @@ public: void setPalette(void *cmap, uint16 numcolors); void drawHLine(uint16 x, uint16 y1, uint16 y2); void drawVLine(uint16 x1, uint16 y, uint16 x2); - void writeColorReg(byte *buf, uint16 regnum); - void writeColorRegsSmooth(byte *buf, uint16 first, uint16 numreg); void drawPanel(); void drawRoomMessage(uint16 CurInv, CloseDataPtr cptr); @@ -185,12 +183,6 @@ public: void changeVolume(int delta); private: - void quickWaitTOF(); - - /*---------- Drawing Routines ----------*/ - - void applyPalette(byte *buf, uint16 first, uint16 numreg, uint16 slow); - // engine.cpp bool setUpScreens(); void freeScreens(); diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index b5855eaf58..9ce9f0889b 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -60,7 +60,8 @@ void setAmigaPal(uint16 *pal, uint16 numcolors) { vgapal[vgacount++] = (byte)(((pal[i] & 0x00f)) << 2); } - g_lab->writeColorRegsSmooth(vgapal, 0, 16); + g_lab->writeColorRegs(vgapal, 0, 16); + g_lab->waitTOF(); } /*---------------------------------------------------------------------------*/ @@ -620,7 +621,7 @@ void LabEngine::processMap(uint16 CurRoom) { } waitTOF(); - writeColorReg(newcolor, 1); + writeColorRegs(newcolor, 1, 1); _event->updateMouse(); waitTOF(); _event->updateMouse(); diff --git a/engines/lab/vga.cpp b/engines/lab/vga.cpp index d64953c6b9..73f80b29f8 100644 --- a/engines/lab/vga.cpp +++ b/engines/lab/vga.cpp @@ -49,7 +49,7 @@ bool LabEngine::createScreen(bool hiRes) { } _screenBytesPerPage = _screenWidth * _screenHeight; - _displayBuffer = (byte *)malloc(_screenBytesPerPage); + _displayBuffer = new byte[_screenBytesPerPage]; // FIXME: Memory leak! return true; } @@ -76,19 +76,6 @@ void LabEngine::waitTOF() { _lastWaitTOFTicks = now; } -void LabEngine::applyPalette(byte *buf, uint16 first, uint16 numreg, uint16 slow) { - byte tmp[256 * 3]; - - for (int i = 0; i < 256 * 3; i++) { - tmp[i] = buf[i] * 4; - } - - g_system->getPaletteManager()->setPalette(tmp, first, numreg); - - if (slow) - waitTOF(); -} - /*****************************************************************************/ /* Writes any number of the 256 color registers. */ /* first: the number of the first color register to write. */ @@ -101,22 +88,15 @@ void LabEngine::applyPalette(byte *buf, uint16 first, uint16 numreg, uint16 slow /* selected. */ /*****************************************************************************/ void LabEngine::writeColorRegs(byte *buf, uint16 first, uint16 numreg) { - applyPalette(buf, first, numreg, 0); - memcpy(&(_curvgapal[first * 3]), buf, numreg * 3); -} + byte tmp[256 * 3]; -void LabEngine::writeColorRegsSmooth(byte *buf, uint16 first, uint16 numreg) { - applyPalette(buf, first, numreg, 1); - memcpy(&(_curvgapal[first * 3]), buf, numreg * 3); -} + for (int i = 0; i < 256 * 3; i++) { + tmp[i] = buf[i] * 4; + } -/*****************************************************************************/ -/* Sets one of the 256 (0..255) color registers. buf is a char pointer, */ -/* the first character in the string is the red value, then green, then */ -/* blue. Each color value is a 6 bit value. */ -/*****************************************************************************/ -void LabEngine::writeColorReg(byte *buf, uint16 regnum) { - writeColorRegs(buf, regnum, 1); + g_system->getPaletteManager()->setPalette(tmp, first, numreg); + + memcpy(&(_curvgapal[first * 3]), buf, numreg * 3); } void LabEngine::setPalette(void *cmap, uint16 numcolors) { |