X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fgame_sp%2FMainForm.c;h=c54bf63d21a3dbfd774b58b12ccd38dda746d2ce;hb=c6d59064aa782b8ad71eddac2797fdc50e4858f9;hp=ec0ba33dd22e0d562d1a7a49ccc9e380612246dc;hpb=97fb6c2a140f361991541bcf5a5c1e5d18deaf74;p=rocksndiamonds.git diff --git a/src/game_sp/MainForm.c b/src/game_sp/MainForm.c index ec0ba33d..c54bf63d 100644 --- a/src/game_sp/MainForm.c +++ b/src/game_sp/MainForm.c @@ -78,21 +78,27 @@ static void DrawFrame(int Delta) RX = FieldWidth - Delta; BY = FieldHeight - Delta; - DrawImage(LX, tY, imgFrameCorner); - DrawImage(LX, BY, imgFrameCorner); - DrawImage(RX, tY, imgFrameCorner); - DrawImage(RX, BY, imgFrameCorner); + DrawImage(LX, tY, (Delta > 0 ? imgFrameCorner : aniSpace)); + DrawImage(LX, BY, (Delta > 0 ? imgFrameCorner : aniSpace)); + DrawImage(RX, tY, (Delta > 0 ? imgFrameCorner : aniSpace)); + DrawImage(RX, BY, (Delta > 0 ? imgFrameCorner : aniSpace)); for (i = LX + 1; i <= RX - 1; i++) { - DrawImage(i, tY, imgFrameHorizontal); - DrawImage(i, BY, imgFrameHorizontal); + DrawImage(i, tY, (Delta > 0 ? imgFrameHorizontal : aniSpace)); + DrawImage(i, BY, (Delta > 0 ? imgFrameHorizontal : aniSpace)); } for (i = tY + 1; i <= BY - 1; i++) { - DrawImage(LX, i, imgFrameVertical); - DrawImage(RX, i, imgFrameVertical); + DrawImage(LX, i, (Delta > 0 ? imgFrameVertical : aniSpace)); + DrawImage(RX, i, (Delta > 0 ? imgFrameVertical : aniSpace)); + } + + if (Delta > 0) + { + // ... + // ClearRectangle(bitmap_db_field_sp, } } @@ -181,56 +187,28 @@ static void ReStretch() void SetScrollEdges() { -#if 1 - int border_offset = (menBorder ? 1 : 2); + int border1_offset = (menBorder ? 1 : 2); + int border2_offset = (menBorder ? 0 : TILESIZE / 2); + /* scroll correction for border frame (1 tile) or border element (2 tiles) */ ScrollMinX = 0; ScrollMinY = 0; - ScrollMaxX = (DisplayMaxX + border_offset) * BaseWidth - SXSIZE; - ScrollMaxY = (DisplayMaxY + border_offset) * BaseWidth - SYSIZE; - -#if 1 - if (!menBorder) - { - ScrollMinX += TILEX / 2; - ScrollMinY += TILEY / 2; - ScrollMaxX -= TILEX / 2; - ScrollMaxY -= TILEY / 2; - } -#if 1 - { - ScrollMinX -= game_sp.scroll_xoffset; - ScrollMaxX -= game_sp.scroll_xoffset; - ScrollMinY -= game_sp.scroll_yoffset; - ScrollMaxY -= game_sp.scroll_yoffset; - } -#else - if (1) - { - ScrollMinX -= TILEX / 2; - ScrollMaxX -= TILEX / 2; - ScrollMinY -= TILEY / 2; - ScrollMaxY -= TILEY / 2; - } -#endif -#else - if (!menBorder) - { - ScrollMinX += TILEX / 2; - ScrollMinY += TILEY / 2; - ScrollMaxX -= TILEX / 2; - ScrollMaxY -= TILEY / 2; - } -#endif - -#else - ScrollMinX = (int)(DisplayMinX - 0.5) * BaseWidth; - ScrollMinY = (int)(DisplayMinY - 0.5) * BaseWidth; - ScrollMaxX = (int)(DisplayMaxX + 1.5) * BaseWidth - SXSIZE; - ScrollMaxY = (int)(DisplayMaxY + 1.5) * BaseWidth - SYSIZE; -#endif - -#if 1 + ScrollMaxX = (DisplayMaxX + border1_offset) * TILEX - SXSIZE; + ScrollMaxY = (DisplayMaxY + border1_offset) * TILEY - SYSIZE; + + /* scroll correction for border element (half tile on left and right side) */ + ScrollMinX += border2_offset; + ScrollMinY += border2_offset; + ScrollMaxX -= border2_offset; + ScrollMaxY -= border2_offset; + + /* scroll correction for even number of visible tiles (half tile shifted) */ + ScrollMinX -= game_sp.scroll_xoffset; + ScrollMaxX -= game_sp.scroll_xoffset; + ScrollMinY -= game_sp.scroll_yoffset; + ScrollMaxY -= game_sp.scroll_yoffset; + +#if 0 printf("::: (%ld, %ld), (%ld, %ld) -> (%d, %d), (%d, %d)\n", DisplayMinX, DisplayMinY, DisplayMaxX, DisplayMaxY, ScrollMinX, ScrollMinY, ScrollMaxX, ScrollMaxY);