X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Flibgame%2Fsetup.c;h=7b0189b880f3744e0ff6a0d85137cc7b261bf233;hb=6d37ddaaf9915af0f483f4fc04d07b98e99e091e;hp=32c8f265dfdd84961a1762cfd72f8a7fa7f26962;hpb=2c03953e712c427c94c02cdb1e15cd9e99e9e116;p=rocksndiamonds.git diff --git a/src/libgame/setup.c b/src/libgame/setup.c index 32c8f265..7b0189b8 100644 --- a/src/libgame/setup.c +++ b/src/libgame/setup.c @@ -79,7 +79,8 @@ static char *levelclass_desc[NUM_LEVELCLASS_DESC] = 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 @@ -422,6 +423,46 @@ char *getCustomSoundFilename(char *basename) 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); @@ -1614,12 +1655,12 @@ static boolean LoadArtworkInfoFromArtworkConf(TreeInfo **node_first, 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); } @@ -1887,7 +1928,9 @@ char *getSetupLine(struct TokenInfo *token_info, char *prefix, int token_nr) if (strcmp(keyname, "(undefined)") != 0 && strcmp(keyname, "(unknown)") != 0) { - for (i=strlen(entry); i<50; i++) + /* add at least one whitespace */ + strcat(entry, " "); + for (i=strlen(entry); i