return basename;
}
+static char *getLevelStoryBasename(int level_nr)
+{
+ static char basename[32];
+
+ sprintf(basename, "%03d.txt", level_nr);
+
+ return basename;
+}
+
char *getLevelSetInfoFilename(int nr)
{
char *basename = getLevelSetInfoBasename(nr);
return NULL;
}
+char *getLevelStoryFilename(int level_nr)
+{
+ char *basename = getLevelStoryBasename(level_nr);
+ static char *stories_subdir = NULL;
+ static char *filename = NULL;
+
+ if (stories_subdir == NULL)
+ stories_subdir = getPath2(DOCS_DIRECTORY, STORIES_DIRECTORY);
+
+ checked_free(filename);
+
+ // look for story file in the current level set's "docs/stories" sub-directory
+ filename = getPath3(getCurrentLevelDir(), stories_subdir, basename);
+ if (fileExists(filename))
+ return filename;
+
+ return NULL;
+}
+
static char *getLevelSetTitleMessageBasename(int nr, boolean initial)
{
static char basename[32];
char *getHelpTextFilename(void);
char *getLevelSetInfoFilename(int);
char *getLevelInfoFilename(int);
+char *getLevelStoryFilename(int);
char *getLevelSetTitleMessageFilename(int, boolean);
char *getCreditsFilename(int, boolean);
char *getProgramInfoFilename(int);
#define PROGRAM_INFO_DIRECTORY "program"
#define LEVELSET_INFO_DIRECTORY "levelset"
#define LEVEL_INFO_DIRECTORY "levels"
+#define STORIES_DIRECTORY "stories"
#define CACHE_DIRECTORY "cache"
#define CONF_DIRECTORY "conf"
#define NETWORK_DIRECTORY "network"
return NULL;
}
+static char *getLevelStoryBuffer(void)
+{
+ if (level.game_engine_type != GAME_ENGINE_TYPE_BD ||
+ level.native_bd_level->cave == NULL)
+ return NULL;
+
+ if (level.native_bd_level->cave->story != NULL)
+ return getInfoTextBuffer_BD(level.native_bd_level->cave->story);
+
+ return NULL;
+}
+
static boolean hasLevelSetInfo(void)
{
return (getLevelSetInfoFilename(0) != NULL ||
getLevelInfoBuffer() != NULL);
}
+static boolean hasLevelStory(void)
+{
+ return (getLevelStoryFilename(level_nr) != NULL ||
+ getLevelStoryBuffer() != NULL);
+}
+
static int getTitleScreenGraphic(int nr, boolean initial)
{
return (initial ? IMG_TITLESCREEN_INITIAL_1 : IMG_TITLESCREEN_1) + nr;
static char *getInfoScreenFilename_Generic(int nr, boolean global)
{
- return (info_mode == INFO_MODE_CREDITS ? getCreditsFilename(nr, global) :
- info_mode == INFO_MODE_PROGRAM ? getProgramInfoFilename(nr) :
- info_mode == INFO_MODE_LEVELSET ? getLevelSetInfoFilename(nr) :
- info_mode == INFO_MODE_LEVEL ? getLevelInfoFilename(level_nr) :
- info_mode == INFO_MODE_STORY ? getLevelInfoFilename(level_nr) :
+ return (info_mode == INFO_MODE_CREDITS ? getCreditsFilename(nr, global) :
+ info_mode == INFO_MODE_PROGRAM ? getProgramInfoFilename(nr) :
+ info_mode == INFO_MODE_LEVELSET ? getLevelSetInfoFilename(nr) :
+ info_mode == INFO_MODE_LEVEL ? getLevelInfoFilename(level_nr) :
+ info_mode == INFO_MODE_STORY ? getLevelStoryFilename(level_nr) :
NULL);
}
{
return (info_mode == INFO_MODE_LEVELSET ? getLevelSetInfoBuffer() :
info_mode == INFO_MODE_LEVEL ? getLevelInfoBuffer() :
- info_mode == INFO_MODE_STORY ? getLevelInfoBuffer() :
+ info_mode == INFO_MODE_STORY ? getLevelStoryBuffer() :
NULL);
}
boolean ShowStoryScreen_FromInitGame(void)
{
- if (!hasLevelInfo())
+ if (!hasLevelStory())
return FALSE;
if (setup.show_level_story == STATE_FALSE ||