X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;ds=sidebyside;f=src%2Ftools.c;h=5bba1c107785e4bfbb5dc8dc1c70e03ca7037f4a;hb=1c3065c351ef8a8637af5540dea2b39c1d86e80f;hp=b29cb819122cbc032a244d5f96c1f78151120222;hpb=6c244f56b4911dc83930193a43497388b91696af;p=rocksndiamonds.git diff --git a/src/tools.c b/src/tools.c index b29cb819..5bba1c10 100644 --- a/src/tools.c +++ b/src/tools.c @@ -575,9 +575,9 @@ void DrawPlayer(struct PlayerInfo *player) if (player_is_moving) { - if (Store[last_jx][last_jy] && IS_DRAWABLE(last_element)) + if (Back[last_jx][last_jy] && IS_DRAWABLE(last_element)) { - DrawLevelElement(last_jx, last_jy, Store[last_jx][last_jy]); + DrawLevelElement(last_jx, last_jy, Back[last_jx][last_jy]); if (last_element == EL_DYNAMITE_ACTIVE || last_element == EL_SP_DISK_RED_ACTIVE) @@ -615,8 +615,8 @@ void DrawPlayer(struct PlayerInfo *player) /* draw things behind the player, if needed */ /* ----------------------------------------------------------------------- */ - if (Store[jx][jy]) - DrawLevelElement(jx, jy, Store[jx][jy]); + if (Back[jx][jy]) + DrawLevelElement(jx, jy, Back[jx][jy]); else if (IS_ACTIVE_BOMB(element)) DrawLevelElement(jx, jy, EL_EMPTY); else @@ -745,16 +745,20 @@ void DrawPlayer(struct PlayerInfo *player) } /* ----------------------------------------------------------------------- */ - /* draw elements that stay over the player */ + /* draw elements the player is just walking/passing through/under */ /* ----------------------------------------------------------------------- */ /* handle the field the player is leaving ... */ - if (player_is_moving && IS_OVER_PLAYER(last_element)) + if (player_is_moving && IS_ACCESSIBLE_INSIDE(last_element)) DrawLevelField(last_jx, last_jy); + else if (player_is_moving && IS_ACCESSIBLE_UNDER(last_element)) + DrawLevelFieldThruMask(last_jx, last_jy); /* ... and the field the player is entering */ - if (IS_OVER_PLAYER(element)) + if (IS_ACCESSIBLE_INSIDE(element)) DrawLevelField(jx, jy); + else if (IS_ACCESSIBLE_UNDER(element)) + DrawLevelFieldThruMask(jx, jy); if (setup.direct_draw) { @@ -779,13 +783,17 @@ void getGraphicSource(int graphic, int frame, Bitmap **bitmap, int *x, int *y) if (g->offset_y == 0) /* frames are ordered horizontally */ { - *x = g->src_x + (frame % g->anim_frames_per_line) * g->offset_x; - *y = g->src_y + (frame / g->anim_frames_per_line) * g->height; + int max_width = g->anim_frames_per_line * g->width; + + *x = (g->src_x + frame * g->offset_x) % max_width; + *y = g->src_y + (g->src_x + frame * g->offset_x) / max_width * g->height; } else if (g->offset_x == 0) /* frames are ordered vertically */ { - *x = g->src_x + (frame / g->anim_frames_per_line) * g->width; - *y = g->src_y + (frame % g->anim_frames_per_line) * g->offset_y; + int max_height = g->anim_frames_per_line * g->height; + + *x = g->src_x + (g->src_y + frame * g->offset_y) / max_height * g->width; + *y = (g->src_y + frame * g->offset_y) % max_height; } else /* frames are ordered diagonally */ {