X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fgame.c;h=a9d0e2698361c6f1869024455056e3e6ea869e0d;hb=3fb68b18f28034e492534fb3b5579fd1da888292;hp=fb21d6f62cafab430c342d9c7f88b9ee7473a34f;hpb=c89ae8e2fae58982b3425d2fc340046a908e5c7c;p=rocksndiamonds.git diff --git a/src/game.c b/src/game.c index fb21d6f6..a9d0e269 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; @@ -940,7 +941,7 @@ void InitGame() OpenDoor(DOOR_OPEN_ALL); - PlaySoundStereo(SND_GAME_STARTING, SOUND_MAX_RIGHT); + PlaySoundStereo(SND_GAME_STARTING, SOUND_MIDDLE); if (setup.sound_music) PlayMusic(level_nr); @@ -1096,18 +1097,18 @@ void GameWon() local_player->LevelSolved = FALSE; - PlaySoundStereo(SND_GAME_WINNING, SOUND_MAX_RIGHT); + PlaySoundStereo(SND_GAME_WINNING, SOUND_MIDDLE); if (TimeLeft) { if (!tape.playing && setup.sound_loops) - PlaySoundExt(SND_GAME_LEVELTIME_BONUS, SOUND_MAX_VOLUME, SOUND_MAX_RIGHT, + PlaySoundExt(SND_GAME_LEVELTIME_BONUS, SOUND_MAX_VOLUME, SOUND_MIDDLE, SND_CTRL_PLAY_LOOP); while (TimeLeft > 0) { if (!tape.playing && !setup.sound_loops) - PlaySoundStereo(SND_GAME_LEVELTIME_BONUS, SOUND_MAX_RIGHT); + PlaySoundStereo(SND_GAME_LEVELTIME_BONUS, SOUND_MIDDLE); if (TimeLeft > 0 && !(TimeLeft % 10)) RaiseScore(level.score[SC_ZEITBONUS]); if (TimeLeft > 100 && !(TimeLeft % 10)) @@ -1127,13 +1128,13 @@ void GameWon() else if (level.time == 0) /* level without time limit */ { if (!tape.playing && setup.sound_loops) - PlaySoundExt(SND_GAME_LEVELTIME_BONUS, SOUND_MAX_VOLUME, SOUND_MAX_RIGHT, + PlaySoundExt(SND_GAME_LEVELTIME_BONUS, SOUND_MAX_VOLUME, SOUND_MIDDLE, SND_CTRL_PLAY_LOOP); while (TimePlayed < 999) { if (!tape.playing && !setup.sound_loops) - PlaySoundStereo(SND_GAME_LEVELTIME_BONUS, SOUND_MAX_RIGHT); + PlaySoundStereo(SND_GAME_LEVELTIME_BONUS, SOUND_MIDDLE); if (TimePlayed < 999 && !(TimePlayed % 10)) RaiseScore(level.score[SC_ZEITBONUS]); if (TimePlayed < 900 && !(TimePlayed % 10)) @@ -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; } } @@ -3133,7 +3141,7 @@ void StartMoving(int x, int y) Feld[x][y] = EL_EMPTY; DrawLevelField(x, y); - PlaySoundLevel(newx, newy, SND_CLASS_EXIT_PASSING); + PlaySoundLevel(newx, newy, SND_PENGUIN_PASSING); if (IN_SCR_FIELD(SCREENX(newx), SCREENY(newy))) DrawGraphicThruMask(SCREENX(newx),SCREENY(newy), el2img(element), 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; @@ -4865,7 +4879,7 @@ void GameActions() TimeLeft--; if (TimeLeft <= 10 && setup.time_limit) - PlaySoundStereo(SND_GAME_RUNNING_OUT_OF_TIME, SOUND_MAX_RIGHT); + PlaySoundStereo(SND_GAME_RUNNING_OUT_OF_TIME, SOUND_MIDDLE); DrawText(DX_TIME, DY_TIME, int2str(TimeLeft, 3), FONT_TEXT_2); @@ -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; @@ -5732,7 +5768,7 @@ int DigField(struct PlayerInfo *player, TimeLeft += 10; DrawText(DX_TIME, DY_TIME, int2str(TimeLeft, 3), FONT_TEXT_2); } - PlaySoundStereo(SND_EXTRA_TIME_COLLECTING, SOUND_MAX_RIGHT); + PlaySoundStereo(SND_EXTRA_TIME_COLLECTING, SOUND_MIDDLE); break; case EL_SHIELD_NORMAL: @@ -6166,7 +6202,7 @@ int DigField(struct PlayerInfo *player, TimeLeft += 10; DrawText(DX_TIME, DY_TIME, int2str(TimeLeft, 3), FONT_TEXT_2); DrawLevelField(x, y); - PlaySoundStereo(SND_TIME_ORB_FULL_COLLECTING, SOUND_MAX_RIGHT); + PlaySoundStereo(SND_TIME_ORB_FULL_COLLECTING, SOUND_MIDDLE); return MF_ACTION; break; @@ -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; }