projects
/
rocksndiamonds.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
c398ca9
)
fixed bug with screen relocation on even sized playfield screen
author
Holger Schemel
<info@artsoft.org>
Tue, 12 Feb 2019 23:44:29 +0000
(
00:44
+0100)
committer
Holger Schemel
<info@artsoft.org>
Tue, 12 Feb 2019 23:44:29 +0000
(
00:44
+0100)
src/game.c
patch
|
blob
|
history
diff --git
a/src/game.c
b/src/game.c
index b843cbe7eba99fdda77cd76442011d9834d84221..b68f6be1e470eb6295ba830bc6f8c2611fc4f6e2 100644
(file)
--- a/
src/game.c
+++ b/
src/game.c
@@
-5273,11
+5273,8
@@
static void DrawRelocateScreen(int old_x, int old_y, int x, int y, int move_dir,
while (scroll_x != new_scroll_x || scroll_y != new_scroll_y)
{
while (scroll_x != new_scroll_x || scroll_y != new_scroll_y)
{
- int dx = 0, dy = 0;
- int fx = FX, fy = FY;
-
- dx = (new_scroll_x < scroll_x ? +1 : new_scroll_x > scroll_x ? -1 : 0);
- dy = (new_scroll_y < scroll_y ? +1 : new_scroll_y > scroll_y ? -1 : 0);
+ int dx = (new_scroll_x < scroll_x ? +1 : new_scroll_x > scroll_x ? -1 : 0);
+ int dy = (new_scroll_y < scroll_y ? +1 : new_scroll_y > scroll_y ? -1 : 0);
if (dx == 0 && dy == 0) // no scrolling needed at all
break;
if (dx == 0 && dy == 0) // no scrolling needed at all
break;
@@
-5285,14
+5282,19
@@
static void DrawRelocateScreen(int old_x, int old_y, int x, int y, int move_dir,
scroll_x -= dx;
scroll_y -= dy;
scroll_x -= dx;
scroll_y -= dy;
- fx += dx * TILEX / 2;
- fy += dy * TILEY / 2;
+ // set values for horizontal/vertical screen scrolling (half tile size)
+ int dir_x = (dx != 0 ? MV_HORIZONTAL : 0);
+ int dir_y = (dy != 0 ? MV_VERTICAL : 0);
+ int pos_x = dx * TILEX / 2;
+ int pos_y = dy * TILEY / 2;
+ int fx = getFieldbufferOffsetX_RND(dir_x, pos_x);
+ int fy = getFieldbufferOffsetY_RND(dir_y, pos_y);
ScrollLevel(dx, dy);
DrawAllPlayers();
// scroll in two steps of half tile size to make things smoother
ScrollLevel(dx, dy);
DrawAllPlayers();
// scroll in two steps of half tile size to make things smoother
- Blit
Bitmap(drawto_field, window, fx, fy, SXSIZE, SYSIZE, SX, SY
);
+ Blit
ScreenToBitmapExt_RND(window, fx, fy
);
// scroll second step to align at full tile size
BlitScreenToBitmap(window);
// scroll second step to align at full tile size
BlitScreenToBitmap(window);