X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fgame_em%2Fgraphics.c;h=a29d2e0e7208ab4d45cf1e7cad2a4bb1bd1311a0;hb=0c1799a5bef107aeb318bd618b06c7a255713ab7;hp=7f303a2a6510b78fda2ae33728a6037669e5cf6d;hpb=5eec6f3a02cb8a6171a37a209aae3e3665aff514;p=rocksndiamonds.git diff --git a/src/game_em/graphics.c b/src/game_em/graphics.c index 7f303a2a..a29d2e0e 100644 --- a/src/game_em/graphics.c +++ b/src/game_em/graphics.c @@ -441,16 +441,17 @@ static void blitplayer(int nr) ply[nr].x > lev.right - 1) { struct PLAYER ply_last = ply[nr]; + int direction = (ply[nr].x < lev.left ? -1 : 1); int dx = ply[nr].x - ply[nr].prev_x; - ply[nr].x = (ply[nr].x < lev.left ? lev.right - 1 : lev.left); + ply[nr].x += -direction * lev.width; ply[nr].prev_x = ply[nr].x - dx; if (!lev.infinite_true) { int dy = ply[nr].y - ply[nr].prev_y; - ply[nr].y += (ply[nr].x == lev.left ? 1 : -1); + ply[nr].y += direction; ply[nr].prev_y = ply[nr].y - dy; }