}
static void LoadArtworkInfoFromLevelInfo(ArtworkDirTree **artwork_node,
+ ArtworkDirTree *node_parent,
LevelDirTree *level_node)
{
int type = (*artwork_node)->type;
DrawInitText(level_node->name, 150, FC_YELLOW);
if (level_node->node_group != NULL)
- LoadArtworkInfoFromLevelInfo(artwork_node, level_node->node_group);
+ {
+ TreeInfo *artwork_new = newTreeInfo();
+
+ if (node_parent)
+ setTreeInfoToDefaultsFromParent(artwork_new, node_parent);
+ else
+ setTreeInfoToDefaults(artwork_new, type);
+
+ artwork_new->level_group = TRUE;
+
+ setString(&artwork_new->identifier, level_node->subdir);
+ setString(&artwork_new->name, level_node->name);
+ setString(&artwork_new->name_sorting, level_node->name_sorting);
+
+ pushTreeInfo(artwork_node, artwork_new);
+
+ // create node to link back to current custom artwork directory
+ createParentTreeInfoNode(artwork_new);
+
+ // recursively step into sub-directory and look for more custom artwork
+ LoadArtworkInfoFromLevelInfo(&artwork_new->node_group, artwork_new,
+ level_node->node_group);
+
+ // if sub-tree has no custom artwork at all, remove it
+ if (artwork_new->node_group->next == NULL)
+ {
+ *artwork_node = artwork_new->next;
+ artwork_new->next = NULL;
+
+ freeTreeInfo(artwork_new);
+ }
+ }
level_node = level_node->next;
}
print_timestamp_time("DrawTimeText");
- LoadArtworkInfoFromLevelInfo(&artwork.gfx_first, leveldir_first_all);
+ LoadArtworkInfoFromLevelInfo(&artwork.gfx_first, NULL, leveldir_first_all);
print_timestamp_time("LoadArtworkInfoFromLevelInfo (gfx)");
- LoadArtworkInfoFromLevelInfo(&artwork.snd_first, leveldir_first_all);
+ LoadArtworkInfoFromLevelInfo(&artwork.snd_first, NULL, leveldir_first_all);
print_timestamp_time("LoadArtworkInfoFromLevelInfo (snd)");
- LoadArtworkInfoFromLevelInfo(&artwork.mus_first, leveldir_first_all);
+ LoadArtworkInfoFromLevelInfo(&artwork.mus_first, NULL, leveldir_first_all);
print_timestamp_time("LoadArtworkInfoFromLevelInfo (mus)");
SaveArtworkInfoCache();
static void execSetupArtwork(void)
{
+ static ArtworkDirTree *gfx_last_valid = NULL;
+ static ArtworkDirTree *snd_last_valid = NULL;
+ static ArtworkDirTree *mus_last_valid = NULL;
+
+ // current artwork directory may be invalid (level group, parent link)
+ if (!validLevelSeries(artwork.gfx_current))
+ artwork.gfx_current = getFirstValidTreeInfoEntry(gfx_last_valid);
+ if (!validLevelSeries(artwork.snd_current))
+ artwork.snd_current = getFirstValidTreeInfoEntry(snd_last_valid);
+ if (!validLevelSeries(artwork.mus_current))
+ artwork.mus_current = getFirstValidTreeInfoEntry(mus_last_valid);
+
+ // store valid artwork directory information
+ gfx_last_valid = artwork.gfx_current;
+ snd_last_valid = artwork.snd_current;
+ mus_last_valid = artwork.mus_current;
+
#if 0
Debug("screens:execSetupArtwork", "'%s', '%s', '%s'",
artwork.gfx_current->subdir,