From: Holger Schemel Date: Tue, 20 Feb 2024 00:31:23 +0000 (+0100) Subject: removed unused functions and definitions X-Git-Tag: 4.4.0.0-test-1~331 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=d2b7c541271aec188c9394af58cdb8d9f66d88b9;p=rocksndiamonds.git removed unused functions and definitions --- diff --git a/src/game_bd/bd_cave.c b/src/game_bd/bd_cave.c index 9e281798..86b07a88 100644 --- a/src/game_bd/bd_cave.c +++ b/src/game_bd/bd_cave.c @@ -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) { diff --git a/src/game_bd/bd_cave.h b/src/game_bd/bd_cave.h index c9c4a432..aa27a5f7 100644 --- a/src/game_bd/bd_cave.h +++ b/src/game_bd/bd_cave.h @@ -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); diff --git a/src/game_bd/bd_caveobject.c b/src/game_bd/bd_caveobject.c index dc105cda..e2814c8b 100644 --- a/src/game_bd/bd_caveobject.c +++ b/src/game_bd/bd_caveobject.c @@ -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) { diff --git a/src/game_bd/bd_caveobject.h b/src/game_bd/bd_caveobject.h index 475255ea..5b2a3f7e 100644 --- a/src/game_bd/bd_caveobject.h +++ b/src/game_bd/bd_caveobject.h @@ -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);