X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=blobdiff_plain;f=src%2Fgame.c;h=9dca25854cf41ca1b13b79267f3d8323b54acaf4;hp=fb21d6f62cafab430c342d9c7f88b9ee7473a34f;hb=0d0e1a63d6b14109b64805bcb1a45ddf469ba35d;hpb=3738b16805364591fbcc7bcd61a797dccbbb5962 diff --git a/src/game.c b/src/game.c index fb21d6f6..9dca2585 100644 --- a/src/game.c +++ b/src/game.c @@ -643,9 +643,10 @@ void InitGame() player->Pushing = FALSE; player->Switching = FALSE; player->GfxPos = 0; - player->Frame = 0; - + player->GfxDir = MV_NO_MOVING; player->GfxAction = ACTION_DEFAULT; + player->Frame = 0; + player->StepFrame = 0; player->use_murphy_graphic = FALSE; player->use_disk_red_graphic = FALSE; @@ -1261,12 +1262,19 @@ int NewHiScore() return position; } -static void InitPlayerGfxAnimation(struct PlayerInfo *player, int action) +void InitPlayerGfxAnimation(struct PlayerInfo *player, int action, int dir) { - if (player->GfxAction != action) + if (player->GfxAction != action || player->GfxDir != dir) { +#if 0 + printf("Player frame reset! (%d => %d, %d => %d)\n", + player->GfxAction, action, player->GfxDir, dir); +#endif + player->GfxAction = action; + player->GfxDir = dir; player->Frame = 0; + player->StepFrame = 0; } } @@ -4465,7 +4473,13 @@ static void PlayerActions(struct PlayerInfo *player, byte player_action) CheckGravityMovement(player); if (player->MovPos == 0) - InitPlayerGfxAnimation(player, ACTION_DEFAULT); + { +#if 0 + printf("Trying... Player frame reset\n"); +#endif + + InitPlayerGfxAnimation(player, ACTION_DEFAULT, player->MovDir); + } if (player->MovPos == 0) /* needed for tape.playing */ player->is_moving = FALSE; @@ -4898,12 +4912,31 @@ void GameActions() redraw_mask |= REDRAW_FPS; } +#if 0 + if (stored_player[0].jx != stored_player[0].last_jx || + stored_player[0].jy != stored_player[0].last_jy) + printf("::: %d, %d, %d, %d, %d\n", + stored_player[0].MovDir, + stored_player[0].MovPos, + stored_player[0].GfxPos, + stored_player[0].Frame, + stored_player[0].StepFrame); +#endif + #if 1 FrameCounter++; TimeFrames++; for (i=0; iStepFrame = 0; + if (moved & MF_MOVING) { if (old_jx != jx && old_jy == jy) @@ -5628,7 +5663,8 @@ int DigField(struct PlayerInfo *player, dy == +1 ? MV_DOWN : MV_NO_MOVING); int element; - player->is_digging = FALSE; + if (player->MovPos == 0) + player->is_digging = FALSE; if (player->MovPos == 0) player->Pushing = FALSE; @@ -6355,7 +6391,10 @@ boolean SnapField(struct PlayerInfo *player, int dx, int dy) player->Pushing = FALSE; player->snapped = FALSE; - player->is_digging = FALSE; + + if (player->MovPos == 0) + player->is_digging = FALSE; + return FALSE; }