X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fgame_bd%2Fbd_gameplay.c;h=3ca3e43c874f020f015d9619ef23ed730f0fd13a;hb=8fdd23c078934ae797980a824fd145903c84cae7;hp=6588fd8ebe452d01658574388c8d2aeddf17589a;hpb=93a37840d8ff4a84fc878f148e3abfeecb701821;p=rocksndiamonds.git diff --git a/src/game_bd/bd_gameplay.c b/src/game_bd/bd_gameplay.c index 6588fd8e..3ca3e43c 100644 --- a/src/game_bd/bd_gameplay.c +++ b/src/game_bd/bd_gameplay.c @@ -17,10 +17,6 @@ #include "main_bd.h" -// universal settings -static boolean gd_no_invisible_outbox = FALSE; - - void gd_game_free(GdGame *game) { // stop sounds @@ -116,6 +112,10 @@ static void load_cave(GdGame *game) game->cave = gd_get_prepared_cave(game->original_cave, game->level_num); + // if requested, recolor cave (cave is a copy only, so no worries) + if (setup.bd_random_colors) + gd_cave_set_random_colors(game->cave, setup.bd_default_color_type); + if (game->cave->intermission && game->cave->intermission_instantlife) add_bonus_life(game, FALSE); @@ -188,6 +188,13 @@ GdGame *gd_game_new(const int cave, const int level) return game; } +boolean check_iteration_reached(GdGame *game) +{ + int millisecs_elapsed = 20; + + return (game->milliseconds_game + millisecs_elapsed >= game->cave->speed); +} + static void iterate_cave(GdGame *game, GdDirection player_move, boolean fire) { boolean suicide = FALSE; @@ -383,7 +390,7 @@ static GdGameState gd_game_main_int(GdGame *game, boolean allow_iterate, boolean { for (x = 0; x < game->cave->w; x++) { - game->last_element_buffer[y][x] = game->element_buffer[y][x]; + game->last_element_buffer[y][x] = game->element_buffer[y][x] & ~SKIPPED; game->dir_buffer[y][x] = GD_MV_STILL; } } @@ -567,8 +574,8 @@ static GdGameState gd_game_main_int(GdGame *game, boolean allow_iterate, boolean // always render the cave to the gfx buffer; // however it may do nothing if animcycle was not changed. if (game->element_buffer && game->gfx_buffer) - gd_drawcave_game(game->cave, game->element_buffer, game->gfx_buffer, - game->bonus_life_flash != 0, game->animcycle, gd_no_invisible_outbox); + gd_drawcave_game(game->cave, game->element_buffer, game->last_element_buffer, game->gfx_buffer, + game->bonus_life_flash != 0, game->animcycle, setup.bd_show_invisible_outbox); game->state_counter = counter_next; @@ -599,13 +606,13 @@ void play_game_func(GdGame *game, int action) game->player_fire = fire; // tell the interrupt "20ms has passed" - state = gd_game_main_int(game, !game->out_of_window, gd_keystate[SDL_SCANCODE_F]); + state = gd_game_main_int(game, !game->out_of_window, FALSE); // state of game, returned by gd_game_main_int switch (state) { case GD_GAME_CAVE_LOADED: - // select colors, prepare drawing etc. + // scroll to start position gd_scroll_to_origin(); // fill whole screen with black - cave might be smaller than previous!