From e68b6e9f15b9025cd587273da8eaa089670cc0b0 Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Thu, 30 Sep 2010 13:00:30 +0000 Subject: GOB: Remove dither stuff, commenting out most v6 drawing svn-id: r52945 --- engines/gob/gob.cpp | 6 ++- engines/gob/gob.h | 2 + engines/gob/init.cpp | 2 - engines/gob/inter.h | 1 - engines/gob/inter_v6.cpp | 12 ----- engines/gob/util.cpp | 7 ++- engines/gob/video.cpp | 41 +++-------------- engines/gob/video.h | 17 ------- engines/gob/video_v6.cpp | 115 ++++------------------------------------------- 9 files changed, 26 insertions(+), 177 deletions(-) (limited to 'engines/gob') diff --git a/engines/gob/gob.cpp b/engines/gob/gob.cpp index f04fa67bf9..9ca773c18f 100644 --- a/engines/gob/gob.cpp +++ b/engines/gob/gob.cpp @@ -242,6 +242,10 @@ bool GobEngine::isDemo() const { return (isSCNDemo() || isBATDemo()); } +const Graphics::PixelFormat &GobEngine::getPixelFormat() const { + return _pixelFormat; +} + Common::Error GobEngine::run() { if (!initGameParts()) { GUIErrorMessage("GobEngine::init(): Unknown version of game engine"); @@ -578,8 +582,6 @@ bool GobEngine::initGraphics() { _global->_primarySurfDesc = SurfaceDescPtr(new SurfaceDesc(_mode, _width, _height)); - _video->init(); - return true; } diff --git a/engines/gob/gob.h b/engines/gob/gob.h index cfefe62267..f6c03fa617 100644 --- a/engines/gob/gob.h +++ b/engines/gob/gob.h @@ -221,6 +221,8 @@ public: bool isTrueColor() const; bool isDemo() const; + const Graphics::PixelFormat &getPixelFormat() const; + GobEngine(OSystem *syst); virtual ~GobEngine(); diff --git a/engines/gob/init.cpp b/engines/gob/init.cpp index 3da71a2ba6..7cb674ed5c 100644 --- a/engines/gob/init.cpp +++ b/engines/gob/init.cpp @@ -65,8 +65,6 @@ void Init::doDemo() { if (_vm->isSCNDemo()) { // This is a non-interactive demo with a SCN script and VMD videos - _vm->_video->setPrePalette(); - SCNPlayer scnPlayer(_vm); if (_vm->_demoIndex > 0) diff --git a/engines/gob/inter.h b/engines/gob/inter.h index ca97483054..4554a0783b 100644 --- a/engines/gob/inter.h +++ b/engines/gob/inter.h @@ -542,7 +542,6 @@ protected: bool o6_loadCursor(OpFuncParams ¶ms); bool o6_assign(OpFuncParams ¶ms); - bool o6_palLoad(OpFuncParams ¶ms); bool o6_removeHotspot(OpFuncParams ¶ms); bool o6_fillRect(OpFuncParams ¶ms); diff --git a/engines/gob/inter_v6.cpp b/engines/gob/inter_v6.cpp index a5a4f7d666..fc81de757e 100644 --- a/engines/gob/inter_v6.cpp +++ b/engines/gob/inter_v6.cpp @@ -65,7 +65,6 @@ void Inter_v6::setupOpcodesFunc() { OPCODEFUNC(0x03, o6_loadCursor); OPCODEFUNC(0x09, o6_assign); - OPCODEFUNC(0x13, o6_palLoad); OPCODEFUNC(0x19, o6_removeHotspot); OPCODEFUNC(0x33, o6_fillRect); } @@ -357,17 +356,6 @@ bool Inter_v6::o6_assign(OpFuncParams ¶ms) { return false; } -bool Inter_v6::o6_palLoad(OpFuncParams ¶ms) { - o1_palLoad(params); - - if (_gotFirstPalette) - _vm->_video->_palLUT->setPalette((const byte *)_vm->_global->_pPaletteDesc->vgaPal, - Graphics::PaletteLUT::kPaletteRGB, 6, 0); - - _gotFirstPalette = true; - return false; -} - bool Inter_v6::o6_removeHotspot(OpFuncParams ¶ms) { int16 id; uint8 stateType1 = Hotspots::kStateFilledDisabled | Hotspots::kStateType1; diff --git a/engines/gob/util.cpp b/engines/gob/util.cpp index c895c6301d..00d8c2c9ac 100644 --- a/engines/gob/util.cpp +++ b/engines/gob/util.cpp @@ -316,8 +316,11 @@ void Util::clearPalette() { _vm->validateVideoMode(_vm->_global->_videoMode); if (_vm->_global->_setAllPalette) { - memset(colors, 0, 1024); - g_system->setPalette(colors, 0, 256); + if (_vm->getPixelFormat().bytesPerPixel == 1) { + memset(colors, 0, 1024); + g_system->setPalette(colors, 0, 256); + } + return; } diff --git a/engines/gob/video.cpp b/engines/gob/video.cpp index 12f470acab..6d2636d067 100644 --- a/engines/gob/video.cpp +++ b/engines/gob/video.cpp @@ -30,7 +30,6 @@ #include "graphics/cursorman.h" #include "graphics/fontman.h" #include "graphics/surface.h" -#include "graphics/dither.h" #include "gob/gob.h" #include "gob/video.h" @@ -186,8 +185,6 @@ Video::Video(GobEngine *vm) : _vm(vm) { _lastSparse = 0xFFFFFFFF; _dirtyAll = false; - - _palLUT = new Graphics::PaletteLUT(5, Graphics::PaletteLUT::kPaletteYUV); } char Video::initDriver(int16 vidMode) { @@ -199,7 +196,6 @@ char Video::initDriver(int16 vidMode) { } Video::~Video() { - delete _palLUT; } void Video::freeDriver() { @@ -524,7 +520,8 @@ void Video::setPalElem(int16 index, char red, char green, char blue, _vm->_global->_bluePalette[index] = blue; setPalColor(pal, red, green, blue); - g_system->setPalette(pal, index, 1); + if (_vm->getPixelFormat().bytesPerPixel == 1) + g_system->setPalette(pal, index, 1); } void Video::setPalette(PalDesc *palDesc) { @@ -537,7 +534,8 @@ void Video::setPalette(PalDesc *palDesc) { for (int i = 0; i < numcolors; i++) setPalColor(pal + i * 4, palDesc->vgaPal[i]); - g_system->setPalette(pal, 0, numcolors); + if (_vm->getPixelFormat().bytesPerPixel == 1) + g_system->setPalette(pal, 0, numcolors); } void Video::setFullPalette(PalDesc *palDesc) { @@ -552,7 +550,8 @@ void Video::setFullPalette(PalDesc *palDesc) { setPalColor(pal + i * 4, colors[i]); } - g_system->setPalette(pal, 0, 256); + if (_vm->getPixelFormat().bytesPerPixel == 1) + g_system->setPalette(pal, 0, 256); } else Video::setPalette(palDesc); } @@ -619,32 +618,4 @@ void Video::dirtyRectsApply(int left, int top, int width, int height, int x, int } } -void Video::initOSD() { - const byte palOSD[] = { - 0, 0, 0, 0, - 0, 0, 171, 0, - 0, 171, 0, 0, - 0, 171, 171, 0, - 171, 0, 0, 0 - }; - - g_system->setPalette(palOSD, 0, 5); -} - -void Video::drawOSDText(const char *text) { - const Graphics::Font &font(*FontMan.getFontByUsage(Graphics::FontManager::kOSDFont)); - uint32 color = 0x2; - Graphics::Surface surf; - - surf.create(g_system->getWidth(), font.getFontHeight(), 1); - - font.drawString(&surf, text, 0, 0, surf.w, color, Graphics::kTextAlignCenter); - - int y = g_system->getHeight() / 2 - font.getFontHeight() / 2; - g_system->copyRectToScreen((byte *)surf.pixels, surf.pitch, 0, y, surf.w, surf.h); - g_system->updateScreen(); - - surf.free(); -} - } // End of namespace Gob diff --git a/engines/gob/video.h b/engines/gob/video.h index b8a46598b7..d30a486189 100644 --- a/engines/gob/video.h +++ b/engines/gob/video.h @@ -32,10 +32,6 @@ #include "gob/gob.h" -namespace Graphics { - class PaletteLUT; -} - namespace Gob { class Font { @@ -140,8 +136,6 @@ public: int16 _screenDeltaX; int16 _screenDeltaY; - Graphics::PaletteLUT *_palLUT; - void freeDriver(); void initPrimary(int16 mode); SurfaceDescPtr initSurfDesc(int16 vidMode, int16 width, @@ -198,10 +192,6 @@ public: int16 srcHeight, int16 x, int16 y, int16 transp, SurfaceDesc &destDesc) = 0; - virtual void init() {} - - virtual void setPrePalette() { } - Video(class GobEngine *vm); virtual ~Video(); @@ -217,9 +207,6 @@ protected: GobEngine *_vm; char initDriver(int16 vidMode); - - void initOSD(); - void drawOSDText(const char *text); }; class Video_v1 : public Video { @@ -248,10 +235,6 @@ public: virtual void fillRect(SurfaceDesc &dest, int16 left, int16 top, int16 right, int16 bottom, int16 color); - virtual void init(); - - virtual void setPrePalette(); - Video_v6(GobEngine *vm); virtual ~Video_v6() {} diff --git a/engines/gob/video_v6.cpp b/engines/gob/video_v6.cpp index 7285cd8958..3f1055c48a 100644 --- a/engines/gob/video_v6.cpp +++ b/engines/gob/video_v6.cpp @@ -25,7 +25,6 @@ #include "common/endian.h" #include "common/savefile.h" -#include "graphics/dither.h" #include "gob/gob.h" #include "gob/video.h" @@ -38,43 +37,6 @@ namespace Gob { Video_v6::Video_v6(GobEngine *vm) : Video_v2(vm) { } -void Video_v6::setPrePalette() { - byte *tpal = (byte *)_vm->_draw->_vgaPalette; - const byte *fpal = (const byte *)_ditherPalette; - - for (int i = 0; i < 256; i++) { - byte r, g, b; - - Graphics::PaletteLUT::YUV2RGB(fpal[i * 3 + 0], fpal[i * 3 + 1], fpal[i * 3 + 2], - r, g, b); - - tpal[i * 3 + 0] = r >> 2; - tpal[i * 3 + 1] = g >> 2; - tpal[i * 3 + 2] = b >> 2; - } - _vm->_global->_pPaletteDesc->vgaPal = _vm->_draw->_vgaPalette; - _vm->_video->setFullPalette(_vm->_global->_pPaletteDesc); - -} - -void Video_v6::init() { - initOSD(); - - buildPalLUT(); -} - -void Video_v6::buildPalLUT() { - char text[30]; - - _palLUT->setPalette(_ditherPalette, Graphics::PaletteLUT::kPaletteYUV, 8, 0); - - sprintf(text, "Building palette table"); - drawOSDText(text); - - for (int i = 0; (i < 32) && !_vm->shouldQuit(); i++) - _palLUT->buildNext(); -} - char Video_v6::spriteUncompressor(byte *sprBuf, int16 srcWidth, int16 srcHeight, int16 x, int16 y, int16 transp, SurfaceDesc &destDesc) { _vm->validateVideoMode(destDesc._vidMode); @@ -140,13 +102,16 @@ void Video_v6::fillRect(SurfaceDesc &dest, void Video_v6::shadeRect(SurfaceDesc &dest, int16 left, int16 top, int16 right, int16 bottom, byte color, byte strength) { + warning("TODO: Video_v6::shadeRect()"); + + /* int width = right - left + 1; int height = bottom - top + 1; int dWidth = dest.getWidth(); byte *vidMem = dest.getVidMem() + dWidth * top + left; byte sY, sU, sV; - _palLUT->getEntry(color, sY, sU, sV); + //_palLUT->getEntry(color, sY, sU, sV); int shadeY = sY * (16 - strength); int shadeU = sU * (16 - strength); @@ -176,6 +141,7 @@ void Video_v6::shadeRect(SurfaceDesc &dest, } delete dither; + */ } void Video_v6::drawPacked(const byte *sprBuf, int16 x, int16 y, SurfaceDesc &surfDesc) { @@ -227,6 +193,9 @@ void Video_v6::drawYUV(SurfaceDesc &destDesc, int16 x, int16 y, int16 dataWidth, int16 dataHeight, int16 width, int16 height, const byte *dataY, const byte *dataU, const byte *dataV) { + warning("TODO: Video_v6::drawYUV"); + + /* byte *vidMem = destDesc.getVidMem() + y * destDesc.getWidth() + x; if ((x + width - 1) >= destDesc.getWidth()) @@ -256,73 +225,7 @@ void Video_v6::drawYUV(SurfaceDesc &destDesc, int16 x, int16 y, } delete dither; + */ } -const byte Video_v6::_ditherPalette[768] = { - 0x00,0x80,0x80,0x26,0x6B,0xC0,0x4B,0x56,0x4B,0x71,0x41,0x8B, - 0x0E,0xC0,0x76,0x34,0xAB,0xB6,0x59,0x96,0x41,0xBE,0x81,0x81, - 0xCF,0x77,0x75,0xC1,0x9B,0x6C,0x7F,0x81,0x81,0x7F,0x81,0x81, - 0x0A,0x8C,0x8A,0x0A,0xB0,0x79,0x0E,0x9D,0x76,0x0E,0x79,0x76, - 0x10,0x77,0x75,0x09,0x7B,0x8B,0x16,0x74,0xA6,0x16,0x74,0xA6, - 0x12,0x91,0x93,0x13,0xB5,0x72,0x1B,0x9E,0x6D,0x1A,0x7A,0x6D, - 0x1C,0x71,0x6C,0x1B,0x72,0x8C,0x1B,0x71,0xAE,0x1B,0x71,0xAE, - 0x21,0x93,0x93,0x21,0xB8,0x6F,0x27,0xA3,0x64,0x27,0x7F,0x65, - 0x29,0x69,0x68,0x28,0x69,0x8E,0x23,0x6F,0xB7,0x2A,0x69,0xB2, - 0x36,0x94,0x92,0x35,0xB9,0x6E,0x35,0xA6,0x5D,0x34,0x80,0x5D, - 0x39,0x61,0x6B,0x3A,0x60,0x8F,0x34,0x6E,0xB9,0x39,0x60,0xB5, - 0x46,0x93,0x95,0x48,0xB6,0x6F,0x45,0xA6,0x5C,0x47,0x80,0x5C, - 0x4B,0x56,0x6D,0x4B,0x56,0x91,0x47,0x6F,0xB7,0x4A,0x57,0xB5, - 0x5A,0x94,0x92,0x59,0xB9,0x6E,0x59,0xA6,0x5D,0x59,0x82,0x5D, - 0x5B,0x4D,0x6D,0x5A,0x4E,0x92,0x5B,0x6F,0xB7,0x5C,0x4D,0xB6, - 0x6D,0x94,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x67,0x89, - 0xEE,0x81,0x81,0xE8,0x8B,0x85,0xED,0x88,0x71,0xEA,0x71,0x73, - 0xEE,0x5D,0x81,0xEA,0x71,0x8D,0xE4,0x87,0x91,0xE4,0x63,0x91, - 0xDB,0x81,0x81,0xD7,0x95,0x83,0xDB,0x93,0x6F,0xDB,0x6F,0x6F, - 0xDC,0x5C,0x80,0xDD,0x6E,0x93,0xD7,0x83,0x9B,0xD6,0x5F,0x9B, - 0xCA,0x81,0x81,0xC8,0x9D,0x82,0xC8,0x94,0x6E,0xCA,0x6F,0x6E, - 0xC9,0x5D,0x81,0xCA,0x6F,0x93,0xC9,0x82,0xA5,0xC8,0x5E,0xA5, - 0xB6,0x81,0x81,0xB6,0xA5,0x80,0xB7,0x93,0x6F,0xB7,0x6F,0x6F, - 0xB6,0x5D,0x81,0xB6,0x70,0x93,0xB8,0x80,0xA5,0xB7,0x5C,0xA5, - 0xA3,0x81,0x81,0xA4,0xA7,0x81,0xA3,0x92,0x6F,0xA3,0x6E,0x6F, - 0xA5,0x5C,0x7F,0xA5,0x6D,0x93,0xA4,0x80,0xA5,0xA4,0x5C,0xA5, - 0x92,0x81,0x81,0x93,0xA5,0x81,0x90,0x94,0x6F,0x92,0x6F,0x6D, - 0x92,0x5D,0x81,0x92,0x70,0x93,0x91,0x82,0xA7,0x91,0x5E,0xA7, - 0x7F,0x81,0x81,0x7F,0xA5,0x81,0x80,0x92,0x70,0x7F,0x6E,0x6F, - 0x7F,0x5D,0x81,0x7D,0x70,0x93,0x80,0x80,0xA5,0x80,0x5C,0xA5, - 0x6B,0x81,0x81,0x6C,0xA7,0x80,0x6D,0x94,0x6F,0x6C,0x6E,0x6F, - 0x6D,0x5B,0x80,0x6D,0x6E,0x93,0x6C,0x81,0xA5,0x6C,0x5D,0xA5, - 0x5A,0x81,0x81,0x5A,0xA5,0x81,0x59,0x95,0x6E,0x5A,0x6F,0x6E, - 0x5B,0x5D,0x81,0x59,0x70,0x93,0x5A,0x81,0xA7,0x5A,0x5D,0xA7, - 0x47,0x81,0x81,0x47,0xA5,0x80,0x47,0x92,0x6F,0x47,0x6E,0x6F, - 0x46,0x5D,0x81,0x46,0x6F,0x95,0x49,0x81,0xA5,0x48,0x5D,0xA5, - 0x32,0x81,0x81,0x33,0xA7,0x81,0x35,0x95,0x6E,0x34,0x6F,0x6F, - 0x36,0x62,0x7E,0x35,0x6E,0x93,0x34,0x80,0xA5,0x36,0x62,0xA4, - 0x23,0x81,0x81,0x23,0xA5,0x80,0x20,0x94,0x6F,0x22,0x6F,0x6D, - 0x26,0x6B,0x7E,0x21,0x6F,0x93,0x22,0x82,0xA7,0x25,0x6C,0xA4, - 0x0E,0x81,0x81,0x0F,0xA5,0x81,0x13,0x91,0x73,0x15,0x75,0x71, - 0x14,0x75,0x7D,0x11,0x77,0x93,0x15,0x7D,0xA1,0x16,0x74,0xA1, - 0x00,0x80,0x80,0x07,0xA0,0x7B,0x05,0x8F,0x7D,0x09,0x7B,0x7A, - 0x07,0x7D,0x7B,0x07,0x7C,0x8C,0x0E,0x78,0x98,0x0E,0x78,0x98, - 0x7F,0x81,0x81,0x80,0x83,0x81,0xF7,0x7C,0x84,0x9E,0x83,0x80, - 0x7F,0x81,0x81,0x4B,0x56,0xFE,0x93,0x2D,0x17,0xDE,0x03,0x95, - 0x1C,0xFE,0x6C,0x67,0xD4,0xEA,0xAF,0xAB,0x03,0xFA,0x81,0x81 -}; - } // End of namespace Gob -- cgit v1.2.3