removed unused functions and definitions
authorHolger Schemel <info@artsoft.org>
Tue, 20 Feb 2024 00:31:23 +0000 (01:31 +0100)
committerHolger Schemel <info@artsoft.org>
Tue, 20 Feb 2024 01:08:47 +0000 (02:08 +0100)
src/game_bd/bd_cave.c
src/game_bd/bd_cave.h
src/game_bd/bd_caveobject.c
src/game_bd/bd_caveobject.h

index 9e281798013e74526ca05b0938fc0e620d906de4..86b07a889bee26e1a36866053f22b8e78b1e8df3 100644 (file)
@@ -1457,105 +1457,6 @@ boolean gd_replay_get_next_movement(GdReplay *replay, GdDirection *player_move,
   return TRUE;
 }
 
-void gd_replay_rewind(GdReplay *replay)
-{
-  replay->current_playing_pos = 0;
-}
-
-#define REPLAY_BDCFF_UP                        "u"
-#define REPLAY_BDCFF_UP_RIGHT          "ur"
-#define REPLAY_BDCFF_RIGHT             "r"
-#define REPLAY_BDCFF_DOWN_RIGHT                "dr"
-#define REPLAY_BDCFF_DOWN              "d"
-#define REPLAY_BDCFF_DOWN_LEFT         "dl"
-#define REPLAY_BDCFF_LEFT              "l"
-#define REPLAY_BDCFF_UP_LEFT           "ul"
-/* when not moving */
-#define REPLAY_BDCFF_STILL             "."
-/* when the fire is pressed */
-#define REPLAY_BDCFF_FIRE              "F"
-#define REPLAY_BDCFF_SUICIDE           "k"
-
-static char *direction_to_bdcff(GdDirection mov)
-{
-  switch (mov)
-  {
-    /* not moving */
-    case GD_MV_STILL:          return REPLAY_BDCFF_STILL;
-
-      /* directions */
-    case GD_MV_UP:             return REPLAY_BDCFF_UP;
-    case GD_MV_UP_RIGHT:       return REPLAY_BDCFF_UP_RIGHT;
-    case GD_MV_RIGHT:          return REPLAY_BDCFF_RIGHT;
-    case GD_MV_DOWN_RIGHT:     return REPLAY_BDCFF_DOWN_RIGHT;
-    case GD_MV_DOWN:           return REPLAY_BDCFF_DOWN;
-    case GD_MV_DOWN_LEFT:      return REPLAY_BDCFF_DOWN_LEFT;
-    case GD_MV_LEFT:           return REPLAY_BDCFF_LEFT;
-    case GD_MV_UP_LEFT:                return REPLAY_BDCFF_UP_LEFT;
-
-    default:
-      return REPLAY_BDCFF_STILL;
-  }
-}
-
-/* same as above; pressing fire will be a capital letter. */
-static char *direction_fire_to_bdcff(GdDirection dir, boolean fire)
-{
-  static char mov[10];
-
-  strcpy(mov, direction_to_bdcff(dir));
-
-  if (fire)
-  {
-    int i;
-
-    for (i = 0; mov[i] != 0; i++)
-      mov[i] = g_ascii_toupper(mov[i]);
-  }
-
-  return mov;
-}
-
-char *gd_replay_movements_to_bdcff(GdReplay *replay)
-{
-  int pos;
-  GString *str;
-
-  str = g_string_new(NULL);
-
-  for (pos = 0; pos < replay->movements->len; pos++)
-  {
-    int num = 1;
-    guint8 data;
-
-    /* if this is not the first movement, append a space. */
-    if (str->len != 0)
-      g_string_append_c(str, ' ');
-
-    /* if same byte appears, count number of occurrences - something like an rle compression. */
-    /* be sure not to cross the array boundaries */
-    while (pos < replay->movements->len - 1 &&
-          replay->movements->data[pos] == replay->movements->data[pos + 1])
-    {
-      pos++;
-      num++;
-    }
-
-    data = replay->movements->data[pos];
-
-    if (data & GD_REPLAY_SUICIDE_MASK)
-      g_string_append(str, REPLAY_BDCFF_SUICIDE);
-
-    g_string_append(str, direction_fire_to_bdcff(data & GD_REPLAY_MOVE_MASK,
-                                                data & GD_REPLAY_FIRE_MASK));
-
-    if (num != 1)
-      g_string_append_printf(str, "%d", num);
-  }
-
-  return g_string_free(str, FALSE);
-}
-
 /* 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 c9c4a432811b96d99e5147465abe07c89d74285d..aa27a5f73604efe438a7913dcb3947f824d40966 100644 (file)
@@ -713,9 +713,6 @@ 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);
-void gd_replay_rewind(GdReplay *replay);
-
-char *gd_replay_movements_to_bdcff(GdReplay *replay);
 
 guint32 gd_cave_adler_checksum(GdCave *cave);
 void gd_cave_adler_checksum_more(GdCave *cave, guint32 *a, guint32 *b);
index dc105cdad01f6802a16b9c9fd76cd050e6ab8cf9..e2814c8bf8f0b6f82e88b00e2b3f924c51f9fefa 100644 (file)
@@ -29,134 +29,6 @@ GdObjectLevels gd_levels_mask[] =
   GD_OBJECT_LEVEL5
 };
 
-/* bdcff text description of object. caller should free string. */
-char *gd_object_get_bdcff(const GdObject *object)
-{
-  GString *str;
-  int j;
-  const char *type;
-
-  switch (object->type)
-  {
-    case GD_POINT:
-      return g_strdup_printf("Point=%d %d %s",
-                            object->x1, object->y1,
-                            gd_elements[object->element].filename);
-
-    case GD_LINE:
-      return g_strdup_printf("Line=%d %d %d %d %s",
-                            object->x1, object->y1, object->x2, object->y2,
-                            gd_elements[object->element].filename);
-
-    case GD_RECTANGLE:
-      return g_strdup_printf("Rectangle=%d %d %d %d %s",
-                            object->x1, object->y1, object->x2, object->y2,
-                            gd_elements[object->element].filename);
-
-    case GD_FILLED_RECTANGLE:
-      /* if elements are not the same */
-      if (object->fill_element != object->element)
-       return g_strdup_printf("FillRect=%d %d %d %d %s %s",
-                              object->x1, object->y1, object->x2, object->y2,
-                              gd_elements[object->element].filename,
-                              gd_elements[object->fill_element].filename);
-
-      /* they are the same */
-      return g_strdup_printf("FillRect=%d %d %d %d %s",
-                            object->x1, object->y1, object->x2, object->y2,
-                            gd_elements[object->element].filename);
-
-    case GD_RASTER:
-      return g_strdup_printf("Raster=%d %d %d %d %d %d %s",
-                            object->x1, object->y1,
-                            (object->x2 - object->x1) / object->dx + 1,
-                            (object->y2 - object->y1) / object->dy + 1,
-                            object->dx, object->dy,
-                            gd_elements[object->element].filename);
-
-    case GD_JOIN:
-      return g_strdup_printf("Add=%d %d %s %s",
-                            object->dx, object->dy,
-                            gd_elements[object->element].filename,
-                            gd_elements[object->fill_element].filename);
-
-    case GD_FLOODFILL_BORDER:
-      return g_strdup_printf("BoundaryFill=%d %d %s %s",
-                            object->x1, object->y1,
-                            gd_elements[object->fill_element].filename,
-                            gd_elements[object->element].filename);
-
-    case GD_FLOODFILL_REPLACE:
-      return g_strdup_printf("FloodFill=%d %d %s %s",
-                            object->x1, object->y1,
-                            gd_elements[object->fill_element].filename,
-                            gd_elements[object->element].filename);
-
-    case GD_MAZE:
-    case GD_MAZE_UNICURSAL:
-    case GD_MAZE_BRAID:
-      switch (object->type)
-      {
-       case GD_MAZE: type = "perfect"; break;
-       case GD_MAZE_UNICURSAL: type = "unicursal"; break;
-       case GD_MAZE_BRAID: type = "braid"; break;
-       default: break;
-      }
-
-      return g_strdup_printf("Maze=%d %d %d %d %d %d %d %d %d %d %d %d %s %s %s",
-                            object->x1, object->y1, object->x2, object->y2,
-                            object->dx, object->dy,
-                            object->horiz,
-                            object->seed[0],
-                            object->seed[1],
-                            object->seed[2],
-                            object->seed[3],
-                            object->seed[4],
-                            gd_elements[object->element].filename,
-                            gd_elements[object->fill_element].filename, type);
-
-    case GD_RANDOM_FILL:
-      str = g_string_new(NULL);
-      /* seed and initial fill */
-      g_string_append_printf(str, "%s=%d %d %d %d %d %d %d %d %d %s",
-                            object->c64_random ? "RandomFillC64" : "RandomFill",
-                            object->x1, object->y1, object->x2, object->y2,
-                            object->seed[0],
-                            object->seed[1],
-                            object->seed[2],
-                            object->seed[3],
-                            object->seed[4],
-                            gd_elements[object->fill_element].filename);
-
-      for (j = 0; j < 4; j++)
-      {
-       if (object->random_fill_probability[j] != 0)
-         g_string_append_printf(str, " %s %d",
-                                gd_elements[object->random_fill[j]].filename,
-                                object->random_fill_probability[j]);
-      }
-
-      if (object->element!=O_NONE)
-       g_string_append_printf(str, " %s",
-                              gd_elements[object->element].filename);
-
-      /* free string but do not free char *; return char *. */
-      return g_string_free(str, FALSE);
-
-    case GD_COPY_PASTE:
-      return g_strdup_printf("CopyPaste=%d %d %d %d %d %d %s %s",
-                            object->x1, object->y1, object->x2, object->y2,
-                            object->dx, object->dy,
-                            object->mirror ? "mirror" : "nomirror",
-                            object->flip?"flip":"noflip");
-
-    case NONE:
-      break;
-  }
-
-  return NULL;
-}
-
 /* create an INDIVIDUAL POINT CAVE OBJECT */
 GdObject *gd_object_new_point(GdObjectLevels levels, int x, int y, GdElement elem)
 {
index 475255ea786935ea3688a6655377ba7ef0a7bc7a..5b2a3f7e7bf554fd3c779f7be585a2144d67f44f 100644 (file)
@@ -93,7 +93,6 @@ GdObject *gd_object_new_random_fill(GdObjectLevels levels, int x1, int y1, int x
 GdObject *gd_object_new_copy_paste(GdObjectLevels levels, int x1, int y1, int x2, int y2, int dx, int dy, boolean mirror, boolean flip);
 
 void gd_cave_draw_object(GdCave *cave, const GdObject *object, int level);
-char *gd_object_get_bdcff(const GdObject *object);
 GdObject *gd_object_new_from_string(char *str);
 
 GdCave *gd_cave_new_rendered(const GdCave *data, const int level, guint32 seed);