From: Holger Schemel Date: Mon, 11 Feb 2019 19:16:12 +0000 (+0100) Subject: fixed bug with even sized playfield screen and levels without border element X-Git-Tag: 4.1.2.0~20 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=83e4d8768e690c1013fa0be5b3063c92bcd16758;p=rocksndiamonds.git fixed bug with even sized playfield screen and levels without border element --- diff --git a/src/tools.c b/src/tools.c index 55f00ac3..c2b1ec15 100644 --- a/src/tools.c +++ b/src/tools.c @@ -217,9 +217,10 @@ static int getFieldbufferOffsetX_RND(void) if (EVEN(SCR_FIELDX)) { + int sbx_right = SBX_Right + (BorderElement != EL_EMPTY ? 1 : 0); int ffx = (scroll_x - SBX_Left) * TILEX_VAR + dx_var; - if (ffx < SBX_Right * TILEX_VAR + TILEX_VAR / 2 + TILEX_VAR) + if (ffx < sbx_right * TILEX_VAR + TILEX_VAR / 2) fx += dx_var - MIN(ffx, TILEX_VAR / 2) + TILEX_VAR; else fx += (dx_var > 0 ? TILEX_VAR : 0); @@ -249,9 +250,10 @@ static int getFieldbufferOffsetY_RND(void) if (EVEN(SCR_FIELDY)) { + int sby_lower = SBY_Lower + (BorderElement != EL_EMPTY ? 1 : 0); int ffy = (scroll_y - SBY_Upper) * TILEY_VAR + dy_var; - if (ffy < SBY_Lower * TILEY_VAR + TILEY_VAR / 2 + TILEY_VAR) + if (ffy < sby_lower * TILEY_VAR + TILEY_VAR / 2) fy += dy_var - MIN(ffy, TILEY_VAR / 2) + TILEY_VAR; else fy += (dy_var > 0 ? TILEY_VAR : 0);