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)
{