diff options
author | Torbjörn Andersson | 2003-12-20 13:43:40 +0000 |
---|---|---|
committer | Torbjörn Andersson | 2003-12-20 13:43:40 +0000 |
commit | 8789ca10e306eddce62bcc2fea0734af3aea51fa (patch) | |
tree | 773f720195fbf4744c819bf2b69f1aca4740b96e /sword1/screen.cpp | |
parent | 456f01b8fd8fe844b58c829d25d793adfbc33f3a (diff) | |
download | scummvm-rg350-8789ca10e306eddce62bcc2fea0734af3aea51fa.tar.gz scummvm-rg350-8789ca10e306eddce62bcc2fea0734af3aea51fa.tar.bz2 scummvm-rg350-8789ca10e306eddce62bcc2fea0734af3aea51fa.zip |
Modified the calculation of where to draw parallaxes to be more like the
one in Broken Sword II. At least the first room appears to behave like the
original now. (Except for a masking bug, which is almost certainly
unrelated to parallaxes.)
svn-id: r11781
Diffstat (limited to 'sword1/screen.cpp')
-rw-r--r-- | sword1/screen.cpp | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/sword1/screen.cpp b/sword1/screen.cpp index 80b61dc5ce..7d7f08a6eb 100644 --- a/sword1/screen.cpp +++ b/sword1/screen.cpp @@ -441,10 +441,21 @@ void SwordScreen::blitBlockClear(uint16 x, uint16 y, uint8 *data) { void SwordScreen::renderParallax(uint8 *data) { ParallaxHeader *header = (ParallaxHeader*)data; assert((FROM_LE_16(header->sizeX) >= SCREEN_WIDTH) && (FROM_LE_16(header->sizeY) >= SCREEN_DEPTH)); - double scrlfx = FROM_LE_16(header->sizeX) / ((double)_scrnSizeX ); - double scrlfy = FROM_LE_16(header->sizeY) / ((double)_scrnSizeY ); - uint16 scrlX = (uint16)(SwordLogic::_scriptVars[SCROLL_OFFSET_X] * scrlfx); - uint16 scrlY = (uint16)(SwordLogic::_scriptVars[SCROLL_OFFSET_Y] * scrlfy); + + double scrlfx, scrlfy; + uint16 scrlX, scrlY; + + if (_scrnSizeX != SCREEN_WIDTH) { + scrlfx = (FROM_LE_16(header->sizeX) - SCREEN_WIDTH) / ((double)(_scrnSizeX - SCREEN_WIDTH)); + scrlX = (uint16)(SwordLogic::_scriptVars[SCROLL_OFFSET_X] * scrlfx); + } else + scrlX = 0; + + if (_scrnSizeY != SCREEN_DEPTH) { + scrlfy = (FROM_LE_16(header->sizeY) - SCREEN_DEPTH) / ((double)(_scrnSizeY - SCREEN_DEPTH)); + scrlY = (uint16)(SwordLogic::_scriptVars[SCROLL_OFFSET_Y] * scrlfy); + } else + scrlY = 0; for (uint16 cnty = 0; cnty < SCREEN_DEPTH; cnty++) { uint8 *src = data + READ_LE_UINT32(header->lineIndexes + cnty + scrlY); |