From 3a64d35dfd9126d7912c4d4496030f7ed120d660 Mon Sep 17 00:00:00 2001 From: Travis Howell Date: Thu, 4 Jun 2009 01:05:47 +0000 Subject: Add 16bit color support for later HE games. svn-id: r41153 --- engines/scumm/scumm.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'engines/scumm/scumm.cpp') diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp index cbfa720e79..17ffc6e5b0 100644 --- a/engines/scumm/scumm.cpp +++ b/engines/scumm/scumm.cpp @@ -248,6 +248,7 @@ ScummEngine::ScummEngine(OSystem *syst, const DetectorResult &dr) _switchRoomEffect2 = 0; _switchRoomEffect = 0; + _bitDepth = 0; _doEffect = false; _snapScroll = false; _currentLights = 0; @@ -264,8 +265,8 @@ ScummEngine::ScummEngine(OSystem *syst, const DetectorResult &dr) _palManipPalette = NULL; _palManipIntermediatePal = NULL; memset(gfxUsageBits, 0, sizeof(gfxUsageBits)); - _hePaletteCache = NULL; _hePalettes = NULL; + _hePaletteSlot = 0; _shadowPalette = NULL; _shadowPaletteSize = 0; memset(_currentPalette, 0, sizeof(_currentPalette)); @@ -521,9 +522,11 @@ ScummEngine::ScummEngine(OSystem *syst, const DetectorResult &dr) _screenHeight = 200; } + _bitDepth = (_game.features & GF_16BIT_COLOR) ? 2 : 1; + // Allocate gfx compositing buffer (not needed for V7/V8 games). if (_game.version < 7) - _compositeBuf = (byte *)malloc(_screenWidth * _screenHeight); + _compositeBuf = (byte *)malloc(_screenWidth * _screenHeight * _bitDepth); else _compositeBuf = 0; @@ -814,7 +817,6 @@ ScummEngine_v90he::~ScummEngine_v90he() { delete _logicHE; } if (_game.heversion >= 99) { - free(_hePaletteCache); free(_hePalettes); } } @@ -1182,7 +1184,7 @@ void ScummEngine::setupScumm() { int maxHeapThreshold = -1; if (_game.features & GF_16BIT_COLOR) { - // 16Bit color games require double the memory, due to increased resource sizes. + // 16bit color games require double the memory, due to increased resource sizes. maxHeapThreshold = 12 * 1024 * 1024; } else if (_game.features & GF_NEW_COSTUMES) { // Since the new costumes are very big, we increase the heap limit, to avoid having @@ -1204,7 +1206,7 @@ void ScummEngine::setupScumm() { } free(_compositeBuf); - _compositeBuf = (byte *)malloc(_screenWidth * _textSurfaceMultiplier * _screenHeight * _textSurfaceMultiplier); + _compositeBuf = (byte *)malloc(_screenWidth * _textSurfaceMultiplier * _screenHeight * _textSurfaceMultiplier * _bitDepth); } #ifdef ENABLE_SCUMM_7_8 @@ -1542,11 +1544,9 @@ void ScummEngine_v99he::resetScumm() { ScummEngine_v90he::resetScumm(); - _hePaletteCache = (int16 *)malloc(65536); - memset(_hePaletteCache, -1, 65536); - - _hePalettes = (uint8 *)malloc((_numPalettes + 1) * 1024); - memset(_hePalettes, 0, (_numPalettes + 1) * 1024); + _hePaletteSlot = (_game.features & GF_16BIT_COLOR) ? 1280 : 1024; + _hePalettes = (uint8 *)malloc((_numPalettes + 1) * _hePaletteSlot); + memset(_hePalettes, 0, (_numPalettes + 1) * _hePaletteSlot); // Array 129 is set to base name len = strlen(_filenamePattern.pattern); -- cgit v1.2.3 From ccee18a489ece14c499c4e0c43aeb7fc216451fb Mon Sep 17 00:00:00 2001 From: Travis Howell Date: Fri, 5 Jun 2009 10:13:19 +0000 Subject: Cleanup. svn-id: r41195 --- engines/scumm/scumm.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'engines/scumm/scumm.cpp') diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp index 17ffc6e5b0..022eba1e5b 100644 --- a/engines/scumm/scumm.cpp +++ b/engines/scumm/scumm.cpp @@ -109,7 +109,9 @@ ScummEngine::ScummEngine(OSystem *syst, const DetectorResult &dr) _currentScript(0xFF), // Let debug() work on init stage _messageDialog(0), _pauseDialog(0), _scummMenuDialog(0), _versionDialog(0) { - if (_game.platform == Common::kPlatformNES) { + if (_game.features & GF_16BIT_COLOR) { + _gdi = new Gdi16Bit(this); + } else if (_game.platform == Common::kPlatformNES) { _gdi = new GdiNES(this); } else if (_game.version <= 1) { _gdi = new GdiV1(this); -- cgit v1.2.3 From 58a348fd18727aab57c0f4f8ab4cc5ad893ee795 Mon Sep 17 00:00:00 2001 From: Jody Northup Date: Wed, 10 Jun 2009 05:35:54 +0000 Subject: Scumm engine now dynamically requests 16-bit color based on game features, (using ad-hoc request format) svn-id: r41417 --- engines/scumm/scumm.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'engines/scumm/scumm.cpp') diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp index 0599139778..3d0a2d0bc2 100644 --- a/engines/scumm/scumm.cpp +++ b/engines/scumm/scumm.cpp @@ -1083,6 +1083,12 @@ Common::Error ScummEngine::init() { // CJK FT and DIG use usual NUT fonts, not FM-TOWNS ROM, so // there is no text surface for them. This takes that into account (_screenWidth * _textSurfaceMultiplier > 320)); + } else if (_game.features & GF_16BIT_COLOR) { + int format = Graphics::kFormatRGB555 | Graphics::kFormatRGB; + Common::List formatList; + formatList.push_back((Graphics::ColorFormat) format); + formatList.push_back(Graphics::kFormat8Bit); + initGraphics(_screenWidth, _screenHeight, _screenWidth > 320, formatList); } else { initGraphics(_screenWidth, _screenHeight, _screenWidth > 320); } -- cgit v1.2.3 From 6adbd0c41e79b5a21f0430e060347d4978e9ce78 Mon Sep 17 00:00:00 2001 From: Jody Northup Date: Thu, 11 Jun 2009 05:56:00 +0000 Subject: Renamed Graphics::ColorFormat to Graphics::ColorMode, streamlined enum by removing order section and temporarily removing kFormatARGB1555 Converted cursor code to make use of _screenFormat, instead of a parameter passed directly to it by the engine. Adjusted scumm engine to account for these changes. This should probably have been two separate commits, but the changes concern the same files... svn-id: r41443 --- engines/scumm/scumm.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'engines/scumm/scumm.cpp') diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp index 3d0a2d0bc2..0ebf832a37 100644 --- a/engines/scumm/scumm.cpp +++ b/engines/scumm/scumm.cpp @@ -1083,12 +1083,14 @@ Common::Error ScummEngine::init() { // CJK FT and DIG use usual NUT fonts, not FM-TOWNS ROM, so // there is no text surface for them. This takes that into account (_screenWidth * _textSurfaceMultiplier > 320)); +#ifdef ENABLE_16BIT } else if (_game.features & GF_16BIT_COLOR) { - int format = Graphics::kFormatRGB555 | Graphics::kFormatRGB; - Common::List formatList; - formatList.push_back((Graphics::ColorFormat) format); - formatList.push_back(Graphics::kFormat8Bit); + int format = Graphics::kFormatRGB555; + Common::List formatList; + formatList.push_back((Graphics::ColorMode) format); + formatList.push_back(Graphics::kFormatCLUT8); initGraphics(_screenWidth, _screenHeight, _screenWidth > 320, formatList); +#endif } else { initGraphics(_screenWidth, _screenHeight, _screenWidth > 320); } -- cgit v1.2.3 From 8d306ebccfa7e88b2e4f4635bff3987e550f98d3 Mon Sep 17 00:00:00 2001 From: Jody Northup Date: Mon, 15 Jun 2009 09:45:19 +0000 Subject: Added kUnsupportedColorMode error code brought Scumm engine and SDL backend into compliance with API outlined in http://scummvmupthorn09.wordpress.com/2009/06/14/how-this-is-going-to-work/ Provided convenient Graphics::PixelFormat constructors for ColorMode enums, and bitformat integers. Removed last vestiges (I think) of initial cursor hack. svn-id: r41539 --- engines/scumm/scumm.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'engines/scumm/scumm.cpp') diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp index 0ebf832a37..5fec6ec835 100644 --- a/engines/scumm/scumm.cpp +++ b/engines/scumm/scumm.cpp @@ -1085,11 +1085,10 @@ Common::Error ScummEngine::init() { (_screenWidth * _textSurfaceMultiplier > 320)); #ifdef ENABLE_16BIT } else if (_game.features & GF_16BIT_COLOR) { - int format = Graphics::kFormatRGB555; - Common::List formatList; - formatList.push_back((Graphics::ColorMode) format); - formatList.push_back(Graphics::kFormatCLUT8); - initGraphics(_screenWidth, _screenHeight, _screenWidth > 320, formatList); + Graphics::PixelFormat format = Graphics::kFormatRGB555; + initGraphics(_screenWidth, _screenHeight, _screenWidth > 320, format); + if (format != _system->getScreenFormat()) + return Common::kUnsupportedColorMode; #endif } else { initGraphics(_screenWidth, _screenHeight, _screenWidth > 320); -- cgit v1.2.3 From c97bfd16f94873a437cb92a30ebd11879f114e0c Mon Sep 17 00:00:00 2001 From: Jody Northup Date: Mon, 15 Jun 2009 10:10:22 +0000 Subject: made Graphics::PixelFormat(ColorMode) constructor explicit, removed Graphics::PixelFormat(int bitFormat) constructor that was never really implemented anyway svn-id: r41540 --- engines/scumm/scumm.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/scumm/scumm.cpp') diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp index 5fec6ec835..9469a15e54 100644 --- a/engines/scumm/scumm.cpp +++ b/engines/scumm/scumm.cpp @@ -1085,7 +1085,7 @@ Common::Error ScummEngine::init() { (_screenWidth * _textSurfaceMultiplier > 320)); #ifdef ENABLE_16BIT } else if (_game.features & GF_16BIT_COLOR) { - Graphics::PixelFormat format = Graphics::kFormatRGB555; + Graphics::PixelFormat format(Graphics::kFormatRGB555); initGraphics(_screenWidth, _screenHeight, _screenWidth > 320, format); if (format != _system->getScreenFormat()) return Common::kUnsupportedColorMode; -- cgit v1.2.3 From e74ba9af6b95c70cdcdbcf700e0964bf0be0fca1 Mon Sep 17 00:00:00 2001 From: Travis Howell Date: Mon, 15 Jun 2009 13:23:26 +0000 Subject: Add error if user attempt to play HE games using 16bit color, when 16bit support is disabled. svn-id: r41544 --- engines/scumm/scumm.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'engines/scumm/scumm.cpp') diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp index 9469a15e54..98da55d428 100644 --- a/engines/scumm/scumm.cpp +++ b/engines/scumm/scumm.cpp @@ -1083,12 +1083,14 @@ Common::Error ScummEngine::init() { // CJK FT and DIG use usual NUT fonts, not FM-TOWNS ROM, so // there is no text surface for them. This takes that into account (_screenWidth * _textSurfaceMultiplier > 320)); -#ifdef ENABLE_16BIT } else if (_game.features & GF_16BIT_COLOR) { +#ifdef ENABLE_16BIT Graphics::PixelFormat format(Graphics::kFormatRGB555); initGraphics(_screenWidth, _screenHeight, _screenWidth > 320, format); if (format != _system->getScreenFormat()) return Common::kUnsupportedColorMode; +#else + error("16bit color support is required for this game"); #endif } else { initGraphics(_screenWidth, _screenHeight, _screenWidth > 320); -- cgit v1.2.3 From 704386d3b09b68f96b6d4160a1a261e3e754f461 Mon Sep 17 00:00:00 2001 From: Jody Northup Date: Fri, 19 Jun 2009 09:28:55 +0000 Subject: Removed replaced Graphics::ColorMode enum type with factory methods for Graphics::PixelFormat. svn-id: r41662 --- engines/scumm/scumm.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/scumm/scumm.cpp') diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp index 98da55d428..75a03aae0f 100644 --- a/engines/scumm/scumm.cpp +++ b/engines/scumm/scumm.cpp @@ -1085,7 +1085,7 @@ Common::Error ScummEngine::init() { (_screenWidth * _textSurfaceMultiplier > 320)); } else if (_game.features & GF_16BIT_COLOR) { #ifdef ENABLE_16BIT - Graphics::PixelFormat format(Graphics::kFormatRGB555); + Graphics::PixelFormat format = Graphics::PixelFormat::createFormatRGB555(); initGraphics(_screenWidth, _screenHeight, _screenWidth > 320, format); if (format != _system->getScreenFormat()) return Common::kUnsupportedColorMode; -- cgit v1.2.3 From f7dd1c15ed38418a0371032966144eb6c2e004cb Mon Sep 17 00:00:00 2001 From: Jody Northup Date: Sat, 20 Jun 2009 05:23:09 +0000 Subject: renamed ENABLE_16BIT define to more accurate ENABLE_RGB_COLOR svn-id: r41696 --- engines/scumm/scumm.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/scumm/scumm.cpp') diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp index 75a03aae0f..cab8db2d45 100644 --- a/engines/scumm/scumm.cpp +++ b/engines/scumm/scumm.cpp @@ -1084,7 +1084,7 @@ Common::Error ScummEngine::init() { // there is no text surface for them. This takes that into account (_screenWidth * _textSurfaceMultiplier > 320)); } else if (_game.features & GF_16BIT_COLOR) { -#ifdef ENABLE_16BIT +#ifdef ENABLE_RGB_COLOR Graphics::PixelFormat format = Graphics::PixelFormat::createFormatRGB555(); initGraphics(_screenWidth, _screenHeight, _screenWidth > 320, format); if (format != _system->getScreenFormat()) -- cgit v1.2.3 From 853aec05ba4485f0bfc90e7515322dfd56a8d4af Mon Sep 17 00:00:00 2001 From: Jody Northup Date: Sat, 27 Jun 2009 05:58:44 +0000 Subject: changed initGraphics, and OSystem::initSize to take Graphics::PixelFormat * parameters instead of Graphics::PixelFormat parameters, to save unnecessary pixelformat initialization if ENABLE_RGB_COLOR is not set. svn-id: r41909 --- engines/scumm/scumm.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/scumm/scumm.cpp') diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp index cab8db2d45..fe38bbf82f 100644 --- a/engines/scumm/scumm.cpp +++ b/engines/scumm/scumm.cpp @@ -1086,7 +1086,7 @@ Common::Error ScummEngine::init() { } else if (_game.features & GF_16BIT_COLOR) { #ifdef ENABLE_RGB_COLOR Graphics::PixelFormat format = Graphics::PixelFormat::createFormatRGB555(); - initGraphics(_screenWidth, _screenHeight, _screenWidth > 320, format); + initGraphics(_screenWidth, _screenHeight, _screenWidth > 320, &format); if (format != _system->getScreenFormat()) return Common::kUnsupportedColorMode; #else -- cgit v1.2.3 From 2c5d11b67b35f93b2292c1ca56d0c9fc89608921 Mon Sep 17 00:00:00 2001 From: Jody Northup Date: Tue, 7 Jul 2009 07:50:40 +0000 Subject: Removed PixelFormat convenience constructors at behest of Max and Eugene. svn-id: r42207 --- engines/scumm/scumm.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'engines/scumm/scumm.cpp') diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp index c6ed7b71cc..347abee190 100644 --- a/engines/scumm/scumm.cpp +++ b/engines/scumm/scumm.cpp @@ -1085,7 +1085,8 @@ Common::Error ScummEngine::init() { (_screenWidth * _textSurfaceMultiplier > 320)); } else if (_game.features & GF_16BIT_COLOR) { #ifdef ENABLE_RGB_COLOR - Graphics::PixelFormat format = Graphics::PixelFormat::createFormatRGB555(); + Graphics::PixelFormat format = Graphics::PixelFormat(2, 3, 3, 3, 8, 10, 5, 0, 0) +; initGraphics(_screenWidth, _screenHeight, _screenWidth > 320, &format); if (format != _system->getScreenFormat()) return Common::kUnsupportedColorMode; -- cgit v1.2.3 From cdad3763dfbacf45599034358a32fc68032e1a30 Mon Sep 17 00:00:00 2001 From: Jody Northup Date: Thu, 9 Jul 2009 09:09:05 +0000 Subject: Corrected lingering formatting errors that were introduced by the find-and-replace assisted removal of Graphics::PixelFormat::createFormat functions. svn-id: r42281 --- engines/scumm/scumm.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'engines/scumm/scumm.cpp') diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp index 347abee190..57283c1fbe 100644 --- a/engines/scumm/scumm.cpp +++ b/engines/scumm/scumm.cpp @@ -1085,8 +1085,7 @@ Common::Error ScummEngine::init() { (_screenWidth * _textSurfaceMultiplier > 320)); } else if (_game.features & GF_16BIT_COLOR) { #ifdef ENABLE_RGB_COLOR - Graphics::PixelFormat format = Graphics::PixelFormat(2, 3, 3, 3, 8, 10, 5, 0, 0) -; + Graphics::PixelFormat format = Graphics::PixelFormat(2, 3, 3, 3, 8, 10, 5, 0, 0); initGraphics(_screenWidth, _screenHeight, _screenWidth > 320, &format); if (format != _system->getScreenFormat()) return Common::kUnsupportedColorMode; -- cgit v1.2.3 From cdf751accda346f5d96e3fdfa2fd4a1b92ed4d19 Mon Sep 17 00:00:00 2001 From: Jody Northup Date: Tue, 14 Jul 2009 08:27:36 +0000 Subject: changed generic Graphics::PixelFormat constructor to take xBits instead of xLoss. Modified OSystem_SDL::getSupportedFormats and ScummEngine::init to account for this change. svn-id: r42467 --- engines/scumm/scumm.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/scumm/scumm.cpp') diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp index 8d078f12d4..a00ace1f49 100644 --- a/engines/scumm/scumm.cpp +++ b/engines/scumm/scumm.cpp @@ -1085,7 +1085,7 @@ Common::Error ScummEngine::init() { (_screenWidth * _textSurfaceMultiplier > 320)); } else if (_game.features & GF_16BIT_COLOR) { #ifdef ENABLE_RGB_COLOR - Graphics::PixelFormat format = Graphics::PixelFormat(2, 3, 3, 3, 8, 10, 5, 0, 0); + Graphics::PixelFormat format = Graphics::PixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0); initGraphics(_screenWidth, _screenHeight, _screenWidth > 320, &format); if (format != _system->getScreenFormat()) return Common::kUnsupportedColorMode; -- cgit v1.2.3