Ticket #9171: myst-subimages.diff

File myst-subimages.diff, 3.2 KB (added by bgK, 14 years ago)

V2

  • engines/mohawk/graphics.cpp

     
    203203        if (surface) {
    204204                uint16 width = MIN<int>(surface->w, dest.width());
    205205                uint16 height = MIN<int>(surface->h, dest.height());
    206                 _vm->_system->copyRectToScreen((byte *)surface->getBasePtr(src.left, src.top), surface->pitch, dest.left, dest.top, width, height);
     206
     207                // Convert from bitmap coordinates to surface coordinates
     208                uint16 top = surface->h - src.top - height;
     209
     210                _vm->_system->copyRectToScreen((byte *)surface->getBasePtr(src.left, top), surface->pitch, dest.left, dest.top, width, height);
    207211                surface->free();
    208212                delete surface;
    209213        }
  • engines/mohawk/myst.cpp

     
    12691269                        _subImages[i].rect.right = rlstStream->readSint16LE();
    12701270                        _subImages[i].rect.bottom = rlstStream->readSint16LE();
    12711271                } else {
    1272                         _subImages[i].rect.top = 0;
    1273                         _subImages[i].rect.right = 0;
    1274                         _subImages[i].rect.bottom = 0;
     1272                        // Use the hotspot rect as the source rect since the subimage is fullscreen
     1273                        // Convert to bitmap coordinates (upside down)
     1274                        _subImages[i].rect.left = _rect.left;
     1275                        _subImages[i].rect.top = 333 - _rect.bottom;
     1276                        _subImages[i].rect.right = _rect.right;
     1277                        _subImages[i].rect.bottom = 333 - _rect.top;
    12751278                }
    12761279
    12771280                debugC(kDebugResource, "\twdib: %d", _subImages[i].wdib);
     
    13321335                } else
    13331336                        imageToDraw = _subImages[subImageId].wdib;
    13341337
    1335                 if (_subImages[subImageId].rect.left == -1)
    1336                         _vm->_gfx->copyImageSectionToScreen(imageToDraw, _rect, _rect);
    1337                         //vm->_gfx->copyImageToScreen(imageToDraw, Common::Rect(0, 0, 544, 333));
    1338                 // TODO: Think this is the case when the image is full screen.. need to modify graphics to add functions for returning size of image.
    1339                 // This is not right either...
    1340                 //else if (_rect.width() != _subImages[draw_subimage_id].rect.width() || _rect.height() != _subImages[draw_subimage_id].rect.height())
    1341                 // HACK: Hardcode cases of this until general rule can be ascertained
    1342                 //       These cases seem to have the source rect in the wdib with an vertical i.e. top+X, bottom+X where X is a constant, but could
    1343                 //       be negative, translations, when in fact both the source and dest should be equal...
    1344                 //else if ((vm->getCurStack() == kSeleniticStack   && vm->getCurCard() == 1155 && tmp == 1) || // X=
    1345                 //        (vm->getCurStack() == kSeleniticStack   && vm->getCurCard() == 1225 && tmp == 1) || // X=
    1346                 //        (vm->getCurStack() == kMystStack        && vm->getCurCard() == 4247 && tmp == 0) || // X=
    1347                 //        (vm->getCurStack() == kChannelwoodStack && vm->getCurCard() == 3161 && tmp == 0))   // X=
    1348                 //      vm->_gfx->copyImageSectionToScreen(imageToDraw, _rect, _rect);
    1349                 //    // TODO: Small vertical movement remains on change. Suspect off by one error from these to real
    1350                 //      //        solution.
    1351                 else
    1352                         _vm->_gfx->copyImageSectionToScreen(imageToDraw, _subImages[subImageId].rect, _rect);
     1338                _vm->_gfx->copyImageSectionToScreen(imageToDraw, _subImages[subImageId].rect, _rect);
    13531339        }
    13541340}
    13551341