From 7329e815afb67e35908ea8d5b559b9232fa630c1 Mon Sep 17 00:00:00 2001 From: Martin Kiewitz Date: Wed, 12 May 2010 21:28:38 +0000 Subject: SCI: header size within sci1.1+ views doesn't include the actual header size word, adjust accordingly (should make mac view support possible now) svn-id: r49019 --- engines/sci/graphics/view.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/engines/sci/graphics/view.cpp b/engines/sci/graphics/view.cpp index 716f886634..2f351a95c9 100644 --- a/engines/sci/graphics/view.cpp +++ b/engines/sci/graphics/view.cpp @@ -67,7 +67,7 @@ void GfxView::initData(GuiResourceId resourceId) { CelInfo *cel; uint16 celCount = 0; uint16 mirrorBits = 0; - uint16 palOffset = 0; + uint32 palOffset = 0; uint16 headerSize = 0; uint16 loopSize = 0, celSize = 0; int loopNo, celNo, EGAmapNr; @@ -166,15 +166,17 @@ void GfxView::initData(GuiResourceId resourceId) { } break; - case kViewVga11: // View-format SCI1.1 + case kViewVga11: // View-format SCI1.1+ // HeaderSize:WORD LoopCount:BYTE Unknown:BYTE Version:WORD Unknown:WORD PaletteOffset:WORD - headerSize = READ_LE_UINT16(_resourceData + 0); + headerSize = READ_LE_UINT16(_resourceData + 0) + 2; // headerSize is not part of the header, so its added + assert(headerSize >= 16); _loopCount = _resourceData[2]; - palOffset = READ_LE_UINT16(_resourceData + 8); + palOffset = READ_LE_UINT32(_resourceData + 8); // FIXME: After LoopCount there is another byte and its set for view 50 within Laura Bow 2 CD, check what it means loopData = _resourceData + headerSize; loopSize = _resourceData[12]; + assert(loopSize >= 16); celSize = _resourceData[13]; if (palOffset) { @@ -186,7 +188,7 @@ void GfxView::initData(GuiResourceId resourceId) { for (loopNo = 0; loopNo < _loopCount; loopNo++) { loopData = _resourceData + headerSize + (loopNo * loopSize); - seekEntry = loopData[2]; + seekEntry = loopData[0]; if (seekEntry != 255) { if (seekEntry >= _loopCount) error("Bad loop-pointer in sci 1.1 view"); @@ -196,10 +198,10 @@ void GfxView::initData(GuiResourceId resourceId) { _loop[loopNo].mirrorFlag = false; } - celCount = loopData[4]; + celCount = loopData[2]; _loop[loopNo].celCount = celCount; - celData = _resourceData + READ_LE_UINT16(loopData + 14); + celData = _resourceData + READ_LE_UINT32(loopData + 12); // read cel info _loop[loopNo].cel = new CelInfo[celCount]; -- cgit v1.2.3