From: Holger Schemel Date: Sun, 5 Jun 2005 22:02:47 +0000 (+0200) Subject: rnd-20050606-1-src X-Git-Tag: 3.1.1^2~12 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=6b702ffdb8025ef5538c2607131ecae2874730c4;p=rocksndiamonds.git rnd-20050606-1-src * fixed bug with exploding bomb using R'n'D graphics in EM engine * enhanced tape autoplay to accept "autoplay [ ...]" format --- diff --git a/ChangeLog b/ChangeLog index 3f569927..f3ba3c1d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2005-06-06 + * fixed bug with exploding bomb using R'n'D graphics in EM engine + +2005-06-05 + * enhanced tape autoplay to accept "autoplay [ ...]" format + 2005-05-31 * uploaded pre-release (test) version 3.2.0-2 binary and source code diff --git a/src/conftime.h b/src/conftime.h index 2591894b..4a465568 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "[2005-06-04 02:53]" +#define COMPILE_DATE_STRING "[2005-06-05 23:57]" diff --git a/src/editor.h b/src/editor.h index f1f44184..7eaa7743 100644 --- a/src/editor.h +++ b/src/editor.h @@ -20,10 +20,6 @@ #define MAX_ELEM_X 4 #define MAX_ELEM_Y 10 -extern int element_shift; -extern int editor_element[]; -extern int elements_in_list; - void CreateLevelEditorGadgets(); void FreeLevelEditorGadgets(); void UnmapLevelEditorGadgets(); diff --git a/src/files.c b/src/files.c index 94fa3088..66860dca 100644 --- a/src/files.c +++ b/src/files.c @@ -3681,7 +3681,7 @@ static int LoadTape_BODY(FILE *file, int chunk_size, struct TapeInfo *tape) for (i = 0; i < tape->length; i++) { - if (i >= MAX_TAPELEN) + if (i >= MAX_TAPE_LEN) break; for (j = 0; j < MAX_PLAYERS; j++) @@ -4049,7 +4049,7 @@ void DumpTape(struct TapeInfo *tape) for (i = 0; i < tape->length; i++) { - if (i >= MAX_TAPELEN) + if (i >= MAX_TAPE_LEN) break; printf("%03d: ", i); diff --git a/src/init.c b/src/init.c index 6e970c2f..798f4b4a 100644 --- a/src/init.c +++ b/src/init.c @@ -2529,9 +2529,11 @@ void InitElementPropertiesStatic() EL_PENGUIN, EL_PIG, EL_DRAGON, -#if 0 /* USE_GRAVITY_BUGFIX */ + +#if 0 /* USE_GRAVITY_BUGFIX_OLD */ EL_PLAYER_IS_LEAVING, /* needed for gravity + "block last field" */ #endif + -1 }; @@ -4196,17 +4198,57 @@ void Execute_Command(char *command) } else if (strncmp(command, "autoplay ", 9) == 0) { - char *str_copy = getStringCopy(&command[9]); - char *str_ptr = strchr(str_copy, ' '); + char *str_ptr = getStringCopy(&command[9]); /* read command parameters */ + + while (*str_ptr != '\0') /* continue parsing string */ + { + /* cut leading whitespace from string, replace it by string terminator */ + while (*str_ptr == ' ' || *str_ptr == '\t') + *str_ptr++ = '\0'; + + if (*str_ptr == '\0') /* end of string reached */ + break; + + if (global.autoplay_leveldir == NULL) /* read level set string */ + { + global.autoplay_leveldir = str_ptr; + global.autoplay_all = TRUE; /* default: play all tapes */ + + for (i = 0; i < MAX_TAPES_PER_SET; i++) + global.autoplay_level[i] = FALSE; + } + else /* read level number string */ + { + int level_nr = atoi(str_ptr); /* get level_nr value */ - global.autoplay_leveldir = str_copy; - global.autoplay_level_nr = -1; + if (level_nr >= 0 && level_nr < MAX_TAPES_PER_SET) + global.autoplay_level[level_nr] = TRUE; - if (str_ptr != NULL) + global.autoplay_all = FALSE; + } + + /* advance string pointer to the next whitespace (or end of string) */ + while (*str_ptr != ' ' && *str_ptr != '\t' && *str_ptr != '\0') + str_ptr++; + } + +#if 0 + printf("level set == '%s'\n", global.autoplay_leveldir); + + if (global.autoplay_all) + printf("play all levels\n"); + else { - *str_ptr++ = '\0'; /* terminate leveldir string */ - global.autoplay_level_nr = atoi(str_ptr); /* get level_nr value */ + printf("play the following levels:"); + + for (i = 0; i < MAX_TAPES_PER_SET; i++) + if (global.autoplay_level[i]) + printf(" %03d", i); + + printf("\n"); } +#endif + } else if (strncmp(command, "convert ", 8) == 0) { @@ -4216,7 +4258,7 @@ void Execute_Command(char *command) global.convert_leveldir = str_copy; global.convert_level_nr = -1; - if (str_ptr != NULL) + if (str_ptr != NULL) /* level number follows */ { *str_ptr++ = '\0'; /* terminate leveldir string */ global.convert_level_nr = atoi(str_ptr); /* get level_nr value */ diff --git a/src/main.c b/src/main.c index 8769913c..6df9c61e 100644 --- a/src/main.c +++ b/src/main.c @@ -4360,7 +4360,7 @@ static void print_usage() " \"print helptext.conf\" print default helptext config\n" " \"dump level FILE\" dump level data from FILE\n" " \"dump tape FILE\" dump tape data from FILE\n" - " \"autoplay LEVELDIR [NR]\" play level tapes for LEVELDIR\n" + " \"autoplay LEVELDIR [NR ...]\" play level tapes for LEVELDIR\n" " \"convert LEVELDIR [NR]\" convert levels in LEVELDIR\n" "\n", program.command_basename); diff --git a/src/main.h b/src/main.h index 47b91973..7f6e8c6c 100644 --- a/src/main.h +++ b/src/main.h @@ -553,7 +553,8 @@ #define MAX_LEVEL_NAME_LEN 32 #define MAX_LEVEL_AUTHOR_LEN 32 #define MAX_ELEMENT_NAME_LEN 32 -#define MAX_TAPELEN (1000 * FRAMES_PER_SECOND) /* max.time x fps */ +#define MAX_TAPE_LEN (1000 * FRAMES_PER_SECOND) /* max.time x fps */ +#define MAX_TAPES_PER_SET 1024 #define MAX_SCORE_ENTRIES 100 #define MAX_NUM_AMOEBA 100 #define MAX_INVENTORY_SIZE 1000 @@ -1700,7 +1701,7 @@ struct TapeInfo { byte action[MAX_PLAYERS]; byte delay; - } pos[MAX_TAPELEN]; + } pos[MAX_TAPE_LEN]; boolean no_valid_file; /* set when tape file missing or invalid */ }; @@ -1747,7 +1748,8 @@ struct GameInfo struct GlobalInfo { char *autoplay_leveldir; - int autoplay_level_nr; + int autoplay_level[MAX_TAPES_PER_SET]; + boolean autoplay_all; char *convert_leveldir; int convert_level_nr; diff --git a/src/tape.c b/src/tape.c index 72c7cc73..acb05d86 100644 --- a/src/tape.c +++ b/src/tape.c @@ -802,7 +802,7 @@ void TapeRecordAction(byte action[MAX_PLAYERS]) return; #endif - if (tape.counter >= MAX_TAPELEN - 1) + if (tape.counter >= MAX_TAPE_LEN - 1) { TapeStopRecording(); return; @@ -1215,8 +1215,6 @@ void InsertSolutionTape() * tape autoplay functions * ------------------------------------------------------------------------- */ -#define MAX_NUM_AUTOPLAY_LEVELS 1000 - void AutoPlayTape() { static LevelDirTree *autoplay_leveldir = NULL; @@ -1224,7 +1222,9 @@ void AutoPlayTape() static int autoplay_level_nr = -1; static int num_levels_played = 0; static int num_levels_solved = 0; - static boolean levels_failed[MAX_NUM_AUTOPLAY_LEVELS]; + static int num_tape_missing = 0; + static boolean level_failed[MAX_TAPES_PER_SET]; + static boolean tape_missing[MAX_TAPES_PER_SET]; int i; if (autoplay_initialized) @@ -1233,10 +1233,11 @@ void AutoPlayTape() printf("%s.\n", tape.auto_play_level_solved ? "solved" : "NOT SOLVED"); num_levels_played++; + if (tape.auto_play_level_solved) num_levels_solved++; - else if (level_nr >= 0 && level_nr < MAX_NUM_AUTOPLAY_LEVELS) - levels_failed[level_nr] = TRUE; + else if (level_nr >= 0 && level_nr < MAX_TAPES_PER_SET) + level_failed[level_nr] = TRUE; } else { @@ -1252,11 +1253,10 @@ void AutoPlayTape() leveldir_current = autoplay_leveldir; - if (global.autoplay_level_nr != -1) - { - autoplay_leveldir->first_level = global.autoplay_level_nr; - autoplay_leveldir->last_level = global.autoplay_level_nr; - } + if (autoplay_leveldir->first_level < 0) + autoplay_leveldir->first_level = 0; + if (autoplay_leveldir->last_level >= MAX_TAPES_PER_SET) + autoplay_leveldir->last_level = MAX_TAPES_PER_SET - 1; autoplay_level_nr = autoplay_leveldir->first_level; @@ -1270,8 +1270,11 @@ void AutoPlayTape() printf_line("=", 79); printf("\n"); - for (i = 0; i < MAX_NUM_AUTOPLAY_LEVELS; i++) - levels_failed[i] = FALSE; + for (i = 0; i < MAX_TAPES_PER_SET; i++) + { + level_failed[i] = FALSE; + tape_missing[i] = FALSE; + } autoplay_initialized = TRUE; } @@ -1280,6 +1283,9 @@ void AutoPlayTape() { level_nr = autoplay_level_nr++; + if (!global.autoplay_all && !global.autoplay_level[level_nr]) + continue; + TapeErase(); printf("Level %03d: ", level_nr); @@ -1298,6 +1304,10 @@ void AutoPlayTape() if (TAPE_IS_EMPTY(tape)) #endif { + num_tape_missing++; + if (level_nr >= 0 && level_nr < MAX_TAPES_PER_SET) + tape_missing[level_nr] = TRUE; + printf("(no tape)\n"); continue; } @@ -1324,8 +1334,16 @@ void AutoPlayTape() if (num_levels_played != num_levels_solved) { printf(", FAILED:"); - for (i = 0; i < MAX_NUM_AUTOPLAY_LEVELS; i++) - if (levels_failed[i]) + for (i = 0; i < MAX_TAPES_PER_SET; i++) + if (level_failed[i]) + printf(" %03d", i); + } + + if (num_tape_missing > 0) + { + printf(", NO TAPE:"); + for (i = 0; i < MAX_TAPES_PER_SET; i++) + if (tape_missing[i]) printf(" %03d", i); } diff --git a/src/tools.c b/src/tools.c index 13ba8301..eedf5d60 100644 --- a/src/tools.c +++ b/src/tools.c @@ -3855,7 +3855,7 @@ em_object_mapping_list[] = }, { Ybomb_eat, FALSE, FALSE, - EL_BOMB, ACTION_SMASHED_BY_ROCK, -1 + EL_BOMB, ACTION_ACTIVATING, -1 }, { Xballoon, TRUE, FALSE,