From 7c0b78ef65acbe880d7f905a5e38fb7bdac8f007 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Sun, 20 Aug 2006 19:58:10 +0200 Subject: [PATCH] rnd-20060820-2-src --- src/conftime.h | 2 +- src/game.c | 391 ++++++++++++++-------------------------- src/game.h | 2 + src/game_em/convert.c | 2 + src/game_em/export.h | 2 + src/game_em/main_em.h | 3 + src/game_em/synchro_1.c | 24 +++ src/game_em/synchro_2.c | 35 ++-- 8 files changed, 190 insertions(+), 271 deletions(-) diff --git a/src/conftime.h b/src/conftime.h index c4fef1c5..5eb51ea0 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "[2006-08-19 19:17]" +#define COMPILE_DATE_STRING "[2006-08-20 19:54]" diff --git a/src/game.c b/src/game.c index 72ae34a8..fea0d6ce 100644 --- a/src/game.c +++ b/src/game.c @@ -52,7 +52,6 @@ #define USE_CODE_THAT_BREAKS_SNAKE_BITE (USE_NEW_STUFF * 1) #define USE_UFAST_PLAYER_EXIT_BUGFIX (USE_NEW_STUFF * 1) -#define USE_NEW_GAME_WON (USE_NEW_STUFF * 1) /* for DigField() */ @@ -1298,6 +1297,11 @@ void DrawAllGameValues(int emeralds, int dynamite, int score, int time, int key[MAX_NUM_KEYS]; int i; + /* prevent EM engine from updating time/score values parallel to GameWon() */ + if (level.game_engine_type == GAME_ENGINE_TYPE_EM && + local_player->LevelSolved) + return; + for (i = 0; i < MAX_NUM_KEYS; i++) key[i] = key_bits & (1 << i); @@ -1309,14 +1313,15 @@ void DrawAllGameValues(int emeralds, int dynamite, int score, int time, DrawGameValue_Time(time); DrawGameValue_Keys(key); - - redraw_mask |= REDRAW_DOOR_1; } void DrawGameDoorValues() { int time_value = (level.time == 0 ? TimePlayed : TimeLeft); - int dynamite_state = 0; + int dynamite_value = 0; + int score_value = (local_player->LevelSolved ? local_player->score_final : + local_player->score); + int gems_value = local_player->gems_still_needed; int key_bits = 0; int i, j; @@ -1335,7 +1340,7 @@ void DrawGameDoorValues() if (stored_player[i].key[j]) key_bits |= (1 << j); - dynamite_state += stored_player[i].inventory_size; + dynamite_value += stored_player[i].inventory_size; } } else @@ -1346,11 +1351,11 @@ void DrawGameDoorValues() if (stored_player[player_nr].key[i]) key_bits |= (1 << i); - dynamite_state = stored_player[player_nr].inventory_size; + dynamite_value = stored_player[player_nr].inventory_size; } - DrawAllGameValues(local_player->gems_still_needed, dynamite_state, - local_player->score, time_value, key_bits); + DrawAllGameValues(gems_value, dynamite_value, score_value, time_value, + key_bits); } @@ -1839,6 +1844,8 @@ void InitGame() player->programmed_action = 0; player->score = 0; + player->score_final = 0; + player->gems_still_needed = level.gems_needed; player->sokobanfields_still_needed = 0; player->lights_still_needed = 0; @@ -2423,7 +2430,7 @@ void InitGame() OpenDoor(DOOR_OPEN_ALL); - PlaySoundStereo(SND_GAME_STARTING, SOUND_MIDDLE); + PlaySound(SND_GAME_STARTING); if (setup.sound_music) PlayLevelMusic(); @@ -2648,12 +2655,19 @@ void InitAmoebaNr(int x, int y) AmoebaCnt2[group_nr]++; } -#if USE_NEW_GAME_WON +static void PlayerWins(struct PlayerInfo *player) +{ + player->LevelSolved = TRUE; + player->GameOver = TRUE; + + player->score_final = (level.game_engine_type == GAME_ENGINE_TYPE_EM ? + level.native_em_level->lev->score : player->score); +} void GameWon() { - static boolean score_done = FALSE; - static boolean player_done = FALSE; + static int time, time_final; + static int score, score_final; static int game_over_delay = 0; int game_over_delay_value = 50; @@ -2661,106 +2675,90 @@ void GameWon() if (local_player->MovPos) return; - if (tape.auto_play) /* tape might already be stopped here */ - tape.auto_play_level_solved = TRUE; - if (!local_player->LevelSolved_GameEnd) { local_player->LevelSolved_GameEnd = TRUE; local_player->LevelSolved_SaveTape = tape.recording; local_player->LevelSolved_SaveScore = !tape.playing; - score_done = FALSE; - player_done = FALSE; - game_over_delay = 0; - } + if (tape.auto_play) /* tape might already be stopped here */ + tape.auto_play_level_solved = TRUE; - PlaySoundStereo(SND_GAME_WINNING, SOUND_MIDDLE); + game_over_delay = game_over_delay_value; - if (TimeLeft > 0) - { - if (!tape.playing) - { - if (setup.sound_loops) - PlaySoundExt(SND_GAME_LEVELTIME_BONUS, SOUND_MAX_VOLUME, SOUND_MIDDLE, - SND_CTRL_PLAY_LOOP); - else - PlaySoundStereo(SND_GAME_LEVELTIME_BONUS, SOUND_MIDDLE); - } + time = time_final = (level.time == 0 ? TimePlayed : TimeLeft); + score = score_final = local_player->score_final; - if (TimeLeft > 100 && TimeLeft % 10 == 0) + if (TimeLeft > 0) { - TimeLeft -= 10; - RaiseScore(level.score[SC_TIME_BONUS] * 10); + time_final = 0; + score_final += TimeLeft * level.score[SC_TIME_BONUS]; } - else + else if (level.time == 0 && TimePlayed < 999) { - TimeLeft--; - RaiseScore(level.score[SC_TIME_BONUS]); + time_final = 999; + score_final += (999 - TimePlayed) * level.score[SC_TIME_BONUS]; } - DrawGameValue_Time(TimeLeft); + local_player->score_final = score_final; - if (TimeLeft <= 0 && !tape.playing && setup.sound_loops) - StopSound(SND_GAME_LEVELTIME_BONUS); - } - else if (level.time == 0 && TimePlayed < 999) /* level without time limit */ - { - if (!tape.playing) + if (level_editor_test_game) { - if (setup.sound_loops) - PlaySoundExt(SND_GAME_LEVELTIME_BONUS, SOUND_MAX_VOLUME, SOUND_MIDDLE, - SND_CTRL_PLAY_LOOP); - else - PlaySoundStereo(SND_GAME_LEVELTIME_BONUS, SOUND_MIDDLE); - } + time = time_final; + score = score_final; - if (TimePlayed < 900 && TimePlayed % 10 == 0) - { - TimePlayed += 10; - RaiseScore(level.score[SC_TIME_BONUS] * 10); + DrawGameValue_Time(time); + DrawGameValue_Score(score); } - else + + if (ExitX >= 0 && ExitY >= 0) /* local player has left the level */ { - TimePlayed++; - RaiseScore(level.score[SC_TIME_BONUS]); - } + /* close exit door after last player */ + if (AllPlayersGone && + (Feld[ExitX][ExitY] == EL_EXIT_OPEN || + Feld[ExitX][ExitY] == EL_SP_EXIT_OPEN)) + { + int element = Feld[ExitX][ExitY]; - DrawGameValue_Time(TimePlayed); + Feld[ExitX][ExitY] = (element == EL_EXIT_OPEN ? EL_EXIT_CLOSING : + EL_SP_EXIT_CLOSING); - if (TimePlayed >= 999 && !tape.playing && setup.sound_loops) - StopSound(SND_GAME_LEVELTIME_BONUS); - } - else - { - score_done = TRUE; + PlayLevelSoundElementAction(ExitX, ExitY, element, ACTION_CLOSING); + } + + /* player disappears */ + DrawLevelField(ExitX, ExitY); + } + + PlaySound(SND_GAME_WINNING); } - /* close exit door after last player */ - if (AllPlayersGone && ExitX >= 0 && ExitY >= 0 && - (Feld[ExitX][ExitY] == EL_EXIT_OPEN || - Feld[ExitX][ExitY] == EL_SP_EXIT_OPEN)) + if (game_over_delay > 0) { - int element = Feld[ExitX][ExitY]; + game_over_delay--; - Feld[ExitX][ExitY] = (element == EL_EXIT_OPEN ? EL_EXIT_CLOSING : - EL_SP_EXIT_CLOSING); - - PlayLevelSoundElementAction(ExitX, ExitY, element, ACTION_CLOSING); + return; } - /* player disappears */ - if (ExitX >= 0 && ExitY >= 0 && !player_done) + if (time != time_final) { - DrawLevelField(ExitX, ExitY); + int time_to_go = ABS(time_final - time); + int time_count_dir = (time < time_final ? +1 : -1); + int time_count_steps = (time_to_go > 100 && time_to_go % 10 == 0 ? 10 : 1); - player_done = TRUE; - } + time += time_count_steps * time_count_dir; + score += time_count_steps * level.score[SC_TIME_BONUS]; - game_over_delay++; + DrawGameValue_Time(time); + DrawGameValue_Score(score); - if (game_over_delay < game_over_delay_value || !score_done) - return; + if (time == time_final) + StopSound(SND_GAME_LEVELTIME_BONUS); + else if (setup.sound_loops) + PlaySoundLoop(SND_GAME_LEVELTIME_BONUS); + else + PlaySound(SND_GAME_LEVELTIME_BONUS); + } } void GameEnd() @@ -2774,7 +2772,16 @@ void GameEnd() { TapeStop(); - SaveTape(tape.level_nr); /* Ask to save tape */ + SaveTape(tape.level_nr); /* ask to save tape */ + } + + if (level_editor_test_game) + { + game_status = GAME_MODE_MAIN; + + DrawMainMenu(); + + return; } if (!local_player->LevelSolved_SaveScore) @@ -2794,10 +2801,8 @@ void GameEnd() SaveLevelSetup_SeriesInfo(); } - if (level_editor_test_game) - local_player->score = -1; /* no highscore when playing from editor */ - else if (level_nr < leveldir_current->last_level) - raise_level = TRUE; /* advance to next level */ + if (level_nr < leveldir_current->last_level) + raise_level = TRUE; /* advance to next level */ if ((hi_pos = NewHiScore()) >= 0) { @@ -2825,161 +2830,8 @@ void GameEnd() DrawAndFadeInMainMenu(REDRAW_FIELD); } - - local_player->LevelSolved_SaveScore = FALSE; } -#else - -void GameWon() -{ - int hi_pos; - boolean raise_level = FALSE; - - if (local_player->MovPos) - return; - - if (tape.auto_play) /* tape might already be stopped here */ - tape.auto_play_level_solved = TRUE; - - local_player->LevelSolved = FALSE; - - PlaySoundStereo(SND_GAME_WINNING, SOUND_MIDDLE); - - if (TimeLeft) - { - if (!tape.playing && setup.sound_loops) - 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_MIDDLE); - - if (TimeLeft > 100 && TimeLeft % 10 == 0) - { - TimeLeft -= 10; - RaiseScore(level.score[SC_TIME_BONUS] * 10); - } - else - { - TimeLeft--; - RaiseScore(level.score[SC_TIME_BONUS]); - } - - DrawGameValue_Time(TimeLeft); - - BackToFront(); - - if (!tape.playing) - Delay(10); - } - - if (!tape.playing && setup.sound_loops) - StopSound(SND_GAME_LEVELTIME_BONUS); - } - else if (level.time == 0) /* level without time limit */ - { - if (!tape.playing && setup.sound_loops) - 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_MIDDLE); - - if (TimePlayed < 900 && TimePlayed % 10 == 0) - { - TimePlayed += 10; - RaiseScore(level.score[SC_TIME_BONUS] * 10); - } - else - { - TimePlayed++; - RaiseScore(level.score[SC_TIME_BONUS]); - } - - DrawGameValue_Time(TimePlayed); - - BackToFront(); - - if (!tape.playing) - Delay(10); - } - - if (!tape.playing && setup.sound_loops) - StopSound(SND_GAME_LEVELTIME_BONUS); - } - - /* close exit door after last player */ - if (AllPlayersGone && ExitX >= 0 && ExitY >= 0 && - (Feld[ExitX][ExitY] == EL_EXIT_OPEN || - Feld[ExitX][ExitY] == EL_SP_EXIT_OPEN)) - { - int element = Feld[ExitX][ExitY]; - - Feld[ExitX][ExitY] = (element == EL_EXIT_OPEN ? EL_EXIT_CLOSING : - EL_SP_EXIT_CLOSING); - - PlayLevelSoundElementAction(ExitX, ExitY, element, ACTION_CLOSING); - } - - /* player disappears */ - if (ExitX >= 0 && ExitY >= 0) - DrawLevelField(ExitX, ExitY); - - BackToFront(); - - if (tape.playing) - return; - - CloseDoor(DOOR_CLOSE_1); - - if (tape.recording) - { - TapeStop(); - SaveTape(tape.level_nr); /* Ask to save tape */ - } - - if (level_nr == leveldir_current->handicap_level) - { - leveldir_current->handicap_level++; - SaveLevelSetup_SeriesInfo(); - } - - if (level_editor_test_game) - local_player->score = -1; /* no highscore when playing from editor */ - else if (level_nr < leveldir_current->last_level) - raise_level = TRUE; /* advance to next level */ - - if ((hi_pos = NewHiScore()) >= 0) - { - game_status = GAME_MODE_SCORES; - DrawHallOfFame(hi_pos); - if (raise_level) - { - level_nr++; - TapeErase(); - } - } - else - { - game_status = GAME_MODE_MAIN; - if (raise_level) - { - level_nr++; - TapeErase(); - } - DrawMainMenu(); - } - - BackToFront(); -} - -#endif - int NewHiScore() { int k, l; @@ -2988,12 +2840,12 @@ int NewHiScore() LoadScore(level_nr); if (strEqual(setup.player_name, EMPTY_PLAYER_NAME) || - local_player->score < highscore[MAX_SCORE_ENTRIES - 1].Score) + local_player->score_final < highscore[MAX_SCORE_ENTRIES - 1].Score) return -1; for (k = 0; k < MAX_SCORE_ENTRIES; k++) { - if (local_player->score > highscore[k].Score) + if (local_player->score_final > highscore[k].Score) { /* player has made it to the hall of fame */ @@ -3021,7 +2873,7 @@ int NewHiScore() #endif strncpy(highscore[k].Name, setup.player_name, MAX_PLAYER_NAME_LEN); highscore[k].Name[MAX_PLAYER_NAME_LEN] = '\0'; - highscore[k].Score = local_player->score; + highscore[k].Score = local_player->score_final; position = k; break; } @@ -6064,7 +5916,7 @@ void StartMoving(int x, int y) local_player->friends_still_needed--; if (!local_player->friends_still_needed && !local_player->GameOver && AllPlayersGone) - local_player->LevelSolved = local_player->GameOver = TRUE; + PlayerWins(local_player); return; } @@ -7884,7 +7736,7 @@ static void ExecuteCustomElementAction(int x, int y, int element, int page) { for (i = 0; i < MAX_PLAYERS; i++) if (action_arg_player_bits & (1 << i)) - stored_player[i].LevelSolved = stored_player[i].GameOver = TRUE; + PlayerWins(&stored_player[i]); break; } @@ -9022,7 +8874,8 @@ static void CheckLevelTime() { if (level.native_em_level->lev->home == 0) /* all players at home */ { - local_player->LevelSolved = TRUE; + PlayerWins(local_player); + AllPlayersGone = TRUE; level.native_em_level->lev->home = -1; @@ -9053,7 +8906,7 @@ static void CheckLevelTime() } } - if (!level.use_step_counter) + if (!local_player->LevelSolved && !level.use_step_counter) { TimePlayed++; @@ -9062,7 +8915,7 @@ static void CheckLevelTime() TimeLeft--; if (TimeLeft <= 10 && setup.time_limit) - PlaySoundStereo(SND_GAME_RUNNING_OUT_OF_TIME, SOUND_MIDDLE); + PlaySound(SND_GAME_RUNNING_OUT_OF_TIME); DrawGameValue_Time(TimeLeft); @@ -9174,7 +9027,8 @@ void GameActions() { if (level.native_em_level->lev->home == 0) /* all players at home */ { - local_player->LevelSolved = TRUE; + PlayerWins(local_player); + AllPlayersGone = TRUE; level.native_em_level->lev->home = -1; @@ -10419,7 +10273,7 @@ void ScrollPlayer(struct PlayerInfo *player, int mode) if (local_player->friends_still_needed == 0 || IS_SP_ELEMENT(Feld[jx][jy])) - player->LevelSolved = player->GameOver = TRUE; + PlayerWins(player); } /* this breaks one level: "machine", level 000 */ @@ -10467,7 +10321,7 @@ void ScrollPlayer(struct PlayerInfo *player, int mode) RemovePlayer(player); } - if (level.use_step_counter) + if (!local_player->LevelSolved && level.use_step_counter) { int i; @@ -10478,7 +10332,7 @@ void ScrollPlayer(struct PlayerInfo *player, int mode) TimeLeft--; if (TimeLeft <= 10 && setup.time_limit) - PlaySoundStereo(SND_GAME_RUNNING_OUT_OF_TIME, SOUND_MIDDLE); + PlaySound(SND_GAME_RUNNING_OUT_OF_TIME); DrawGameValue_Time(TimeLeft); @@ -11701,7 +11555,8 @@ int DigField(struct PlayerInfo *player, if (local_player->sokobanfields_still_needed == 0 && game.emulation == EMU_SOKOBAN) { - player->LevelSolved = player->GameOver = TRUE; + PlayerWins(player); + PlayLevelSound(x, y, SND_GAME_SOKOBAN_SOLVING); } } @@ -12243,9 +12098,12 @@ static void PlayLevelMusic() PlayMusic(MAP_NOCONF_MUSIC(level_nr)); /* from music dir */ } -void PlayLevelSound_EM(int x, int y, int element_em, int sample) +void PlayLevelSound_EM(int xx, int yy, int element_em, int sample) { int element = (element_em > -1 ? map_element_EM_to_RND(element_em) : 0); + int offset = (BorderElement == EL_STEELWALL ? 1 : 0); + int x = xx - 1 - offset; + int y = yy - 1 - offset; switch (sample) { @@ -12391,7 +12249,7 @@ void PlayLevelSound_EM(int x, int y, int element_em, int sample) break; case SAMPLE_time: - PlaySoundStereo(SND_GAME_RUNNING_OUT_OF_TIME, SOUND_MIDDLE); + PlaySound(SND_GAME_RUNNING_OUT_OF_TIME); break; default: @@ -12400,6 +12258,31 @@ void PlayLevelSound_EM(int x, int y, int element_em, int sample) } } +#if 0 +void ChangeTime(int value) +{ + int *time = (level.time == 0 ? &TimePlayed : &TimeLeft); + + *time += value; + + /* EMC game engine uses value from time counter of RND game engine */ + level.native_em_level->lev->time = *time; + + DrawGameValue_Time(*time); +} + +void RaiseScore(int value) +{ + /* EMC game engine and RND game engine have separate score counters */ + int *score = (level.game_engine_type == GAME_ENGINE_TYPE_EM ? + &level.native_em_level->lev->score : &local_player->score); + + *score += value; + + DrawGameValue_Score(*score); +} +#endif + void RaiseScore(int value) { local_player->score += value; diff --git a/src/game.h b/src/game.h index 4190c9ec..57621e88 100644 --- a/src/game.h +++ b/src/game.h @@ -183,6 +183,8 @@ struct PlayerInfo int step_counter; int score; + int score_final; + int gems_still_needed; int sokobanfields_still_needed; int lights_still_needed; diff --git a/src/game_em/convert.c b/src/game_em/convert.c index fcf96d3a..a3553a79 100644 --- a/src/game_em/convert.c +++ b/src/game_em/convert.c @@ -1233,4 +1233,6 @@ void prepare_em_level(void) for (i = 0; i < MAX_PLAYERS; i++) game_em.last_player_direction[i] = MV_NONE; + + lev.exit_x = lev.exit_y = -1; /* kludge for playing player exit sound */ } diff --git a/src/game_em/export.h b/src/game_em/export.h index 27e3c6f0..e7cfae0e 100644 --- a/src/game_em/export.h +++ b/src/game_em/export.h @@ -616,6 +616,8 @@ struct LEVEL short ball_array[8][8]; /* ball data */ short android_array[TILE_MAX];/* android clone table */ int num_ball_arrays; /* number of ball data arrays used */ + + int exit_x, exit_y; /* kludge for playing player exit sound */ }; struct PLAYER diff --git a/src/game_em/main_em.h b/src/game_em/main_em.h index 83462991..87e9d952 100644 --- a/src/game_em/main_em.h +++ b/src/game_em/main_em.h @@ -83,6 +83,9 @@ #define SXSIZE (SCR_FIELDX * TILEX) #define SYSIZE (SCR_FIELDY * TILEY) +/* other settings */ +#define PLAY_ELEMENT_SOUND FALSE + /* ------------------------------------------------------------------------- */ /* macro function definitions */ diff --git a/src/game_em/synchro_1.c b/src/game_em/synchro_1.c index 5f092987..3a469fdf 100644 --- a/src/game_em/synchro_1.c +++ b/src/game_em/synchro_1.c @@ -296,7 +296,9 @@ static void kill_player(struct PLAYER *ply) case Xbug_gow: Cave[y-1][x] = Xboom_bug; #if 0 +#if PLAY_ELEMENT_SOUND play_element_sound(x, y, SAMPLE_boom, Zplayer); +#endif #endif break; @@ -310,7 +312,9 @@ static void kill_player(struct PLAYER *ply) case Xtank_gow: Cave[y-1][x] = Xboom_bomb; #if 0 +#if PLAY_ELEMENT_SOUND play_element_sound(x, y, SAMPLE_boom, Zplayer); +#endif #endif break; } @@ -327,7 +331,9 @@ static void kill_player(struct PLAYER *ply) case Xbug_gow: Cave[y][x+1] = Xboom_bug; #if 0 +#if PLAY_ELEMENT_SOUND play_element_sound(x, y, SAMPLE_boom, Zplayer); +#endif #endif break; @@ -341,7 +347,9 @@ static void kill_player(struct PLAYER *ply) case Xtank_gow: Cave[y][x+1] = Xboom_bomb; #if 0 +#if PLAY_ELEMENT_SOUND play_element_sound(x, y, SAMPLE_boom, Zplayer); +#endif #endif break; } @@ -358,7 +366,9 @@ static void kill_player(struct PLAYER *ply) case Xbug_gow: Cave[y+1][x] = Xboom_bug; #if 0 +#if PLAY_ELEMENT_SOUND play_element_sound(x, y, SAMPLE_boom, Zplayer); +#endif #endif break; @@ -372,7 +382,9 @@ static void kill_player(struct PLAYER *ply) case Xtank_gow: Cave[y+1][x] = Xboom_bomb; #if 0 +#if PLAY_ELEMENT_SOUND play_element_sound(x, y, SAMPLE_boom, Zplayer); +#endif #endif break; } @@ -389,7 +401,9 @@ static void kill_player(struct PLAYER *ply) case Xbug_gow: Cave[y][x-1] = Xboom_bug; #if 0 +#if PLAY_ELEMENT_SOUND play_element_sound(x, y, SAMPLE_boom, Zplayer); +#endif #endif break; @@ -403,7 +417,9 @@ static void kill_player(struct PLAYER *ply) case Xtank_gow: Cave[y][x-1] = Xboom_bomb; #if 0 +#if PLAY_ELEMENT_SOUND play_element_sound(x, y, SAMPLE_boom, Zplayer); +#endif #endif break; } @@ -413,10 +429,15 @@ static void kill_player(struct PLAYER *ply) case Xexit_1: case Xexit_2: case Xexit_3: + lev.exit_x = x; + lev.exit_y = y; play_element_sound(x, y, SAMPLE_exit_leave, Xexit_1); break; default: +#if PLAY_ELEMENT_SOUND + play_element_sound(x, y, SAMPLE_boom, Zplayer); +#endif play_element_sound(x, y, SAMPLE_die, Zplayer); break; } @@ -1245,7 +1266,10 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy) case Xexit_1: case Xexit_2: case Xexit_3: +#if 0 + /* !!! already played in kill_player !!! */ play_element_sound(x, y, SAMPLE_exit_leave, Xexit_1); +#endif lev.home--; diff --git a/src/game_em/synchro_2.c b/src/game_em/synchro_2.c index 1ab59546..7657bf8d 100644 --- a/src/game_em/synchro_2.c +++ b/src/game_em/synchro_2.c @@ -611,7 +611,7 @@ void synchro_2(void) Boom[y+2][x-1] = Xemerald; Boom[y+2][x] = Xemerald; Boom[y+2][x+1] = Xemerald; -#if 0 +#if PLAY_ELEMENT_SOUND play_element_sound(x, y, SAMPLE_boom, element); #endif score += lev.bug_score; @@ -637,7 +637,7 @@ void synchro_2(void) Boom[y+2][x-1] = Xblank; Boom[y+2][x] = Xblank; Boom[y+2][x+1] = Xblank; -#if 0 +#if PLAY_ELEMENT_SOUND play_element_sound(x, y, SAMPLE_boom, element); #endif score += lev.tank_score; @@ -697,7 +697,7 @@ void synchro_2(void) Boom[y+2][x-1] = lev.eater_array[lev.eater_pos][6]; Boom[y+2][x] = lev.eater_array[lev.eater_pos][7]; Boom[y+2][x+1] = lev.eater_array[lev.eater_pos][8]; -#if 0 +#if PLAY_ELEMENT_SOUND play_element_sound(x, y, SAMPLE_boom, element); #endif lev.eater_pos = (lev.eater_pos + 1) & 7; @@ -718,7 +718,7 @@ void synchro_2(void) Boom[y+2][x-1] = Xblank; Boom[y+2][x] = Xblank; Boom[y+2][x+1] = Xblank; -#if 0 +#if PLAY_ELEMENT_SOUND play_element_sound(x, y, SAMPLE_boom, element); #endif score += lev.alien_score; @@ -799,7 +799,7 @@ void synchro_2(void) Boom[y+2][x-1] = Xblank; Boom[y+2][x] = Xblank; Boom[y+2][x+1] = Xblank; -#if 0 +#if PLAY_ELEMENT_SOUND play_element_sound(x, y, SAMPLE_boom, element); #endif goto loop; @@ -2838,7 +2838,7 @@ void synchro_2(void) Boom[y+2][x-1] = Xblank; Boom[y+2][x] = Xblank; Boom[y+2][x+1] = Xblank; -#if 0 +#if PLAY_ELEMENT_SOUND play_element_sound(x, y, SAMPLE_boom, element); #endif goto loop; @@ -2863,7 +2863,7 @@ void synchro_2(void) Boom[y+2][x-1] = Xemerald; Boom[y+2][x] = Xemerald; Boom[y+2][x+1] = Xemerald; -#if 0 +#if PLAY_ELEMENT_SOUND play_element_sound(x, y, SAMPLE_boom, element); #endif score += lev.bug_score; @@ -2889,7 +2889,7 @@ void synchro_2(void) Boom[y+2][x-1] = Xblank; Boom[y+2][x] = Xblank; Boom[y+2][x+1] = Xblank; -#if 0 +#if PLAY_ELEMENT_SOUND play_element_sound(x, y, SAMPLE_boom, element); #endif score += lev.tank_score; @@ -2911,7 +2911,7 @@ void synchro_2(void) Boom[y+2][x-1] = lev.eater_array[lev.eater_pos][6]; Boom[y+2][x] = lev.eater_array[lev.eater_pos][7]; Boom[y+2][x+1] = lev.eater_array[lev.eater_pos][8]; -#if 0 +#if PLAY_ELEMENT_SOUND play_element_sound(x, y, SAMPLE_boom, element); #endif lev.eater_pos = (lev.eater_pos + 1) & 7; @@ -2932,7 +2932,7 @@ void synchro_2(void) Boom[y+2][x-1] = Xblank; Boom[y+2][x] = Xblank; Boom[y+2][x+1] = Xblank; -#if 0 +#if PLAY_ELEMENT_SOUND play_element_sound(x, y, SAMPLE_boom, element); #endif score += lev.alien_score; @@ -4189,7 +4189,7 @@ void synchro_2(void) Boom[y+1][x-1] = Xblank; Boom[y+1][x] = Xblank; Boom[y+1][x+1] = Xblank; -#if 0 +#if PLAY_ELEMENT_SOUND play_element_sound(x, y, SAMPLE_boom, element); #endif goto loop; @@ -4878,7 +4878,7 @@ void synchro_2(void) Boom[y+1][x-1] = Xemerald; Boom[y+1][x] = Xemerald; Boom[y+1][x+1] = Xemerald; -#if 0 +#if PLAY_ELEMENT_SOUND play_element_sound(x, y, SAMPLE_boom, element); #endif goto loop; @@ -4897,19 +4897,22 @@ void synchro_2(void) Boom[y+1][x-1] = Xblank; Boom[y+1][x] = Xblank; Boom[y+1][x+1] = Xblank; -#if 0 +#if PLAY_ELEMENT_SOUND play_element_sound(x, y, SAMPLE_boom, element); #endif goto loop; case Xboom_android: -#if 0 +#if PLAY_ELEMENT_SOUND play_element_sound(x, y, SAMPLE_boom, Xandroid); #endif case Xboom_1: Next[y][x] = Xboom_2; -#if 1 - play_sound(x, y, SAMPLE_boom); +#if !PLAY_ELEMENT_SOUND + if (x != lev.exit_x && y != lev.exit_y) + play_sound(x, y, SAMPLE_boom); + else + lev.exit_x = lev.exit_y = -1; #endif goto loop; -- 2.34.1