X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fgame.c;h=1966bb3c6c03ec01db36464d7fce410a6fbedd9a;hb=ee2ea277015cd6d41e5314bbdc18229bd60ca1de;hp=5c3cc9d3d36ec3072332dbea5ec6cd6e2ee2fe7d;hpb=00e52ef0b245eadf05f9dd416b29ebec5a47c767;p=rocksndiamonds.git diff --git a/src/game.c b/src/game.c index 5c3cc9d3..1966bb3c 100644 --- a/src/game.c +++ b/src/game.c @@ -1840,13 +1840,13 @@ static void InitFieldForEngine_RND(int x, int y) int element = Tile[x][y]; // convert BD engine elements to corresponding R'n'D engine elements - element = (element == EL_BD_EMPTY ? EL_EMPTY : - element == EL_BD_PLAYER ? EL_PLAYER_1 : - element == EL_BD_INBOX ? EL_PLAYER_1 : - element == EL_BD_SAND ? EL_SAND : - element == EL_BD_STEELWALL ? EL_STEELWALL : - element == EL_BD_EXIT_CLOSED ? EL_EXIT_CLOSED : - element == EL_BD_EXIT_OPEN ? EL_EXIT_OPEN : + element = (element == EL_BDX_EMPTY ? EL_EMPTY : + element == EL_BDX_PLAYER ? EL_PLAYER_1 : + element == EL_BDX_INBOX ? EL_PLAYER_1 : + element == EL_BDX_SAND_1 ? EL_SAND : + element == EL_BDX_STEELWALL ? EL_STEELWALL : + element == EL_BDX_EXIT_CLOSED ? EL_EXIT_CLOSED : + element == EL_BDX_EXIT_OPEN ? EL_EXIT_OPEN : element); Tile[x][y] = element; @@ -2286,7 +2286,7 @@ static void UpdateGameControlValues(void) int time = (game.LevelSolved ? game.LevelSolved_CountingTime : level.game_engine_type == GAME_ENGINE_TYPE_BD ? - game_bd.time_played : + game_bd.time_left : level.game_engine_type == GAME_ENGINE_TYPE_EM ? game_em.lev->time : level.game_engine_type == GAME_ENGINE_TYPE_SP ? @@ -3676,6 +3676,9 @@ void InitGame(void) else { SetGameStatus(GAME_MODE_PLAYING); + + // do not cover screen before fading out when starting from main menu + game_bd.cover_screen = FALSE; } if (level_editor_test_game) @@ -4859,7 +4862,7 @@ void InitAmoebaNr(int x, int y) static void LevelSolved_SetFinalGameValues(void) { - game.time_final = (level.game_engine_type == GAME_ENGINE_TYPE_BD ? game_bd.time_played : + game.time_final = (level.game_engine_type == GAME_ENGINE_TYPE_BD ? game_bd.time_left : game.no_level_time_limit ? TimePlayed : TimeLeft); game.score_time_final = (level.use_step_counter ? TimePlayed : TimePlayed * FRAMES_PER_SECOND + TimeFrames); @@ -5161,10 +5164,28 @@ void GameEnd(void) // used instead of "level_nr" (needed for network games) int last_level_nr = levelset.level_nr; boolean tape_saved = FALSE; + boolean game_over = checkGameFailed(); // Important note: This function is not only called after "GameWon()", but also after // "game over" (if automatically asking for restarting the game is disabled in setup) + // do not handle game end if game over and automatically asking for game restart + if (game_over && setup.ask_on_game_over) + { + // (this is a special case: player pressed "return" key or fire button shortly before + // automatically asking to restart the game, so skip asking and restart right away) + + CloseDoor(DOOR_CLOSE_1); + + StartGameActions(network.enabled, setup.autorecord, level.random_seed); + + return; + } + + // do not handle game end if request dialog is already active + if (checkRequestActive()) + return; + if (game.LevelSolved) game.LevelSolved_GameEnd = TRUE; @@ -15766,10 +15787,10 @@ static int getSoundEffect_BD(int element_bd, int sample) case GD_S_DIAMOND_FALLING_8: nr = (sample == GD_S_DIAMOND_FALLING_RANDOM ? GetSimpleRandom(8) : sample - GD_S_DIAMOND_FALLING_1); - sound_effect = SND_BD_DIAMOND_FALLING_RANDOM_1 + nr; + sound_effect = SND_BDX_DIAMOND_FALLING_RANDOM_1 + nr; if (getSoundInfoEntryFilename(sound_effect) == NULL) - sound_effect = SND_BD_DIAMOND_FALLING; + sound_effect = SND_BDX_DIAMOND_FALLING; break; case GD_S_DIAMOND_IMPACT_RANDOM: @@ -15783,10 +15804,10 @@ static int getSoundEffect_BD(int element_bd, int sample) case GD_S_DIAMOND_IMPACT_8: nr = (sample == GD_S_DIAMOND_IMPACT_RANDOM ? GetSimpleRandom(8) : sample - GD_S_DIAMOND_IMPACT_1); - sound_effect = SND_BD_DIAMOND_IMPACT_RANDOM_1 + nr; + sound_effect = SND_BDX_DIAMOND_IMPACT_RANDOM_1 + nr; if (getSoundInfoEntryFilename(sound_effect) == NULL) - sound_effect = SND_BD_DIAMOND_IMPACT; + sound_effect = SND_BDX_DIAMOND_IMPACT; break; case GD_S_FLYING_DIAMOND_FALLING_RANDOM: @@ -15800,10 +15821,10 @@ static int getSoundEffect_BD(int element_bd, int sample) case GD_S_FLYING_DIAMOND_FALLING_8: nr = (sample == GD_S_FLYING_DIAMOND_FALLING_RANDOM ? GetSimpleRandom(8) : sample - GD_S_FLYING_DIAMOND_FALLING_1); - sound_effect = SND_BD_FLYING_DIAMOND_FALLING_RANDOM_1 + nr; + sound_effect = SND_BDX_FLYING_DIAMOND_FALLING_RANDOM_1 + nr; if (getSoundInfoEntryFilename(sound_effect) == NULL) - sound_effect = SND_BD_FLYING_DIAMOND_FALLING; + sound_effect = SND_BDX_FLYING_DIAMOND_FALLING; break; case GD_S_FLYING_DIAMOND_IMPACT_RANDOM: @@ -15817,10 +15838,10 @@ static int getSoundEffect_BD(int element_bd, int sample) case GD_S_FLYING_DIAMOND_IMPACT_8: nr = (sample == GD_S_FLYING_DIAMOND_IMPACT_RANDOM ? GetSimpleRandom(8) : sample - GD_S_FLYING_DIAMOND_IMPACT_1); - sound_effect = SND_BD_FLYING_DIAMOND_IMPACT_RANDOM_1 + nr; + sound_effect = SND_BDX_FLYING_DIAMOND_IMPACT_RANDOM_1 + nr; if (getSoundInfoEntryFilename(sound_effect) == NULL) - sound_effect = SND_BD_FLYING_DIAMOND_IMPACT; + sound_effect = SND_BDX_FLYING_DIAMOND_IMPACT; break; case GD_S_TIMEOUT_0: @@ -15846,7 +15867,7 @@ static int getSoundEffect_BD(int element_bd, int sample) break; case GD_S_AMOEBA_MAGIC: - sound_effect = SND_BD_AMOEBA_OTHER; + sound_effect = SND_BDX_AMOEBA_1_OTHER; break; case GD_S_FINISHED: