removed unused functions and definitions
authorHolger Schemel <info@artsoft.org>
Tue, 20 Feb 2024 19:05:43 +0000 (20:05 +0100)
committerHolger Schemel <info@artsoft.org>
Tue, 20 Feb 2024 19:05:43 +0000 (20:05 +0100)
src/game_bd/bd_cave.c
src/game_bd/bd_cave.h
src/game_bd/bd_gameplay.c
src/game_bd/bd_gameplay.h

index b0f1573ef52d96992e70bb6aa6cccdc1680ec9cc..8284fd3569969558f96eef773d7b6e49515c389c 100644 (file)
@@ -1429,26 +1429,6 @@ void gd_replay_store_movement(GdReplay *replay, GdDirection player_move,
   g_byte_array_append(replay->movements, data, 1);
 }
 
-/* get next available movement from a replay; store variables to player_move,
-   player_fire, suicide */
-/* return true if successful */
-boolean gd_replay_get_next_movement(GdReplay *replay, GdDirection *player_move,
-                                   boolean *player_fire, boolean *suicide)
-{
-  guint8 data;
-
-  /* if no more available movements */
-  if (replay->current_playing_pos >= replay->movements->len)
-    return FALSE;
-
-  data = replay->movements->data[replay->current_playing_pos++];
-  *suicide = (data & GD_REPLAY_SUICIDE_MASK) != 0;
-  *player_fire = (data & GD_REPLAY_FIRE_MASK) != 0;
-  *player_move = (data & GD_REPLAY_MOVE_MASK);
-
-  return TRUE;
-}
-
 /* calculate adler checksum for a rendered cave; this can be used for more caves. */
 void gd_cave_adler_checksum_more(GdCave *cave, guint32 *a, guint32 *b)
 {
index bd677ead2280668ff791dc6cfd72039a13cc9888..35b2b80b9d58ad41a71888db18f894aa53a40a37 100644 (file)
@@ -712,7 +712,6 @@ GdReplay *gd_replay_new(void);
 GdReplay *gd_replay_new_from_replay(GdReplay *orig);
 void gd_replay_free(GdReplay *replay);
 void gd_replay_store_movement(GdReplay *replay, GdDirection player_move, boolean player_fire, boolean suicide);
-boolean gd_replay_get_next_movement(GdReplay *replay, GdDirection *player_move, boolean *player_fire, boolean *suicide);
 
 guint32 gd_cave_adler_checksum(GdCave *cave);
 void gd_cave_adler_checksum_more(GdCave *cave, guint32 *a, guint32 *b);
index ec757454f4f125945fb27e86a1d6bf9c6900bf9a..483d21eb258e5bc00ddfc9aad36f0bbc9abd72c4 100644 (file)
@@ -43,64 +43,16 @@ void gd_game_free(GdGame *game)
   if (game->cave)
     gd_cave_free(game->cave);
 
-  /* if we recorded some replays during this run, we check them.
-     we remove those which are too short */
-  if (game->replays_recorded)
-  {
-    GList *citer;
-
-    /* check all caves */
-    for (citer = gd_caveset; citer != NULL; citer = citer->next)
-    {
-      GdCave *cave = (GdCave *)citer->data;
-      GList *riter;
-
-      /* check replays of all caves */
-      for (riter = cave->replays; riter != NULL; )
-      {
-       GdReplay *replay = (GdReplay *)riter->data;
-
-       /* remember next iter, as we may delete the current */
-       GList *nextrep = riter->next;
-
-       /* if we recorded this replay now, and it is too short, we delete it */
-       /* but do not delete successful ones! */
-       if (g_list_find(game->replays_recorded, replay) &&
-           (replay->movements->len < 16) &&
-           (!replay->success))
-       {
-         /* delete from list */
-         cave->replays = g_list_delete_link(cave->replays, riter);
-
-         /* also free replay */
-         gd_replay_free(replay);
-       }
-
-       riter = nextrep;
-      }
-    }
-
-    /* free the list of newly recorded replays, as we checked them */
-    g_list_free(game->replays_recorded);
-    game->replays_recorded = NULL;
-  }
-
   free(game);
 }
 
 /* add bonus life. if sound enabled, play sound, too. */
 static void add_bonus_life(GdGame *game, boolean inform_user)
 {
-  /* only inform about bonus life when playing a game */
-  /* or when testing the cave (so the user can see that a bonus life can be earned in that cave */
-  if (game->type == GD_GAMETYPE_NORMAL ||
-      game->type == GD_GAMETYPE_TEST)
+  if (inform_user)
   {
-    if (inform_user)
-    {
-      gd_sound_play_bonus_life();
-      game->bonus_life_flash = 100;
-    }
+    gd_sound_play_bonus_life();
+    game->bonus_life_flash = 100;
   }
 
   /* really increment number of lifes? only in a real game, nowhere else. */
@@ -125,10 +77,6 @@ static void increment_score(GdGame *game, int increment)
   game->player_score += increment;
   game->cave_score += increment;
 
-  /* also record to replay */
-  if (game->replay_record)
-    game->replay_record->score += increment;
-
   /* if score crossed bonus_life_score point boundary, player won a bonus life */
   if (game->player_score / gd_caveset_data->bonus_life_score > i)
     add_bonus_life(game, TRUE);
@@ -235,7 +183,6 @@ GdGame *gd_game_new(const int cave, const int level)
   game->player_move_stick = FALSE;
   game->player_fire = FALSE;
 
-  game->type = GD_GAMETYPE_NORMAL;
   game->state_counter = GAME_INT_LOAD_CAVE;
 
   game->show_story = TRUE;
@@ -243,67 +190,13 @@ GdGame *gd_game_new(const int cave, const int level)
   return game;
 }
 
-/* starts a new snapshot playing */
-GdGame *gd_game_new_replay(GdCave *cave, GdReplay *replay)
-{
-  GdGame *game;
-
-  game = checked_calloc(sizeof(GdGame));
-
-  gd_strcpy(game->player_name, "");
-
-  game->player_lives = 0;
-  game->player_score = 0;
-
-  game->player_move = GD_MV_STILL;
-  game->player_move_stick = FALSE;
-  game->player_fire = FALSE;
-
-  game->original_cave = cave;
-  game->replay_from = replay;
-
-  game->type = GD_GAMETYPE_REPLAY;
-  game->state_counter = GAME_INT_LOAD_CAVE;
-
-  return game;
-}
-
 static void iterate_cave(GdGame *game, GdDirection player_move, boolean fire)
 {
   boolean suicide = FALSE;
 
-  /* if we are playing a replay, but the user intervents, continue as a snapshot. */
-  /* do not trigger this for fire, as it would not be too intuitive. */
-  if (game->type == GD_GAMETYPE_REPLAY)
-  {
-    if (player_move != GD_MV_STILL)
-    {
-      game->type = GD_GAMETYPE_CONTINUE_REPLAY;
-      game->replay_from = NULL;
-    }
-  }
-
   /* ANYTHING EXCEPT A TIMEOUT, WE ITERATE THE CAVE */
   if (game->cave->player_state != GD_PL_TIMEOUT)
   {
-    /* IF PLAYING FROM REPLAY, OVERWRITE KEYPRESS VARIABLES FROM REPLAY */
-    if (game->type == GD_GAMETYPE_REPLAY)
-    {
-      boolean result;
-
-      /* if the user does touch the keyboard, we immediately exit replay,
-        and he can continue playing */
-      result = gd_replay_get_next_movement(game->replay_from, &player_move, &fire, &suicide);
-      /* if could not get move from snapshot, continue from keyboard input. */
-      if (!result)
-       game->replay_no_more_movements++;
-
-      /* if no more available movements, and the user does not do anything,
-        we cover cave and stop game. */
-      if (game->replay_no_more_movements > 15)
-       game->state_counter = GAME_INT_COVER_START;
-    }
-
     if (TapeIsPlaying_ReplayBD())
     {
       byte *action_rnd = TapePlayAction_BD();
@@ -320,9 +213,6 @@ static void iterate_cave(GdGame *game, GdDirection player_move, boolean fire)
     /* iterate cave */
     gd_cave_iterate(game->cave, player_move, fire, suicide);
 
-    if (game->replay_record)
-      gd_replay_store_movement(game->replay_record, player_move, fire, suicide);
-
     if (game->cave->score)
       increment_score(game, game->cave->score);
 
@@ -339,9 +229,6 @@ static void iterate_cave(GdGame *game, GdDirection player_move, boolean fire)
       add_bonus_life(game, FALSE);
     }
 
-    if (game->replay_record)
-      game->replay_record->success = TRUE;
-
     /* start adding points for remaining time */
     game->state_counter = GAME_INT_CHECK_BONUS_TIME;
     gd_cave_clear_sounds(game->cave);
@@ -596,7 +483,7 @@ static GdGameState gd_game_main_int(GdGame *game, boolean allow_iterate, boolean
     /* if no more lives, game is over. */
     counter_next = game->state_counter;
 
-    if (game->type == GD_GAMETYPE_NORMAL && game->player_lives == 0)
+    if (game->player_lives == 0)
       return_state = GD_GAME_NO_MORE_LIVES;
     else
       return_state = GD_GAME_NOTHING;
@@ -664,19 +551,10 @@ static GdGameState gd_game_main_int(GdGame *game, boolean allow_iterate, boolean
   {
     /* cover all + 1 */
 
-    /* if this is a normal game: */
-    if (game->type == GD_GAMETYPE_NORMAL)
-    {
-      if (game->player_lives != 0)
-       return_state = GD_GAME_NOTHING;    /* and go to next level */
-      else
-       return_state = GD_GAME_GAME_OVER;
-    }
+    if (game->player_lives != 0)
+      return_state = GD_GAME_NOTHING;    /* and go to next level */
     else
-    {
-      /* for snapshots and replays and the like, this is the end. */
-      return_state = GD_GAME_STOP;
-    }
+      return_state = GD_GAME_GAME_OVER;
   }
 
   /* draw the cave */
index 6cd016ec51308cb1c10126f37cb0c9d777ff4731..b87a3aeabddf4afc48ac76c6a3c1c56e407164f7 100644 (file)
 /* ... 8 frames of cover animation */
 #define GAME_INT_COVER_ALL             108
 
-typedef enum _gd_gametype
-{
-  GD_GAMETYPE_NORMAL,
-  GD_GAMETYPE_SNAPSHOT,
-  GD_GAMETYPE_TEST,
-  GD_GAMETYPE_REPLAY,
-  GD_GAMETYPE_CONTINUE_REPLAY,
-} GdGameType;
 
 typedef struct _gd_game
 {
@@ -73,16 +65,9 @@ typedef struct _gd_game
   boolean player_move_stick;
   boolean player_fire;
 
-  GdGameType type;
-
   GdCave *cave;             /* Copy of the cave. This is the iterated, changed (ruined...) one */
   GdCave *original_cave;    /* original cave from caveset. used to record highscore */
 
-  GdReplay *replay_record;
-  GdReplay *replay_from;
-
-  GList *replays_recorded;
-
   boolean out_of_window;   /* will be set to true, if player is not visible in the window, and we have to wait for scrolling */
 
   int cave_num;             /* actual playing cave number */
@@ -126,7 +111,6 @@ void gd_game_free(GdGame *gameplay);
 GdGame *gd_game_new(const int cave, const int level);
 GdGame *gd_game_new_snapshot(GdCave *snapshot);
 GdGame *gd_game_new_test(GdCave *cave, int level);
-GdGame *gd_game_new_replay(GdCave *cave, GdReplay *replay);
 
 void play_game_func(GdGame *game, int action);