- if (graphics_subdir != NULL)
- usergraphics_dir = getPath3(data_dir, usergraphics_subdir,graphics_subdir);
- else
- usergraphics_dir = getPath2(data_dir, usergraphics_subdir);
+ if (leveldir_current == NULL)
+ return options.level_directory;
+
+ level_dir = getPath2((leveldir_current->user_defined ?
+ getUserLevelDir(NULL) : options.level_directory),
+ leveldir_current->fullpath);
+
+ return level_dir;
+}
+
+static char *getDefaultGraphicsDir(char *graphics_subdir)
+{
+ static char *graphics_dir = NULL;
+
+ if (graphics_subdir == NULL)
+ return options.graphics_directory;
+
+ if (graphics_dir)
+ free(graphics_dir);
+
+ graphics_dir = getPath2(options.graphics_directory, graphics_subdir);
+
+ return graphics_dir;
+}
+
+static char *getDefaultSoundsDir(char *sounds_subdir)
+{
+ static char *sounds_dir = NULL;
+
+ if (sounds_subdir == NULL)
+ return options.sounds_directory;
+
+ if (sounds_dir)
+ free(sounds_dir);
+
+ sounds_dir = getPath2(options.sounds_directory, sounds_subdir);
+
+ return sounds_dir;
+}
+
+static char *getDefaultMusicDir(char *music_subdir)
+{
+ static char *music_dir = NULL;
+
+ if (music_subdir == NULL)
+ return options.music_directory;
+
+ if (music_dir)
+ free(music_dir);
+
+ music_dir = getPath2(options.music_directory, music_subdir);
+
+ return music_dir;
+}
+
+static char *getUserGraphicsDir()
+{
+ static char *usergraphics_dir = NULL;
+
+ if (usergraphics_dir == NULL)
+ usergraphics_dir = getPath2(getUserDataDir(), GRAPHICS_DIRECTORY);