diff options
author | Matthew Hoops | 2011-05-11 00:30:02 -0400 |
---|---|---|
committer | Matthew Hoops | 2011-05-11 00:30:28 -0400 |
commit | a1d41da096c0bcf502a85919cb1cb1ee471719c5 (patch) | |
tree | 8c51419daa486f1d4833757db4715dadab6c3497 /engines/sci/graphics | |
parent | accb0c2a5d0c9e7b353cda4b74f511a498ed8073 (diff) | |
parent | 33c3e19cea2a08fbf26ecbe940763e8ee1c37d28 (diff) | |
download | scummvm-rg350-a1d41da096c0bcf502a85919cb1cb1ee471719c5.tar.gz scummvm-rg350-a1d41da096c0bcf502a85919cb1cb1ee471719c5.tar.bz2 scummvm-rg350-a1d41da096c0bcf502a85919cb1cb1ee471719c5.zip |
Merge remote branch 'upstream/master' into t7g-ios
Conflicts:
audio/decoders/qdm2.h
common/util.cpp
engines/groovie/music.cpp
engines/groovie/resource.h
video/qt_decoder.cpp
video/qt_decoder.h
Diffstat (limited to 'engines/sci/graphics')
-rw-r--r-- | engines/sci/graphics/cursor.cpp | 52 | ||||
-rw-r--r-- | engines/sci/graphics/fontsjis.h | 2 | ||||
-rw-r--r-- | engines/sci/graphics/frameout.cpp | 12 | ||||
-rw-r--r-- | engines/sci/graphics/maciconbar.h | 2 | ||||
-rw-r--r-- | engines/sci/graphics/paint.cpp | 2 | ||||
-rw-r--r-- | engines/sci/graphics/paint16.cpp | 14 | ||||
-rw-r--r-- | engines/sci/graphics/paint32.cpp | 5 | ||||
-rw-r--r-- | engines/sci/graphics/palette.cpp | 2 | ||||
-rw-r--r-- | engines/sci/graphics/picture.cpp | 26 | ||||
-rw-r--r-- | engines/sci/graphics/portrait.cpp | 4 | ||||
-rw-r--r-- | engines/sci/graphics/screen.cpp | 12 | ||||
-rw-r--r-- | engines/sci/graphics/screen.h | 39 | ||||
-rw-r--r-- | engines/sci/graphics/transitions.cpp | 3 |
13 files changed, 80 insertions, 95 deletions
diff --git a/engines/sci/graphics/cursor.cpp b/engines/sci/graphics/cursor.cpp index 3b95a5c955..d4d7dcfd4f 100644 --- a/engines/sci/graphics/cursor.cpp +++ b/engines/sci/graphics/cursor.cpp @@ -25,11 +25,11 @@ #include "common/config-manager.h" #include "common/events.h" -#include "common/macresman.h" #include "common/memstream.h" #include "common/system.h" #include "common/util.h" #include "graphics/cursorman.h" +#include "graphics/maccursor.h" #include "sci/sci.h" #include "sci/event.h" @@ -473,49 +473,19 @@ void GfxCursor::kernelSetMacCursor(GuiResourceId viewNum, int loopNum, int celNu assert(resource); - if (resource->size == 32 * 2 + 4) { - // Mac CURS cursor - // See http://developer.apple.com/legacy/mac/library/documentation/mac/QuickDraw/QuickDraw-402.html - // for more information. - byte *cursorBitmap = new byte[16 * 16]; - byte *data = resource->data; - - // Get B&W data - for (byte i = 0; i < 32; i++) { - byte imageByte = *data++; - for (byte b = 0; b < 8; b++) - cursorBitmap[i * 8 + b] = (byte)((imageByte & (0x80 >> b)) > 0 ? 1 : 2); - } - - // Apply mask data - for (byte i = 0; i < 32; i++) { - byte imageByte = *data++; - for (byte b = 0; b < 8; b++) - if ((imageByte & (0x80 >> b)) == 0) - cursorBitmap[i * 8 + b] = 0; // Doesn't matter, just is transparent - } - - uint16 hotspotY = READ_BE_UINT16(data); - uint16 hotspotX = READ_BE_UINT16(data + 2); - - static const byte cursorPalette[] = { 0x00, 0x00, 0x00, 0xff, 0xff, 0xff }; - - CursorMan.replaceCursor(cursorBitmap, 16, 16, hotspotX, hotspotY, 0); - CursorMan.replaceCursorPalette(cursorPalette, 1, 2); + Common::MemoryReadStream resStream(resource->data, resource->size); + Graphics::MacCursor *macCursor = new Graphics::MacCursor(); - delete[] cursorBitmap; - } else { - // Mac crsr cursor - byte *cursorBitmap, *palette; - int width, height, hotspotX, hotspotY, palSize, keycolor; - Common::MemoryReadStream resStream(resource->data, resource->size); - Common::MacResManager::convertCrsrCursor(&resStream, &cursorBitmap, width, height, hotspotX, hotspotY, keycolor, true, &palette, palSize); - CursorMan.replaceCursor(cursorBitmap, width, height, hotspotX, hotspotY, keycolor); - CursorMan.replaceCursorPalette(palette, 0, palSize); - delete[] cursorBitmap; - delete[] palette; + if (!macCursor->readFromStream(resStream)) { + warning("Failed to load Mac cursor %d", viewNum); + return; } + CursorMan.replaceCursor(macCursor->getSurface(), macCursor->getWidth(), macCursor->getHeight(), + macCursor->getHotspotX(), macCursor->getHotspotY(), macCursor->getKeyColor()); + CursorMan.replaceCursorPalette(macCursor->getPalette(), 0, 256); + + delete macCursor; kernelShow(); } diff --git a/engines/sci/graphics/fontsjis.h b/engines/sci/graphics/fontsjis.h index 684e6cac5e..5538b5c2c5 100644 --- a/engines/sci/graphics/fontsjis.h +++ b/engines/sci/graphics/fontsjis.h @@ -29,7 +29,7 @@ #include "sci/graphics/helpers.h" namespace Graphics { - class FontSJIS; +class FontSJIS; } namespace Sci { diff --git a/engines/sci/graphics/frameout.cpp b/engines/sci/graphics/frameout.cpp index dd55b3b060..7fafe843fd 100644 --- a/engines/sci/graphics/frameout.cpp +++ b/engines/sci/graphics/frameout.cpp @@ -23,9 +23,15 @@ * */ -#include "common/util.h" -#include "common/stack.h" -#include "graphics/primitives.h" +#include "common/algorithm.h" +#include "common/events.h" +#include "common/keyboard.h" +#include "common/list_intern.h" +#include "common/str.h" +#include "common/system.h" +#include "common/textconsole.h" +#include "engines/engine.h" +#include "graphics/surface.h" #include "sci/sci.h" #include "sci/engine/kernel.h" diff --git a/engines/sci/graphics/maciconbar.h b/engines/sci/graphics/maciconbar.h index 3ac5475147..72609d19ab 100644 --- a/engines/sci/graphics/maciconbar.h +++ b/engines/sci/graphics/maciconbar.h @@ -31,7 +31,7 @@ #include "sci/engine/vm.h" namespace Graphics { - struct Surface; +struct Surface; } namespace Sci { diff --git a/engines/sci/graphics/paint.cpp b/engines/sci/graphics/paint.cpp index c347da3c0f..27a0bdfc44 100644 --- a/engines/sci/graphics/paint.cpp +++ b/engines/sci/graphics/paint.cpp @@ -23,8 +23,6 @@ * */ -#include "common/util.h" -#include "common/stack.h" #include "graphics/primitives.h" #include "sci/sci.h" diff --git a/engines/sci/graphics/paint16.cpp b/engines/sci/graphics/paint16.cpp index ff738fc3b9..5172f7cdc0 100644 --- a/engines/sci/graphics/paint16.cpp +++ b/engines/sci/graphics/paint16.cpp @@ -23,11 +23,6 @@ * */ -#include "common/util.h" -#include "common/stack.h" -#include "common/system.h" -#include "graphics/primitives.h" - #include "sci/sci.h" #include "sci/engine/features.h" #include "sci/engine/state.h" @@ -302,6 +297,11 @@ void GfxPaint16::bitsShow(const Common::Rect &rect) { return; _ports->offsetRect(workerRect); + + // We adjust the left/right coordinates to even coordinates + workerRect.left &= 0xFFFE; // round down + workerRect.right = (workerRect.right + 1) & 0xFFFE; // round up + _screen->copyRectToScreen(workerRect); } @@ -472,6 +472,7 @@ void GfxPaint16::kernelGraphRedrawBox(Common::Rect rect) { #define SCI_DISPLAY_RESTOREUNDER 108 #define SCI_DISPLAY_DUMMY1 114 // used in longbow demo/qfg1 ega demo, not supported in sierra sci - no parameters #define SCI_DISPLAY_DUMMY2 115 // used in longbow demo, not supported in sierra sci - has 1 parameter +#define SCI_DISPLAY_DUMMY3 117 // used in qfg1 ega demo, not supported in sierra sci - no parameters #define SCI_DISPLAY_DONTSHOWBITS 121 reg_t GfxPaint16::kernelDisplay(const char *text, int argc, reg_t *argv) { @@ -542,9 +543,10 @@ reg_t GfxPaint16::kernelDisplay(const char *text, int argc, reg_t *argv) { break; // 2 Dummy functions, longbow-demo is using those several times but sierra sci doesn't support them at all - // The Quest for Glory 1 EGA demo also calls kDisplay(114) + // The Quest for Glory 1 EGA demo also calls kDisplay(114) and kDisplay(117) case SCI_DISPLAY_DUMMY1: case SCI_DISPLAY_DUMMY2: + case SCI_DISPLAY_DUMMY3: if (!g_sci->isDemo() || (g_sci->getGameId() != GID_LONGBOW && g_sci->getGameId() != GID_QFG1)) error("Unknown kDisplay argument %d", displayArg.offset); if (displayArg.offset == SCI_DISPLAY_DUMMY2) { diff --git a/engines/sci/graphics/paint32.cpp b/engines/sci/graphics/paint32.cpp index 69a278eb8b..f277436631 100644 --- a/engines/sci/graphics/paint32.cpp +++ b/engines/sci/graphics/paint32.cpp @@ -23,11 +23,6 @@ * */ -#include "common/util.h" -#include "common/stack.h" - -#include "graphics/primitives.h" - #include "sci/sci.h" #include "sci/engine/state.h" #include "sci/engine/selector.h" diff --git a/engines/sci/graphics/palette.cpp b/engines/sci/graphics/palette.cpp index 0433479a09..42551e9369 100644 --- a/engines/sci/graphics/palette.cpp +++ b/engines/sci/graphics/palette.cpp @@ -28,6 +28,8 @@ #include "common/util.h" #include "common/system.h" +#include "graphics/palette.h" + #include "sci/sci.h" #include "sci/engine/state.h" #include "sci/graphics/cache.h" diff --git a/engines/sci/graphics/picture.cpp b/engines/sci/graphics/picture.cpp index 82aae5399f..8cdd46268a 100644 --- a/engines/sci/graphics/picture.cpp +++ b/engines/sci/graphics/picture.cpp @@ -509,10 +509,12 @@ void GfxPicture::drawVectorData(byte *data, int dataSize) { memcpy(&EGApriority, &vector_defaultEGApriority, sizeof(vector_defaultEGApriority)); if (g_sci->getGameId() == GID_ICEMAN) { - // WORKAROUND: we remove certain visual&priority lines in underwater rooms of iceman, when not dithering the - // picture. Normally those lines aren't shown, because they share the same color as the dithered - // fill color combination. When not dithering, those lines would appear and get distracting. - if ((_screen->getUnditherState()) && ((_resourceId >= 53 && _resourceId <= 58) || (_resourceId == 61))) + // WORKAROUND: we remove certain visual&priority lines in underwater + // rooms of iceman, when not dithering the picture. Normally those + // lines aren't shown, because they share the same color as the + // dithered fill color combination. When not dithering, those lines + // would appear and get distracting. + if ((_screen->isUnditheringEnabled()) && ((_resourceId >= 53 && _resourceId <= 58) || (_resourceId == 61))) icemanDrawFix = true; } if (g_sci->getGameId() == GID_KQ5) { @@ -618,14 +620,17 @@ void GfxPicture::drawVectorData(byte *data, int dataSize) { } break; - // Pattern opcodes are handled in sierra sci1.1+ as actual NOPs and normally they definitely should not occur - // inside picture data for such games + // Pattern opcodes are handled in sierra sci1.1+ as actual NOPs and + // normally they definitely should not occur inside picture data for + // such games. case PIC_OP_SET_PATTERN: if (_resourceType >= SCI_PICTURE_TYPE_SCI11) { if (g_sci->getGameId() == GID_SQ4) { - // WORKAROUND: For SQ4 / for some pictures handle this like a terminator - // This picture includes garbage data, first a set pattern w/o parameter and then short pattern - // I guess that garbage is a left over from the sq4-floppy (sci1) to sq4-cd (sci1.1) conversion + // WORKAROUND: For SQ4 / for some pictures handle this like + // a terminator. This picture includes garbage data, first a + // set pattern w/o parameter and then short pattern. I guess + // that garbage is a left over from the sq4-floppy (sci1) to + // sq4-cd (sci1.1) conversion. switch (_resourceId) { case 35: case 381: @@ -857,7 +862,8 @@ void GfxPicture::vectorGetPatternTexture(byte *data, int &curPos, int16 pattern_ } } -// Do not replace w/ some generic code. This algo really needs to behave exactly as the one from sierra +// WARNING: Do not replace the following code with something else, like generic +// code. This algo really needs to behave exactly as the one from sierra. void GfxPicture::vectorFloodFill(int16 x, int16 y, byte color, byte priority, byte control) { Port *curPort = _ports->getPort(); Common::Stack<Common::Point> stack; diff --git a/engines/sci/graphics/portrait.cpp b/engines/sci/graphics/portrait.cpp index 6e9df2f019..3f9ebaa07a 100644 --- a/engines/sci/graphics/portrait.cpp +++ b/engines/sci/graphics/portrait.cpp @@ -24,9 +24,7 @@ */ #include "common/archive.h" -#include "common/util.h" -#include "common/stack.h" -#include "graphics/primitives.h" +#include "common/system.h" #include "sci/sci.h" #include "sci/event.h" diff --git a/engines/sci/graphics/screen.cpp b/engines/sci/graphics/screen.cpp index f619780c7c..56e6759fac 100644 --- a/engines/sci/graphics/screen.cpp +++ b/engines/sci/graphics/screen.cpp @@ -111,7 +111,7 @@ GfxScreen::GfxScreen(ResourceManager *resMan) : _resMan(resMan) { _picNotValid = 0; _picNotValidSci11 = 0; - _unditherState = true; + _unditheringEnabled = true; _fontIsUpscaled = false; if (_resMan->getViewType() != kViewEga) { @@ -560,7 +560,7 @@ void GfxScreen::dither(bool addToFlag) { byte *visualPtr = _visualScreen; byte *displayPtr = _displayScreen; - if (!_unditherState) { + if (!_unditheringEnabled) { // Do dithering on visual and display-screen for (y = 0; y < _height; y++) { for (x = 0; x < _width; x++) { @@ -624,13 +624,13 @@ void GfxScreen::ditherForceDitheredColor(byte color) { _ditheredPicColors[color] = 256; } -void GfxScreen::debugUnditherSetState(bool flag) { - _unditherState = flag; +void GfxScreen::enableUndithering(bool flag) { + _unditheringEnabled = flag; } int16 *GfxScreen::unditherGetDitheredBgColors() { - if (_unditherState) - return (int16 *)&_ditheredPicColors; + if (_unditheringEnabled) + return _ditheredPicColors; else return NULL; } diff --git a/engines/sci/graphics/screen.h b/engines/sci/graphics/screen.h index 89ad52e0ac..bfe0a50b81 100644 --- a/engines/sci/graphics/screen.h +++ b/engines/sci/graphics/screen.h @@ -95,9 +95,10 @@ public: return _upscaledHires; } - bool getUnditherState() const { - return _unditherState; + bool isUnditheringEnabled() const { + return _unditheringEnabled; } + void enableUndithering(bool flag); void putKanjiChar(Graphics::FontSJIS *commonFont, int16 x, int16 y, uint16 chr, byte color); byte getVisual(int x, int y); @@ -119,7 +120,6 @@ public: // Force a color combination as a dithered color void ditherForceDitheredColor(byte color); - void debugUnditherSetState(bool flag); int16 *unditherGetDitheredBgColors(); void debugShowMap(int mapNo); @@ -151,7 +151,10 @@ private: void setVerticalShakePos(uint16 shakePos); - bool _unditherState; + /** + * If this flag is true, undithering is enabled, otherwise disabled. + */ + bool _unditheringEnabled; int16 _ditheredPicColors[DITHERED_BG_COLORS_SIZE]; // These screens have the real resolution of the game engine (320x200 for @@ -161,13 +164,13 @@ private: byte *_priorityScreen; byte *_controlScreen; - // This screen is the one that is actually displayed to the user. It may be - // 640x400 for japanese SCI1 games. SCI0 games may be undithered in here. - // Only read from this buffer for Save/ShowBits usage. + /** + * This screen is the one that is actually displayed to the user. It may be + * 640x400 for japanese SCI1 games. SCI0 games may be undithered in here. + * Only read from this buffer for Save/ShowBits usage. + */ byte *_displayScreen; - Common::Rect getScaledRect(Common::Rect rect); - ResourceManager *_resMan; /** @@ -176,16 +179,22 @@ private: */ byte *_activeScreen; - // This variable defines, if upscaled hires is active and what upscaled mode - // is used. + /** + * This variable defines, if upscaled hires is active and what upscaled mode + * is used. + */ GfxScreenUpscaledMode _upscaledHires; - // This here holds a translation for vertical coordinates between native - // (visual) and actual (display) screen. + /** + * This here holds a translation for vertical coordinates between native + * (visual) and actual (display) screen. + */ int _upscaledMapping[SCI_SCREEN_UPSCALEDMAXHEIGHT + 1]; - // This defines whether or not the font we're drawing is already scaled - // to the screen size (and we therefore should not upscale it ourselves). + /** + * This defines whether or not the font we're drawing is already scaled + * to the screen size (and we therefore should not upscale it ourselves). + */ bool _fontIsUpscaled; uint16 getLowResScreenHeight(); diff --git a/engines/sci/graphics/transitions.cpp b/engines/sci/graphics/transitions.cpp index fb124055d6..dde1be13ab 100644 --- a/engines/sci/graphics/transitions.cpp +++ b/engines/sci/graphics/transitions.cpp @@ -24,9 +24,8 @@ */ #include "common/events.h" -#include "common/util.h" -#include "common/stack.h" #include "common/system.h" +#include "graphics/palette.h" #include "graphics/surface.h" #include "sci/sci.h" |