X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fgame.c;h=b6a7697e002a489f2044e0974fc2db401ddf02d6;hb=41680565bf2af491be63ee8440788c4ff8b616db;hp=a9d0e2698361c6f1869024455056e3e6ea869e0d;hpb=3fb68b18f28034e492534fb3b5579fd1da888292;p=rocksndiamonds.git diff --git a/src/game.c b/src/game.c index a9d0e269..b6a7697e 100644 --- a/src/game.c +++ b/src/game.c @@ -658,6 +658,8 @@ void InitGame() player->is_moving = FALSE; player->is_waiting = FALSE; + player->is_digging = FALSE; + player->is_collecting = FALSE; player->move_delay = game.initial_move_delay; player->move_delay_value = game.initial_move_delay_value; @@ -1382,6 +1384,7 @@ static int MovingOrBlocked2ElementIfNotLeaving(int x, int y) static void RemoveField(int x, int y) { Feld[x][y] = EL_EMPTY; + GfxElement[x][y] = EL_EMPTY; MovPos[x][y] = 0; MovDir[x][y] = 0; MovDelay[x][y] = 0; @@ -1615,6 +1618,7 @@ void Explode(int ex, int ey, int phase, int mode) } Feld[x][y] = EL_EXPLOSION; + GfxElement[x][y] = EL_EMPTY; MovDir[x][y] = MovPos[x][y] = 0; AmoebaNr[x][y] = 0; ExplodePhase[x][y] = 1; @@ -1686,7 +1690,7 @@ void Explode(int ex, int ey, int phase, int mode) int frame = getGraphicAnimationFrame(graphic, phase - delay); if (phase == delay) - DrawCrumbledSand(SCREENX(x), SCREENY(y)); + DrawLevelFieldCrumbledSand(x, y); if (IS_PFORTE(Store[x][y])) { @@ -3395,7 +3399,7 @@ void ContinueMoving(int x, int y) yy = y + xy[i][1]; if (IN_LEV_FIELD(xx, yy) && Feld[xx][yy] == EL_SAND) - DrawLevelField(xx, yy); /* for "DrawCrumbledSand()" */ + DrawLevelField(xx, yy); /* for "crumbled sand" */ } } @@ -4380,7 +4384,7 @@ static void ChangeActiveTrap(int x, int y) /* if new animation frame was drawn, correct crumbled sand border */ if (IS_NEW_FRAME(GfxFrame[x][y], graphic)) - DrawCrumbledSand(SCREENX(x), SCREENY(y)); + DrawLevelFieldCrumbledSand(x, y); } static void ChangeElement(int x, int y) @@ -5251,7 +5255,7 @@ boolean MoveFigure(struct PlayerInfo *player, int dx, int dy) else if (old_jx == jx && old_jy != jy) player->MovDir = (old_jy < jy ? MV_DOWN : MV_UP); - DrawLevelField(jx, jy); /* for "DrawCrumbledSand()" */ + DrawLevelField(jx, jy); /* for "crumbled sand" */ player->last_move_dir = player->MovDir; player->is_moving = TRUE; @@ -5664,7 +5668,10 @@ int DigField(struct PlayerInfo *player, int element; if (player->MovPos == 0) + { player->is_digging = FALSE; + player->is_collecting = FALSE; + } if (player->MovPos == 0) player->Pushing = FALSE; @@ -5721,11 +5728,14 @@ int DigField(struct PlayerInfo *player, case EL_SP_BASE: case EL_SP_BUGGY_BASE: case EL_SP_BUGGY_BASE_ACTIVATING: + RemoveField(x, y); #if 1 - if (mode != DF_SNAP && element == EL_SAND) - GfxElement[x][y] = Feld[x][y]; + if (mode != DF_SNAP && element != EL_EMPTY) + { + GfxElement[x][y] = (CAN_BE_CRUMBLED(element) ? EL_SAND : element); + player->is_digging = TRUE; + } #endif - RemoveField(x, y); PlaySoundLevelElementAction(x, y, element, ACTION_DIGGING); break; @@ -5739,6 +5749,13 @@ int DigField(struct PlayerInfo *player, case EL_PEARL: case EL_CRYSTAL: RemoveField(x, y); +#if 1 + if (mode != DF_SNAP) + { + GfxElement[x][y] = element; + player->is_collecting = TRUE; + } +#endif local_player->gems_still_needed -= (element == EL_DIAMOND ? 3 : element == EL_PEARL ? 5 : element == EL_CRYSTAL ? 8 : 1); @@ -6368,8 +6385,8 @@ int DigField(struct PlayerInfo *player, player->push_delay = 0; - if (Feld[x][y] != element) /* really digged something */ - player->is_digging = TRUE; + if (Feld[x][y] != element) /* really digged/collected something */ + player->is_collecting = !player->is_digging; return MF_MOVING; } @@ -6393,7 +6410,10 @@ boolean SnapField(struct PlayerInfo *player, int dx, int dy) player->snapped = FALSE; if (player->MovPos == 0) + { player->is_digging = FALSE; + player->is_collecting = FALSE; + } return FALSE; } @@ -6411,6 +6431,8 @@ boolean SnapField(struct PlayerInfo *player, int dx, int dy) player->snapped = TRUE; player->is_digging = FALSE; + player->is_collecting = FALSE; + DrawLevelField(x, y); BackToFront();