X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;ds=sidebyside;f=src%2Flibgame%2Fsetup.c;h=b78d274ec05730dd4806701df0a8ce50813d68f9;hb=730e92ef422a3be2315067584eaeb7dc6585b6f4;hp=d81cb8b55bdf6e66d1087b13c1c538caa9d75ad9;hpb=7354588d631a24c4aceebb28b7cf4fb9e1d5bab9;p=rocksndiamonds.git diff --git a/src/libgame/setup.c b/src/libgame/setup.c index d81cb8b5..b78d274e 100644 --- a/src/libgame/setup.c +++ b/src/libgame/setup.c @@ -853,6 +853,65 @@ char *getLevelSetTitleMessageFilename(int nr, boolean initial) return NULL; // cannot find specified artwork file anywhere } +static char *getCreditsBasename(int nr) +{ + static char basename[32]; + + sprintf(basename, "credits_%d.txt", nr + 1); + + return basename; +} + +char *getCreditsFilename(int nr, boolean global) +{ + char *basename = getCreditsBasename(nr); + char *basepath = NULL; + static char *credits_subdir = NULL; + static char *filename = NULL; + + if (credits_subdir == NULL) + credits_subdir = getPath2(DOCS_DIRECTORY, CREDITS_DIRECTORY); + + checked_free(filename); + + // look for credits file in the game's base or current level set directory + basepath = (global ? options.base_directory : getCurrentLevelDir()); + + filename = getPath3(basepath, credits_subdir, basename); + if (fileExists(filename)) + return filename; + + return NULL; // cannot find credits file +} + +static char *getProgramInfoBasename(int nr) +{ + static char basename[32]; + + sprintf(basename, "program_%d.txt", nr + 1); + + return basename; +} + +char *getProgramInfoFilename(int nr) +{ + char *basename = getProgramInfoBasename(nr); + static char *info_subdir = NULL; + static char *filename = NULL; + + if (info_subdir == NULL) + info_subdir = getPath2(DOCS_DIRECTORY, INFO_DIRECTORY); + + checked_free(filename); + + // look for program info file in the game's base directory + filename = getPath3(options.base_directory, info_subdir, basename); + if (fileExists(filename)) + return filename; + + return NULL; // cannot find program info file +} + static char *getCorrectedArtworkBasename(char *basename) { return basename; @@ -3080,6 +3139,17 @@ static void setTreeInfoParentNodes(TreeInfo *node, TreeInfo *node_parent) } } +TreeInfo *addTopTreeInfoNode(TreeInfo *node_first) +{ + // add top tree node with back link node in previous tree + node_first = createTopTreeInfoNode(node_first); + + // set all parent links (back links) in complete tree + setTreeInfoParentNodes(node_first, NULL); + + return node_first; +} + // ---------------------------------------------------------------------------- // functions for handling level and custom artwork info cache @@ -4214,11 +4284,8 @@ static void LoadArtworkInfoFromLevelInfo(ArtworkDirTree **artwork_node) LoadArtworkInfoFromLevelInfoExt(artwork_node, NULL, leveldir_first_all, TRUE); LoadArtworkInfoFromLevelInfoExt(artwork_node, NULL, leveldir_first_all, FALSE); - // add top tree node over all three separate sub-trees - *artwork_node = createTopTreeInfoNode(*artwork_node); - - // set all parent links (back links) in complete artwork tree - setTreeInfoParentNodes(*artwork_node, NULL); + // add top tree node over all sub-trees and set parent links + *artwork_node = addTopTreeInfoNode(*artwork_node); } void LoadLevelArtworkInfo(void)