+static char *getSetupArtworkDir(TreeInfo *ti)
+{
+ static char *artwork_dir = NULL;
+
+ if (artwork_dir != NULL)
+ free(artwork_dir);
+
+ artwork_dir = getPath2(ti->basepath, ti->fullpath);
+
+ return artwork_dir;
+}
+
+void setLevelArtworkDir(TreeInfo *ti)
+{
+ char **artwork_path_ptr, *artwork_set;
+ TreeInfo *level_artwork;
+
+ if (ti == NULL || leveldir_current == NULL)
+ return;
+
+ artwork_path_ptr =
+ (ti->type == TREE_TYPE_GRAPHICS_DIR ? &leveldir_current->graphics_path :
+ ti->type == TREE_TYPE_SOUNDS_DIR ? &leveldir_current->sounds_path :
+ &leveldir_current->music_path);
+
+ artwork_set =
+ (ti->type == TREE_TYPE_GRAPHICS_DIR ? leveldir_current->graphics_set :
+ ti->type == TREE_TYPE_SOUNDS_DIR ? leveldir_current->sounds_set :
+ leveldir_current->music_set);
+
+ if ((level_artwork = getTreeInfoFromIdentifier(ti, artwork_set)) == NULL)
+ return;
+
+ if (*artwork_path_ptr != NULL)
+ free(*artwork_path_ptr);
+
+ *artwork_path_ptr = getStringCopy(getSetupArtworkDir(level_artwork));
+}
+
+static char *getLevelArtworkDir(int type)
+{
+ char *artwork_path;
+
+ if (leveldir_current == NULL)
+ return UNDEFINED_FILENAME;
+
+ artwork_path =
+ (type == TREE_TYPE_GRAPHICS_DIR ? leveldir_current->graphics_path :
+ type == TREE_TYPE_SOUNDS_DIR ? leveldir_current->sounds_path :
+ type == TREE_TYPE_MUSIC_DIR ? leveldir_current->music_path :
+ UNDEFINED_FILENAME);
+
+ return artwork_path;
+}
+