+2004-06-06
+ * added option "convert LEVELDIR [NR]" to command line batch commands
+ * re-converted Supaplex levels to apply latest engine fixes
+ * changed "use graphic/sound of element" to "use graphic of element"
+ due to compatibility problems with some levels ("bug machine" etc.)
+
2004-05-23
* fixed bug with CE change replacing player with same or other player
-#define COMPILE_DATE_STRING "[2004-05-23 22:37]"
+#define COMPILE_DATE_STRING "[2004-06-06 16:37]"
ED_SETTINGS_XPOS(0), ED_SETTINGS_YPOS(1),
GADGET_ID_CUSTOM_USE_GRAPHIC, GADGET_ID_NONE,
&custom_element.use_gfx_element,
+#if 0
NULL, "use graphic/sound of element:", "use existing graphic and sound"
+#else
+ NULL, "use graphic of element:", "use existing element graphic"
+#endif
},
{
ED_SETTINGS_XPOS(0), ED_SETTINGS_YPOS(2),
END_HASH_ITERATION(hash, itr)
#endif
}
+
+
+/* ------------------------------------------------------------------------- *
+ * convert levels
+ * ------------------------------------------------------------------------- */
+
+#define MAX_NUM_CONVERT_LEVELS 1000
+
+void ConvertLevels()
+{
+ static LevelDirTree *convert_leveldir = NULL;
+ static int convert_level_nr = -1;
+ static int num_levels_handled = 0;
+ static int num_levels_converted = 0;
+ static boolean levels_failed[MAX_NUM_CONVERT_LEVELS];
+ int i;
+
+ convert_leveldir = getTreeInfoFromIdentifier(leveldir_first,
+ global.convert_leveldir);
+
+ if (convert_leveldir == NULL)
+ Error(ERR_EXIT, "no such level identifier: '%s'",
+ global.convert_leveldir);
+
+ leveldir_current = convert_leveldir;
+
+ if (global.convert_level_nr != -1)
+ {
+ convert_leveldir->first_level = global.convert_level_nr;
+ convert_leveldir->last_level = global.convert_level_nr;
+ }
+
+ convert_level_nr = convert_leveldir->first_level;
+
+ printf_line("=", 79);
+ printf("Converting levels\n");
+ printf_line("-", 79);
+ printf("Level series identifier: '%s'\n", convert_leveldir->identifier);
+ printf("Level series name: '%s'\n", convert_leveldir->name);
+ printf("Level series author: '%s'\n", convert_leveldir->author);
+ printf("Number of levels: %d\n", convert_leveldir->levels);
+ printf_line("=", 79);
+ printf("\n");
+
+ for (i = 0; i < MAX_NUM_CONVERT_LEVELS; i++)
+ levels_failed[i] = FALSE;
+
+ while (convert_level_nr <= convert_leveldir->last_level)
+ {
+ char *level_filename;
+ boolean new_level;
+
+ level_nr = convert_level_nr++;
+
+ printf("Level %03d: ", level_nr);
+
+ LoadLevel(level_nr);
+ if (level.no_valid_file)
+ {
+ printf("(no level)\n");
+ continue;
+ }
+
+ printf("converting level ... ");
+
+ level_filename = getDefaultLevelFilename(level_nr);
+ new_level = !fileExists(level_filename);
+
+ if (new_level)
+ {
+ SaveLevel(level_nr);
+
+ num_levels_converted++;
+
+ printf("converted.\n");
+ }
+ else
+ {
+ if (level_nr >= 0 && level_nr < MAX_NUM_CONVERT_LEVELS)
+ levels_failed[level_nr] = TRUE;
+
+ printf("NOT CONVERTED -- LEVEL ALREADY EXISTS.\n");
+ }
+
+ num_levels_handled++;
+ }
+
+ printf("\n");
+ printf_line("=", 79);
+ printf("Number of levels handled: %d\n", num_levels_handled);
+ printf("Number of levels converted: %d (%d%%)\n", num_levels_converted,
+ (num_levels_handled ?
+ num_levels_converted * 100 / num_levels_handled : 0));
+ printf_line("-", 79);
+ printf("Summary (for automatic parsing by scripts):\n");
+ printf("LEVELDIR '%s', CONVERTED %d/%d (%d%%)",
+ convert_leveldir->identifier, num_levels_converted,
+ num_levels_handled,
+ (num_levels_handled ?
+ num_levels_converted * 100 / num_levels_handled : 0));
+
+ if (num_levels_handled != num_levels_converted)
+ {
+ printf(", FAILED:");
+ for (i = 0; i < MAX_NUM_CONVERT_LEVELS; i++)
+ if (levels_failed[i])
+ printf(" %03d", i);
+ }
+
+ printf("\n");
+ printf_line("=", 79);
+
+ CloseAllAndExit(0);
+}
void LoadHelpAnimInfo();
void LoadHelpTextInfo();
+void ConvertLevels(void);
+
#endif /* FILES_H */
static void InitGlobal()
{
global.autoplay_leveldir = NULL;
+ global.convert_leveldir = NULL;
global.frames_per_second = 0;
global.fps_slowdown = FALSE;
global.autoplay_level_nr = atoi(str_ptr); /* get level_nr value */
}
}
+ else if (strncmp(command, "convert ", 8) == 0)
+ {
+ char *str_copy = getStringCopy(&command[8]);
+ char *str_ptr = strchr(str_copy, ' ');
+
+ global.convert_leveldir = str_copy;
+ global.convert_level_nr = -1;
+
+ if (str_ptr != NULL)
+ {
+ *str_ptr++ = '\0'; /* terminate leveldir string */
+ global.convert_level_nr = atoi(str_ptr); /* get level_nr value */
+ }
+ }
else
{
Error(ERR_EXIT_HELP, "unrecognized command '%s'", command);
AutoPlayTape();
return;
}
+ else if (global.convert_leveldir)
+ {
+ ConvertLevels();
+ return;
+ }
game_status = GAME_MODE_MAIN;
" --serveronly only start network server\n"
" -v, --verbose verbose mode\n"
" --debug display debugging information\n"
- " -e, --execute COMMAND execute batch COMMAND:\n"
+ " -e, --execute COMMAND execute batch COMMAND\n"
"\n"
"Valid commands for '--execute' option:\n"
" \"print graphicsinfo.conf\" print default graphics config\n"
" \"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\" 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);
}
#define GFX_ELEMENT(e) (element_info[e].use_gfx_element ? \
element_info[e].gfx_element : e)
+/* !!! "use sound" deactivated due to problems with level "bug machine" !!! */
+/* (solution: add separate "use sound of element" to level file and editor) */
+#if 0
#define SND_ELEMENT(e) GFX_ELEMENT(e)
+#else
+#define SND_ELEMENT(e) (e)
+#endif
#define IS_PLAYER(x, y) (ELEM_IS_PLAYER(StorePlayer[x][y]))
char *autoplay_leveldir;
int autoplay_level_nr;
+ char *convert_leveldir;
+ int convert_level_nr;
+
int num_toons;
float frames_per_second;
printf("LEVELDIR '%s', SOLVED %d/%d (%d%%)",
autoplay_leveldir->identifier, num_levels_solved, num_levels_played,
(num_levels_played ? num_levels_solved * 100 / num_levels_played :0));
+
if (num_levels_played != num_levels_solved)
{
printf(", FAILED:");
if (levels_failed[i])
printf(" %03d", i);
}
+
printf("\n");
printf_line("=", 79);