CloseAllAndExit(0);
}
+void DumpLevelsetFromFilename_BD(char *filename)
+{
+ if (leveldir_current == NULL) // no levelsets loaded yet
+ bd_open_all();
+
+ if (!LoadNativeLevel_BD(filename, 0, FALSE))
+ CloseAllAndExit(0); // function has already printed warning
+
+ PrintLine("-", 79);
+ Print("Levelset '%s'\n", filename);
+ PrintLine("-", 79);
+
+ DumpLevelset_BD();
+
+ PrintLine("-", 79);
+
+ CloseAllAndExit(0);
+}
+
+void DumpLevelset(void)
+{
+ static LevelDirTree *dumplevelset_leveldir = NULL;
+
+ dumplevelset_leveldir = getTreeInfoFromIdentifier(leveldir_first,
+ global.dumplevelset_leveldir);
+ if (dumplevelset_leveldir == NULL)
+ Fail("no such level identifier: '%s'", global.dumplevelset_leveldir);
+
+ PrintLine("-", 79);
+ Print("Levelset '%s'\n", dumplevelset_leveldir->identifier);
+ PrintLine("-", 79);
+
+ Print("Number of levels: %d\n", dumplevelset_leveldir->levels);
+ Print("First level number: %d\n", dumplevelset_leveldir->first_level);
+
+ PrintLine("-", 79);
+
+ CloseAllAndExit(0);
+}
+
// ============================================================================
// tape file functions
void SaveNativeLevel(struct LevelInfo *);
void DumpLevel(struct LevelInfo *);
void DumpLevels(void);
+void DumpLevelsetFromFilename_BD(char *);
+void DumpLevelset(void);
boolean SaveLevelChecked(int);
void CopyNativeLevel_RND_to_Native(struct LevelInfo *);
void setLevelInfoToDefaults_BD(void);
boolean LoadNativeLevel_BD(char *, int, boolean);
boolean SaveNativeLevel_BD(char *);
+void DumpLevelset_BD(void);
void PreparePreviewTileBitmap_BD(Bitmap *, int);
void SetPreviewTileBitmapReference_BD(Bitmap *);
return gd_caveset_save_to_file(filename);
}
+void DumpLevelset_BD(void)
+{
+ Print("Number of levels: %d\n", 5 * gd_caveset_count());
+ Print("First level number: %d\n", 1);
+}
+
// ============================================================================
// game engine functions
global.autoplay_leveldir = NULL;
global.patchtapes_leveldir = NULL;
global.convert_leveldir = NULL;
+ global.dumplevelset_leveldir = NULL;
global.dumplevel_leveldir = NULL;
global.dumptape_leveldir = NULL;
global.create_sketch_images_dir = NULL;
exit(0);
}
+ else if (strPrefix(command, "dump levelset "))
+ {
+ char *filename = &command[14];
+
+ if (fileExists(filename) && isLevelsetFilename_BD(filename))
+ {
+ DumpLevelsetFromFilename_BD(filename);
+
+ exit(0);
+ }
+
+ char *leveldir = getStringCopy(filename); // read command parameters
+
+ global.dumplevelset_leveldir = leveldir;
+
+ program.headless = TRUE;
+ }
else if (strPrefix(command, "dump level "))
{
char *filename = &command[11];
ConvertLevels();
return;
}
+ else if (global.dumplevelset_leveldir)
+ {
+ DumpLevelset();
+ return;
+ }
else if (global.dumplevel_leveldir)
{
DumpLevels();
" \"print editorsetup.conf\" print default editor config\n"
" \"print helpanim.conf\" print default helpanim config\n"
" \"print helptext.conf\" print default helptext config\n"
+ " \"dump levelset FILE|LEVELDIR\" dump levelset info for LEVELDIR\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"
char *convert_leveldir;
int convert_level_nr;
+ char *dumplevelset_leveldir;
+
char *dumplevel_leveldir;
int dumplevel_level_nr;