MOHAWK: Draw in the telescope combination in Catherine's journal

svn-id: r52215
This commit is contained in:
Matthew Hoops 2010-08-19 17:33:10 +00:00
parent 6dcdc72fda
commit ce9afcfab1
3 changed files with 33 additions and 4 deletions

View File

@ -672,6 +672,21 @@ void RivenGraphics::drawRect(Common::Rect rect, bool active) {
_vm->_system->unlockScreen();
}
void RivenGraphics::drawImageRect(uint16 id, Common::Rect srcRect, Common::Rect dstRect) {
// Draw tBMP id from srcRect to dstRect
ImageData *imageData = _bitmapDecoder->decodeImage(_vm->getRawData(ID_TBMP, id));
Graphics::Surface *surface = imageData->getSurface();
delete imageData;
assert(srcRect.width() == dstRect.width() && srcRect.height() == dstRect.height());
for (uint16 i = 0; i < srcRect.height(); i++)
memcpy(_mainScreen->getBasePtr(dstRect.left, i + dstRect.top), surface->getBasePtr(srcRect.left, i + srcRect.top), srcRect.width() * surface->bytesPerPixel);
surface->free();
delete surface;
}
LBGraphics::LBGraphics(MohawkEngine_LivingBooks *vm) : _vm(vm) {
_bmpDecoder = (_vm->getGameType() == GType_LIVINGBOOKSV1) ? new OldMohawkBitmap() : new MohawkBitmap();
_palette = new byte[256 * 4];
@ -707,7 +722,7 @@ void LBGraphics::copyImageToScreen(uint16 image, uint16 left, uint16 right) {
}
void LBGraphics::setPalette(uint16 id) {
// Old Living Books gamnes use the old CTBL-style palette format while newer
// Old Living Books games use the old CTBL-style palette format while newer
// games use the better tPAL format which can store partial palettes.
if (_vm->getGameType() == GType_LIVINGBOOKSV1) {

View File

@ -117,7 +117,7 @@ private:
uint16 type;
uint16 width;
uint16 height;
} *entries;
} *entries;
Common::File picFile;
} _pictureFile;
@ -147,6 +147,7 @@ public:
Common::Array<uint16> _activatedPLSTs;
void drawPLST(uint16 x);
void drawRect(Common::Rect rect, bool active);
void drawImageRect(uint16 id, Common::Rect srcRect, Common::Rect dstRect);
// Water Effect
void scheduleWaterEffect(uint16);
@ -181,7 +182,6 @@ private:
Graphics::Surface *_mainScreen;
bool _dirtyScreen;
Graphics::PixelFormat _pixelFormat;
byte findBlackIndex();
};
class LBGraphics {

View File

@ -340,7 +340,21 @@ void RivenExternal::xacathopenbook(uint16 argc, uint16 *argv) {
_vm->_gfx->drawPLST(51);
if (page == 28) {
// TODO: Draw telescope combination
// Draw the telescope combination
// The images for the numbers are tBMP's 13 through 17.
// The start point is at (156, 247)
uint32 teleCombo = *_vm->matchVarToString("tcorrectorder");
static const uint16 kNumberWidth = 32;
static const uint16 kNumberHeight = 25;
static const uint16 kDstX = 156;
static const uint16 kDstY = 247;
for (byte i = 0; i < 5; i++) {
uint16 offset = (getComboDigit(teleCombo, i) - 1) * kNumberWidth;
Common::Rect srcRect = Common::Rect(offset, 0, offset + kNumberWidth, kNumberHeight);
Common::Rect dstRect = Common::Rect(i * kNumberWidth + kDstX, kDstY, (i + 1) * kNumberWidth + kDstX, kDstY + kNumberHeight);
_vm->_gfx->drawImageRect(i + 13, srcRect, dstRect);
}
}
}