X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Ftools.c;h=133a8265d6eee5631b1db356305c27e24218e554;hb=6da19745f8b8aa6f8cc02b59da507082fe509c5b;hp=86ad19b75e8c034d25eeb401a1efacc9d2a37511;hpb=97f6d75262c34ef6ec0facdf76dbbeb51f53f804;p=rocksndiamonds.git diff --git a/src/tools.c b/src/tools.c index 86ad19b7..133a8265 100644 --- a/src/tools.c +++ b/src/tools.c @@ -192,6 +192,22 @@ static char *print_if_not_empty(int element) return s; } +int correctLevelPosX_EM(int lx) +{ + lx -= 1; + lx -= (BorderElement != EL_EMPTY ? 1 : 0); + + return lx; +} + +int correctLevelPosY_EM(int ly) +{ + ly -= 1; + ly -= (BorderElement != EL_EMPTY ? 1 : 0); + + return ly; +} + static int getFieldbufferOffsetX_RND() { int full_lev_fieldx = lev_fieldx + (BorderElement != EL_EMPTY ? 2 : 0); @@ -288,8 +304,7 @@ static int getLevelFromScreenX_EM(int sx) int px = sx - SX; int lx = LEVELX((px + dx) / TILESIZE_VAR); - lx -= 1; - lx -= (BorderElement != EL_EMPTY ? 1 : 0); + lx = correctLevelPosX_EM(lx); return lx; } @@ -306,8 +321,7 @@ static int getLevelFromScreenY_EM(int sy) int py = sy - SY; int ly = LEVELY((py + dy) / TILESIZE_VAR); - ly -= 1; - ly -= (BorderElement != EL_EMPTY ? 1 : 0); + ly = correctLevelPosY_EM(ly); return ly; } @@ -395,6 +409,7 @@ void DumpTile(int x, int y) printf(" GfxElement: %d\n", GfxElement[x][y]); printf(" GfxAction: %d\n", GfxAction[x][y]); printf(" GfxFrame: %d [%d]\n", GfxFrame[x][y], FrameCounter); + printf(" Player x/y: %d, %d\n", local_player->jx, local_player->jy); printf("\n"); } @@ -2307,6 +2322,10 @@ void DrawScreenField(int x, int y) int newly = ly + (dir == MV_UP ? -1 : dir == MV_DOWN ? +1 : 0); DrawLevelElementThruMask(newlx, newly, EL_ACID); + + // prevent target field from being drawn again (but without masking) + // (this would happen if target field is scanned after moving element) + Stop[newlx][newly] = TRUE; } } else if (IS_BLOCKED(lx, ly))