X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=blobdiff_plain;f=src%2Fconfig.c;h=8c4f1b5a8602e10069126e582d721b170f419b8a;hp=2d21f40887c2e754e3caef2aa705ff6f49ce12d5;hb=f37c86753d5005bf7ae341d0cbcc15ef75393567;hpb=c9433eab5c4317ed4f89164b386a7d33562e29be diff --git a/src/config.c b/src/config.c index 2d21f408..8c4f1b5a 100644 --- a/src/config.c +++ b/src/config.c @@ -1,30 +1,126 @@ -/*********************************************************** -* Rocks'n'Diamonds -- McDuffin Strikes Back! * -*----------------------------------------------------------* -* (c) 1995-2002 Artsoft Entertainment * -* Holger Schemel * -* Detmolder Strasse 189 * -* 33604 Bielefeld * -* Germany * -* e-mail: info@artsoft.org * -*----------------------------------------------------------* -* config.c * -***********************************************************/ +// ============================================================================ +// Rocks'n'Diamonds - McDuffin Strikes Back! +// ---------------------------------------------------------------------------- +// (c) 1995-2014 by Artsoft Entertainment +// Holger Schemel +// info@artsoft.org +// http://www.artsoft.org/ +// ---------------------------------------------------------------------------- +// config.c +// ============================================================================ #include "libgame/libgame.h" #include "config.h" #include "conftime.h" -/* use timestamp created at compile-time */ -#define PROGRAM_BUILD_STRING PROGRAM_IDENT_STRING " " COMPILE_DATE_STRING -#ifdef DEBUG -#undef WINDOW_TITLE_STRING -#define WINDOW_TITLE_STRING PROGRAM_TITLE_STRING " " PROGRAM_BUILD_STRING -#endif +char *getSourceDateString(void) +{ + return SOURCE_DATE_STRING; +} + +char *getProgramTitleString(void) +{ + return program.program_title; +} + +char *getProgramRealVersionString(void) +{ + static char program_version_string[32]; + + sprintf(program_version_string, "%d.%d.%d.%d%s", + PROGRAM_VERSION_SUPER, PROGRAM_VERSION_MAJOR, PROGRAM_VERSION_MINOR, + PROGRAM_VERSION_PATCH, PROGRAM_VERSION_EXTRA); + + return program_version_string; +} + +char *getProgramVersionString(void) +{ + return program.version_string; +} + +char *getProgramInitString(void) +{ + static char *program_init_string = NULL; + + if (program_init_string == NULL) + { + program_init_string = checked_malloc(strlen(getProgramTitleString()) + 1 + + strlen(getProgramVersionString()) + 1); + + sprintf(program_init_string, "%s %s", + getProgramTitleString(), getProgramVersionString()); + } + + return program_init_string; +} + +char *getConfigProgramTitleString(void) +{ + TreeInfo *graphics_current = + getArtworkTreeInfoForUserLevelSet(ARTWORK_TYPE_GRAPHICS); + + return (leveldir_current->program_title ? + leveldir_current->program_title : + graphics_current->program_title ? + graphics_current->program_title : + setup.internal.program_title); +} + +char *getConfigProgramCopyrightString(void) +{ + TreeInfo *graphics_current = + getArtworkTreeInfoForUserLevelSet(ARTWORK_TYPE_GRAPHICS); + + return (leveldir_current->program_copyright ? + leveldir_current->program_copyright : + graphics_current->program_copyright ? + graphics_current->program_copyright : + setup.internal.program_copyright); +} + +char *getConfigProgramCompanyString(void) +{ + TreeInfo *graphics_current = + getArtworkTreeInfoForUserLevelSet(ARTWORK_TYPE_GRAPHICS); + + return (leveldir_current->program_company ? + leveldir_current->program_company : + graphics_current->program_company ? + graphics_current->program_company : + setup.internal.program_company); +} -char *getWindowTitleString() +char *getWindowTitleString(void) { - return WINDOW_TITLE_STRING; + static char *window_title_string = NULL; + + checked_free(window_title_string); + +#ifdef DEBUG + window_title_string = checked_malloc(strlen(getProgramInitString()) + 20 + + strlen(getSourceDateString()) + 2 + 1); + + if (setup.internal.show_scaling_in_title) + sprintf(window_title_string, "%s (%d %%) [%s]", + getProgramInitString(), video.window_scaling_percent, + getSourceDateString()); + else + sprintf(window_title_string, "%s [%s]", + getProgramInitString(), + getSourceDateString()); +#else + window_title_string = checked_malloc(strlen(getProgramInitString()) + 20); + + if (setup.internal.show_scaling_in_title) + sprintf(window_title_string, "%s (%d %%)", + getProgramInitString(), video.window_scaling_percent); + else + sprintf(window_title_string, "%s", + getProgramInitString()); +#endif + + return window_title_string; }