From 8789ca10e306eddce62bcc2fea0734af3aea51fa Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Sat, 20 Dec 2003 13:43:40 +0000 Subject: 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 --- sword1/screen.cpp | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'sword1/screen.cpp') 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); -- cgit v1.2.3