From: Holger Schemel Date: Wed, 26 Feb 2020 07:59:24 +0000 (+0100) Subject: added drawing player twice when wrapping-around in fully visible levels X-Git-Tag: 4.2.0.0~65 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=b41cab308268b824218361bef5fbf48a54d5ce2f;p=rocksndiamonds.git added drawing player twice when wrapping-around in fully visible levels --- diff --git a/src/game_em/graphics.c b/src/game_em/graphics.c index 363cb9af..dab61eb7 100644 --- a/src/game_em/graphics.c +++ b/src/game_em/graphics.c @@ -368,7 +368,7 @@ static void animscreen(void) * handles transparency and movement */ -static void blitplayer(int nr) +static void blitplayer_ext(int nr) { int x1, y1, x2, y2; @@ -430,6 +430,28 @@ static void blitplayer(int nr) } } +static void blitplayer(int nr) +{ + blitplayer_ext(nr); + + /* check for wrap-around movement ... */ + if (ply[nr].x < lev.left || + ply[nr].x > lev.right - 1) + { + struct PLAYER ply_last = ply[nr]; + int dx = ply[nr].x - ply[nr].prev_x; + + ply[nr].x = (ply[nr].x < lev.left ? lev.right - 1 : lev.left); + ply[nr].prev_x = ply[nr].x - dx; + + /* draw player entering playfield from the opposite side */ + blitplayer_ext(nr); + + /* ... but keep the old player position until game logic */ + ply[nr] = ply_last; + } +} + void game_initscreen(void) { int player_nr;