From cf57f817b2a0ecbbf08bc985bd8fa4c12809a52d Mon Sep 17 00:00:00 2001 From: Martin Kiewitz Date: Tue, 19 Jan 2010 14:26:21 +0000 Subject: SCI: implemented priority bands support for sci1.1 picture resources, fixed lb2, kq6 svn-id: r47380 --- engines/sci/graphics/gfx.cpp | 20 ++++++++++++++++++++ engines/sci/graphics/gfx.h | 5 +++++ engines/sci/graphics/gui.cpp | 3 +++ engines/sci/graphics/picture.cpp | 3 +++ 4 files changed, 31 insertions(+) (limited to 'engines/sci/graphics') diff --git a/engines/sci/graphics/gfx.cpp b/engines/sci/graphics/gfx.cpp index 99aed7409a..3a3d39bc7d 100644 --- a/engines/sci/graphics/gfx.cpp +++ b/engines/sci/graphics/gfx.cpp @@ -68,6 +68,8 @@ void Gfx::init(Text *text) { _menuBarRect = Common::Rect(0, 0, _screen->getWidth(), 9); _EGAdrawingVisualize = false; + + priorityBandsMemoryActive = false; } void Gfx::purgeCache() { @@ -519,6 +521,24 @@ void Gfx::PriorityBandsInit(byte *data) { _priorityBands[i++] = inx; } +// Gets used by picture class to remember priority bands data from sci1.1 pictures that need to get applied when +// transitioning to that picture +void Gfx::PriorityBandsRemember(byte *data) { + int bandNo; + for (bandNo = 0; bandNo < 14; bandNo++) { + priorityBandsMemory[bandNo] = READ_LE_UINT16(data); + data += 2; + } + priorityBandsMemoryActive = true; +} + +void Gfx::PriorityBandsRecall() { + if (priorityBandsMemoryActive) { + PriorityBandsInit((byte *)&priorityBandsMemory); + priorityBandsMemoryActive = false; + } +} + byte Gfx::CoordinateToPriority(int16 y) { if (y < _priorityTop) return _priorityBands[_priorityTop]; diff --git a/engines/sci/graphics/gfx.h b/engines/sci/graphics/gfx.h index e9d2f72d2f..fb26790cb9 100644 --- a/engines/sci/graphics/gfx.h +++ b/engines/sci/graphics/gfx.h @@ -94,6 +94,8 @@ public: void PriorityBandsInit(int16 bandCount, int16 top, int16 bottom); void PriorityBandsInit(byte *data); + void PriorityBandsRemember(byte *data); + void PriorityBandsRecall(); byte CoordinateToPriority(int16 y); int16 PriorityToCoordinate(byte priority); @@ -128,6 +130,9 @@ private: // true means make EGA picture drawing visible bool _EGAdrawingVisualize; + + byte priorityBandsMemory[14]; + bool priorityBandsMemoryActive; }; } // End of namespace Sci diff --git a/engines/sci/graphics/gui.cpp b/engines/sci/graphics/gui.cpp index af405807be..ad31b7e7c0 100644 --- a/engines/sci/graphics/gui.cpp +++ b/engines/sci/graphics/gui.cpp @@ -634,6 +634,9 @@ void SciGui::animateShowPic() { _transitions->doit(picRect); if (previousCursorState) _cursor->show(); + + // We set SCI1.1 priority band information here + _gfx->PriorityBandsRecall(); } void SciGui::animate(reg_t listReference, bool cycle, int argc, reg_t *argv) { diff --git a/engines/sci/graphics/picture.cpp b/engines/sci/graphics/picture.cpp index 4dfa80ee11..9ac8021fe5 100644 --- a/engines/sci/graphics/picture.cpp +++ b/engines/sci/graphics/picture.cpp @@ -111,6 +111,9 @@ void SciGuiPicture::drawSci11Vga() { // process vector data drawVectorData(inbuffer + vector_dataPos, vector_size); + + // Remember priority band information for later + _gfx->PriorityBandsRemember(inbuffer + 40); } #ifdef ENABLE_SCI32 -- cgit v1.2.3