diff options
author | Martin Kiewitz | 2010-07-22 10:24:08 +0000 |
---|---|---|
committer | Martin Kiewitz | 2010-07-22 10:24:08 +0000 |
commit | 15ef4b23a0f864a8788be57a118f75bdc6e383fa (patch) | |
tree | 1cbe4f9ca2aeeda10801d12476c46d42249f8e0b /engines/sci | |
parent | 66115d697e78c3ff3d9e253c49174e46f50bd62d (diff) | |
download | scummvm-rg350-15ef4b23a0f864a8788be57a118f75bdc6e383fa.tar.gz scummvm-rg350-15ef4b23a0f864a8788be57a118f75bdc6e383fa.tar.bz2 scummvm-rg350-15ef4b23a0f864a8788be57a118f75bdc6e383fa.zip |
SCI: some work on priority in sci32
svn-id: r51134
Diffstat (limited to 'engines/sci')
-rw-r--r-- | engines/sci/engine/selector.cpp | 2 | ||||
-rw-r--r-- | engines/sci/engine/selector.h | 3 | ||||
-rw-r--r-- | engines/sci/graphics/frameout.cpp | 61 | ||||
-rw-r--r-- | engines/sci/graphics/picture.cpp | 37 | ||||
-rw-r--r-- | engines/sci/graphics/picture.h | 5 |
5 files changed, 83 insertions, 25 deletions
diff --git a/engines/sci/engine/selector.cpp b/engines/sci/engine/selector.cpp index c807e88d5f..befa7c38a2 100644 --- a/engines/sci/engine/selector.cpp +++ b/engines/sci/engine/selector.cpp @@ -178,6 +178,8 @@ void Kernel::mapSelectors() { FIND_SELECTOR(dimmed); FIND_SELECTOR(fore); FIND_SELECTOR(back); + FIND_SELECTOR(fixPriority); + FIND_SELECTOR(mirrored); #endif } diff --git a/engines/sci/engine/selector.h b/engines/sci/engine/selector.h index c3428c1ed7..7e13c18e4a 100644 --- a/engines/sci/engine/selector.h +++ b/engines/sci/engine/selector.h @@ -142,6 +142,9 @@ struct SelectorCache { Selector fore; Selector back; Selector dimmed; + + Selector fixPriority; + Selector mirrored; #endif }; diff --git a/engines/sci/graphics/frameout.cpp b/engines/sci/graphics/frameout.cpp index d540b44557..5ec29887db 100644 --- a/engines/sci/graphics/frameout.cpp +++ b/engines/sci/graphics/frameout.cpp @@ -157,6 +157,7 @@ void GfxFrameout::kernelFrameout() { GuiResourceId planePictureNr = readSelectorValue(_segMan, planeObject, SELECTOR(picture)); GfxPicture *planePicture = 0; int16 planePictureCels = 0; + bool planePictureMirrored = false; if ((planePictureNr != 0xFFFF) && (planePictureNr != 0xFFFE)) { planePicture = new GfxPicture(_resMan, _coordAdjuster, 0, _screen, _palette, planePictureNr, false); @@ -164,6 +165,9 @@ void GfxFrameout::kernelFrameout() { _coordAdjuster->pictureSetDisplayArea(planeRect); _palette->drewPicture(planePictureNr); + + if (readSelectorValue(_segMan, planeObject, SELECTOR(mirrored))) + planePictureMirrored = true; } // Fill our itemlist for this plane @@ -191,6 +195,9 @@ void GfxFrameout::kernelFrameout() { itemEntry->y = readSelectorValue(_segMan, itemObject, SELECTOR(y)); itemEntry->z = readSelectorValue(_segMan, itemObject, SELECTOR(z)); itemEntry->priority = readSelectorValue(_segMan, itemObject, SELECTOR(priority)); + if (readSelectorValue(_segMan, itemObject, SELECTOR(fixPriority)) == 0) + itemEntry->priority = itemEntry->y; + if (gameId == GID_GK1) { if ((itemEntry->viewId == 11000) && (itemEntry->loopNo == 0) && (itemEntry->celNo == 0) && (itemEntry->priority == 1)) { itemEntry->priority = 0; // HACK for gk1 hires main menu @@ -209,35 +216,60 @@ void GfxFrameout::kernelFrameout() { itemEntry->y += planeRect.top; itemEntry->x += planeRect.left; - if (!(itemEntry->signal & 0x0010)) { // kSignalFixedPriority - // TODO: Change priority of this item - } - itemList.push_back(itemEntry); itemEntry++; itemCount++; } } + FrameoutEntry *pictureCels = NULL; + + if (planePicture) { + // Show base picture + planePicture->drawSci32Vga(0, 0, 0, planePictureMirrored); + // Allocate memory for picture cels + pictureCels = (FrameoutEntry *)malloc(planePicture->getSci32celCount() * sizeof(FrameoutEntry)); + // Add following cels to the itemlist + FrameoutEntry *picEntry = pictureCels; + for (int pictureCelNr = 1; pictureCelNr < planePictureCels; pictureCelNr++) { + picEntry->celNo = pictureCelNr; + picEntry->object = NULL_REG; + picEntry->y = planePicture->getSci32celY(pictureCelNr); + picEntry->x = planePicture->getSci32celX(pictureCelNr); + + int16 celHeight = planePicture->getSci32celHeight(pictureCelNr); + if (_screen->getWidth() > 320) + celHeight = celHeight / 2; + + picEntry->priority = picEntry->y + celHeight; + + picEntry->y = ((picEntry->y * _screen->getHeight()) / planeResY); + picEntry->x = ((picEntry->x * _screen->getWidth()) / planeResX); + + itemList.push_back(picEntry); + picEntry++; + } + } + // Now sort our itemlist Common::sort(itemList.begin(), itemList.end(), sortHelper); // Now display itemlist - int16 planePictureCel = 0; itemEntry = itemData; for (FrameoutList::iterator listIterator = itemList.begin(); listIterator != itemList.end(); listIterator++) { itemEntry = *listIterator; - if (planePicture) { - while ((planePictureCel <= itemEntry->priority) && (planePictureCel < planePictureCels)) { - planePicture->drawSci32Vga(planePictureCel, planeResY, planeResX); - planePictureCel++; - } - } - if (itemEntry->viewId != 0xFFFF) { + if (itemEntry->object.isNull()) { + // Picture cel data + planePicture->drawSci32Vga(itemEntry->celNo, itemEntry->x, itemEntry->y, planePictureMirrored); +// warning("picture cel %d %d", itemEntry->celNo, itemEntry->priority); + + } else if (itemEntry->viewId != 0xFFFF) { GfxView *view = _cache->getView(itemEntry->viewId); +// warning("view %s %d", _segMan->getObjectName(itemEntry->object), itemEntry->priority); + if (view->isSci2Hires()) _screen->adjustToUpscaledCoordinates(itemEntry->y, itemEntry->x); @@ -301,10 +333,7 @@ void GfxFrameout::kernelFrameout() { } if (planePicture) { - while (planePictureCel < planePictureCels) { - planePicture->drawSci32Vga(planePictureCel, planeResY, planeResX); - planePictureCel++; - } + free(pictureCels); delete planePicture; planePicture = 0; } diff --git a/engines/sci/graphics/picture.cpp b/engines/sci/graphics/picture.cpp index df95347609..2b4ceac97b 100644 --- a/engines/sci/graphics/picture.cpp +++ b/engines/sci/graphics/picture.cpp @@ -131,7 +131,28 @@ int16 GfxPicture::getSci32celCount() { return inbuffer[2]; } -void GfxPicture::drawSci32Vga(int16 celNo, uint16 planeResY, uint16 planeResX) { +int16 GfxPicture::getSci32celY(int16 celNo) { + byte *inbuffer = _resource->data; + int header_size = READ_LE_UINT16(inbuffer); + int cel_headerPos = header_size + 42 * celNo; + return READ_LE_UINT16(inbuffer + cel_headerPos + 40); +} + +int16 GfxPicture::getSci32celX(int16 celNo) { + byte *inbuffer = _resource->data; + int header_size = READ_LE_UINT16(inbuffer); + int cel_headerPos = header_size + 42 * celNo; + return READ_LE_UINT16(inbuffer + cel_headerPos + 38); +} + +int16 GfxPicture::getSci32celHeight(int16 celNo) { + byte *inbuffer = _resource->data; + int header_size = READ_LE_UINT16(inbuffer); + int cel_headerPos = header_size + 42 * celNo; + return READ_LE_UINT16(inbuffer + cel_headerPos + 2); +} + +void GfxPicture::drawSci32Vga(int16 celNo, int16 callerX, int16 callerY, bool mirrored) { byte *inbuffer = _resource->data; int size = _resource->size; int header_size = READ_LE_UINT16(inbuffer); @@ -139,11 +160,11 @@ void GfxPicture::drawSci32Vga(int16 celNo, uint16 planeResY, uint16 planeResX) { int celCount = inbuffer[2]; int cel_headerPos = header_size; int cel_RlePos, cel_LiteralPos; - int cel_relXpos, cel_relYpos; +// int cel_relXpos, cel_relYpos; Palette palette; // HACK - _mirroredFlag = false; + _mirroredFlag = mirrored; _addToFlag = false; _resourceType = SCI_PICTURE_TYPE_SCI32; @@ -160,14 +181,14 @@ void GfxPicture::drawSci32Vga(int16 celNo, uint16 planeResY, uint16 planeResX) { while (celCount > 0) { cel_RlePos = READ_LE_UINT32(inbuffer + cel_headerPos + 24); cel_LiteralPos = READ_LE_UINT32(inbuffer + cel_headerPos + 28); - cel_relXpos = READ_LE_UINT16(inbuffer + cel_headerPos + 38); - cel_relYpos = READ_LE_UINT16(inbuffer + cel_headerPos + 40); + //cel_relXpos = READ_LE_UINT16(inbuffer + cel_headerPos + 38); + //cel_relYpos = READ_LE_UINT16(inbuffer + cel_headerPos + 40); // This is really weird, adjusting picture data to plane resolution - why... - cel_relYpos = ((cel_relYpos * g_sci->_gfxScreen->getHeight()) / planeResY); - cel_relXpos = ((cel_relXpos * g_sci->_gfxScreen->getWidth()) / planeResX); + //cel_relYpos = ((cel_relYpos * g_sci->_gfxScreen->getHeight()) / planeResY); + //cel_relXpos = ((cel_relXpos * g_sci->_gfxScreen->getWidth()) / planeResX); - drawCelData(inbuffer, size, cel_headerPos, cel_RlePos, cel_LiteralPos, cel_relXpos, cel_relYpos); + drawCelData(inbuffer, size, cel_headerPos, cel_RlePos, cel_LiteralPos, callerX, callerY); cel_headerPos += 42; celCount--; } diff --git a/engines/sci/graphics/picture.h b/engines/sci/graphics/picture.h index b5636d5bd8..571d291442 100644 --- a/engines/sci/graphics/picture.h +++ b/engines/sci/graphics/picture.h @@ -56,7 +56,10 @@ public: #ifdef ENABLE_SCI32 int16 getSci32celCount(); - void drawSci32Vga(int16 celNo, uint16 planeResY, uint16 planeResX); + int16 getSci32celY(int16 celNo); + int16 getSci32celX(int16 celNo); + int16 getSci32celHeight(int16 celNo); + void drawSci32Vga(int16 celNo, int16 callerX, int16 callerY, bool mirrored); #endif private: |