fixed bug with limiting forced scroll delay value to lower default value
[rocksndiamonds.git] / src / config.c
1 // ============================================================================
2 // Rocks'n'Diamonds - McDuffin Strikes Back!
3 // ----------------------------------------------------------------------------
4 // (c) 1995-2014 by Artsoft Entertainment
5 //                  Holger Schemel
6 //                  info@artsoft.org
7 //                  https://www.artsoft.org/
8 // ----------------------------------------------------------------------------
9 // config.c
10 // ============================================================================
11
12 #include "libgame/libgame.h"
13
14 #include "config.h"
15 #include "conftime.h"
16 #include "confhash.h"
17
18
19 char *getSourceDateString(void)
20 {
21   return SOURCE_DATE_STRING;
22 }
23
24 char *getSourceHashString(void)
25 {
26   return SOURCE_HASH_STRING;
27 }
28
29 char *getProgramTitleString(void)
30 {
31   return program.program_title;
32 }
33
34 char *getProgramRealVersionString(void)
35 {
36   static char program_version_string[32];
37
38   sprintf(program_version_string, "%d.%d.%d.%d%s",
39           PROGRAM_VERSION_SUPER, PROGRAM_VERSION_MAJOR, PROGRAM_VERSION_MINOR,
40           PROGRAM_VERSION_PATCH, PROGRAM_VERSION_EXTRA);
41
42   return program_version_string;
43 }
44
45 char *getProgramVersionString(void)
46 {
47   return program.version_string;
48 }
49
50 char *getProgramPlatformString(void)
51 {
52   return PLATFORM_STRING;
53 }
54
55 char *getProgramInitString(void)
56 {
57   static char *program_init_string = NULL;
58
59   if (program_init_string == NULL)
60   {
61     program_init_string = checked_malloc(strlen(getProgramTitleString()) + 1 +
62                                          strlen(getProgramVersionString()) + 1);
63
64     sprintf(program_init_string, "%s %s",
65             getProgramTitleString(), getProgramVersionString());
66   }
67
68   return program_init_string;
69 }
70
71 char *getConfigProgramTitleString(void)
72 {
73   TreeInfo *graphics_current =
74     getArtworkTreeInfoForUserLevelSet(ARTWORK_TYPE_GRAPHICS);
75
76   return (leveldir_current->program_title ?
77           leveldir_current->program_title :
78           graphics_current->program_title ?
79           graphics_current->program_title :
80           setup.internal.program_title);
81 }
82
83 char *getConfigProgramCopyrightString(void)
84 {
85   TreeInfo *graphics_current =
86     getArtworkTreeInfoForUserLevelSet(ARTWORK_TYPE_GRAPHICS);
87
88   return (leveldir_current->program_copyright ?
89           leveldir_current->program_copyright :
90           graphics_current->program_copyright ?
91           graphics_current->program_copyright :
92           setup.internal.program_copyright);
93 }
94
95 char *getConfigProgramCompanyString(void)
96 {
97   TreeInfo *graphics_current =
98     getArtworkTreeInfoForUserLevelSet(ARTWORK_TYPE_GRAPHICS);
99
100   return (leveldir_current->program_company ?
101           leveldir_current->program_company :
102           graphics_current->program_company ?
103           graphics_current->program_company :
104           setup.internal.program_company);
105 }
106
107 char *getWindowTitleString(void)
108 {
109   static char *window_title_string = NULL;
110
111   checked_free(window_title_string);
112
113 #ifdef DEBUG
114   window_title_string = checked_malloc(strlen(getProgramInitString()) + 20 +
115                                        strlen(getSourceDateString()) + 2 + 1);
116
117   if (setup.internal.show_scaling_in_title)
118     sprintf(window_title_string, "%s (%d %%) [%s]",
119             getProgramInitString(), video.window_scaling_percent,
120             getSourceDateString());
121   else
122     sprintf(window_title_string, "%s [%s]",
123             getProgramInitString(),
124             getSourceDateString());
125 #else
126   window_title_string = checked_malloc(strlen(getProgramInitString()) + 20);
127
128   if (setup.internal.show_scaling_in_title)
129     sprintf(window_title_string, "%s (%d %%)",
130             getProgramInitString(), video.window_scaling_percent);
131   else
132     sprintf(window_title_string, "%s",
133             getProgramInitString());
134 #endif
135
136   return window_title_string;
137 }