IS_LEVELCLASS_USER(n) ? 7 : \
9)
-#define TOKEN_VALUE_POSITION 30
+#define TOKEN_VALUE_POSITION 40
+#define TOKEN_COMMENT_POSITION 60
#define MAX_COOKIE_LEN 256
return NULL; /* cannot find image file */
}
+char *getCustomSoundConfigFilename()
+{
+ return getCustomSoundFilename(SOUNDSINFO_FILENAME);
+}
+
+char *getCustomMusicDirectory(void)
+{
+ static char *directory = NULL;
+
+ if (directory != NULL)
+ free(directory);
+
+ /* 1st try: look for special artwork in current level series directory */
+ directory = getPath2(getCurrentLevelDir(), MUSIC_DIRECTORY);
+ if (fileExists(directory))
+ return directory;
+
+ /* 2nd try: look for special artwork in private artwork directory */
+ directory = getStringCopy(getUserMusicDir());
+ if (fileExists(directory))
+ return directory;
+
+ /* 3rd try: look for special artwork in configured artwork directory */
+ directory = getStringCopy(getSetupArtworkDir(artwork.mus_current));
+ if (fileExists(directory))
+ return directory;
+
+ /* 4th try: look for default artwork in new default artwork directory */
+ directory = getStringCopy(getDefaultMusicDir(MUSIC_SUBDIR));
+ if (fileExists(directory))
+ return directory;
+
+ /* 5th try: look for default artwork in old default artwork directory */
+ directory = getStringCopy(options.music_directory);
+ if (fileExists(directory))
+ return directory;
+
+ return NULL; /* cannot find image file */
+}
+
void InitTapeDirectory(char *level_subdir)
{
createDirectory(getUserDataDir(), "user data", PERMS_PRIVATE);
int i;
static char entry[MAX_LINE_LEN];
+ /* start with the token and some spaces to format output line */
sprintf(entry, "%s:", token);
for (i=strlen(entry); i<TOKEN_VALUE_POSITION; i++)
- entry[i] = ' ';
- entry[i] = '\0';
+ strcat(entry, " ");
+ /* continue with the token's value */
strcat(entry, value);
return entry;
if (node_parent == NULL) /* top level group */
{
- artwork_new->basepath = base_directory;
- artwork_new->fullpath = artwork_new->filename;
+ artwork_new->basepath = getStringCopy(base_directory);
+ artwork_new->fullpath = getStringCopy(artwork_new->filename);
}
else /* sub level group */
{
- artwork_new->basepath = node_parent->basepath;
+ artwork_new->basepath = getStringCopy(node_parent->basepath);
artwork_new->fullpath = getPath2(node_parent->fullpath, directory_name);
}
artwork.sounds_set_current = artwork.snd_current->name;
artwork.music_set_current = artwork.mus_current->name;
+#if 0
+ printf("graphics set == %s\n\n", artwork.graphics_set_current);
+ printf("sounds set == %s\n\n", artwork.sounds_set_current);
+ printf("music set == %s\n\n", artwork.music_set_current);
+#endif
+
sortTreeInfo(&artwork.gfx_first, compareTreeInfoEntries);
sortTreeInfo(&artwork.snd_first, compareTreeInfoEntries);
sortTreeInfo(&artwork.mus_first, compareTreeInfoEntries);
char *getSetupLine(struct TokenInfo *token_info, char *prefix, int token_nr)
{
int i;
- static char entry[MAX_LINE_LEN];
+ char *line;
+ static char token_string[MAX_LINE_LEN];
int token_type = token_info[token_nr].type;
void *setup_value = token_info[token_nr].value;
char *token_text = token_info[token_nr].text;
char *value_string = getSetupValue(token_type, setup_value);
- /* start with the prefix, token and some spaces to format output line */
- sprintf(entry, "%s%s:", prefix, token_text);
- for (i=strlen(entry); i<TOKEN_VALUE_POSITION; i++)
- strcat(entry, " ");
+ /* build complete token string */
+ sprintf(token_string, "%s%s", prefix, token_text);
- /* continue with the token's value (which can have different types) */
- strcat(entry, value_string);
+ /* build setup entry line */
+ line = getFormattedSetupEntry(token_string, value_string);
if (token_type == TYPE_KEY_X11)
{
if (strcmp(keyname, "(undefined)") != 0 &&
strcmp(keyname, "(unknown)") != 0)
{
- for (i=strlen(entry); i<50; i++)
- strcat(entry, " ");
+ /* add at least one whitespace */
+ strcat(line, " ");
+ for (i=strlen(line); i<TOKEN_COMMENT_POSITION; i++)
+ strcat(line, " ");
- strcat(entry, "# ");
- strcat(entry, keyname);
+ strcat(line, "# ");
+ strcat(line, keyname);
}
}
- return entry;
+ return line;
}
void LoadLevelSetup_LastSeries()