2007-03-18
- * added configurability of graphics, sounds and music for title screens
+ * added configurability of graphics, sounds and music for title screens,
+ which are separated into initial title screens (only shown once at
+ program startup) and title screens shown for a given level set; these
+ title screens can be composed of up to five title images and up to
+ five title text messages (each drawn using an optional background
+ image), also using background music and/or sounds; aspects like
+ background images, sounds and music of title screens can either be
+ defined generally (valid for all title screens) or specifically (and
+ therefore differently for each title screen) using these directives:
+
+ to define a background image, sound or music file for all screens:
+ - background.TITLE_INITIAL (for all title screens for game startup)
+ - background.TITLE (for all title screens for level sets)
+
+ to define a background image, sound or music file for a single screen:
+ - background.titlescreen_initial_x (with x in 1,2,3,4,5)
+ - background.titlescreen_x (with x in 1,2,3,4,5)
+ - background.titlemessage_initial_x (with x in 1,2,3,4,5)
+ - background.titlemessage_x (with x in 1,2,3,4,5)
+
+ to define the title screen images:
+ - titlescreen_initial_x (with x in 1,2,3,4,5)
+ - titlescreen_x (with x in 1,2,3,4,5)
+
+ to define the title text messages, place text files into the level set
+ directory that have the following file names:
+ - titlemessage_initial_x.txt (with x in 1,2,3,4,5)
+ - titlemessage_x.txt (with x in 1,2,3,4,5)
+
+ to define the properties of the text messages, either use directives
+ that affect all text messages:
+ - [titlemessage_initial].<suffix>
+ - [titlemessage].<suffix>
+ or use directives affect single text messages:
+ - titlemessage_initial_x.<suffix> (with x in 1,2,3,4,5)
+ - titlemessage_x.<suffix> (with x in 1,2,3,4,5)
+
+ valid values for <suffix> are the same as for readme.<suffix> below;
+ use ".sort_priority" (default: 0) to define an arbitrary order for
+ title images and title messages (which can therefore be mixed)
2007-03-14
* added full configurability of "readme.txt" screen appearance:
- - readme.x: <left position used with alignment>
- - readme.y: <top position>
- - readme.width: <maximim text width in pixels>
- - readme.height: <maximum text height in pixels>
- - readme.chars: <maximum number of chars per line>
- - readme.lines: <maximum number of lines displayed>
- - readme.align: left,center,right (default: center)
- - readme.font: font name
- - readme.autowrap: true,false (default: true)
- - readme.centered: true,false (default: false)
- - readme.skip_comments: true,false (default: true)
- - readme.sort_priority: (currently not used)
+ - readme.x: <left position used with alignment>
+ - readme.y: <top position>
+ - readme.width: <maximim text width in pixels>
+ - readme.height: <maximum text height in pixels>
+ - readme.chars: <maximum number of chars per line>
+ - readme.lines: <maximum number of lines displayed>
+ - readme.align: left,center,right (default: center)
+ - readme.top: top,middle,bottom (default: top)
+ - readme.font: font name
+ - readme.autowrap: true,false (default: true)
+ - readme.centered: true,false (default: false)
+ - readme.parse_comments: true,false (default: true)
+ - readme.sort_priority: (not used here, but only for title screens)
when "readme.chars" and/or "readme.lines" is set to "-1" (this is the
default), they are automatically determined from "readme.width" and
"readme.height" accordingly; when they are not "-1", they have
precedence over "readme.width" and "readme.height"
* added internal ad-hoc config settings for displaying text files like
title messages or "readme.txt" style level set info files:
- - .autowrap: true,false (default: value of readme.autowrap)
- - .centered: true,false (default: value of readme.autowrap)
- - .skip_comments: true,false (default: value of readme.autowrap)
+ - .font: font name (default: readme.font)
+ - .autowrap: true,false (default: readme.autowrap)
+ - .centered: true,false (default: readme.centered)
+ - .parse_comments: true,false (default: readme.parse_comments)
(the leading '.' and the separating ':' are mandatory here); to use
these ad-hoc settings, they have to be written inside a comment, like
"# .autowrap: false" or "# .centered: true"; these settings then
override the above global settings (they can even be used more than
once, like "# .centered: true", then some text that should be drawn
centered, then "# .centered: false" to go back to non-centered text;
- only ".skip_comments" can not be used after a ".skip_comments: false"
- again, as this generally disables detecting comments at all)
+ important note: after using "# .parse_comments: false", or when using
+ "readme.parse_comments: false", detecting and parsing comments inside
+ the file is disabled and comments are just printed like normal text;
+ also be aware that all automatic text size calculations are done with
+ the font defined in "readme.font", while using different fonts using
+ "# .font: <font>" inside the text file may cause unexpected results
2007-03-08
* changed some numerical limits in the level editor from 255 to 999
{ "[titlemessage_initial].font", "font.text_1" },
{ "[titlemessage_initial].autowrap", "false" },
{ "[titlemessage_initial].centered", "false" },
- { "[titlemessage_initial].skip_comments", "false" },
+ { "[titlemessage_initial].parse_comments", "false" },
{ "[titlemessage_initial].sort_priority", "0" },
{ "[titlemessage].x", "336" },
{ "[titlemessage].y", "280" },
{ "[titlemessage].font", "font.text_1" },
{ "[titlemessage].autowrap", "false" },
{ "[titlemessage].centered", "false" },
- { "[titlemessage].skip_comments", "false" },
+ { "[titlemessage].parse_comments", "false" },
{ "[titlemessage].sort_priority", "0" },
{ "titlemessage_initial_1.x", "336" },
{ "titlemessage_initial_1.font", "font.text_1" },
{ "titlemessage_initial_1.autowrap", "false" },
{ "titlemessage_initial_1.centered", "false" },
- { "titlemessage_initial_1.skip_comments", "false" },
+ { "titlemessage_initial_1.parse_comments", "false" },
{ "titlemessage_initial_1.sort_priority", "0" },
{ "titlemessage_initial_2.x", "336" },
{ "titlemessage_initial_2.y", "280" },
{ "titlemessage_initial_2.font", "font.text_1" },
{ "titlemessage_initial_2.autowrap", "false" },
{ "titlemessage_initial_2.centered", "false" },
- { "titlemessage_initial_2.skip_comments", "false" },
+ { "titlemessage_initial_2.parse_comments", "false" },
{ "titlemessage_initial_2.sort_priority", "0" },
{ "titlemessage_initial_3.x", "336" },
{ "titlemessage_initial_3.y", "280" },
{ "titlemessage_initial_3.font", "font.text_1" },
{ "titlemessage_initial_3.autowrap", "false" },
{ "titlemessage_initial_3.centered", "false" },
- { "titlemessage_initial_3.skip_comments", "false" },
+ { "titlemessage_initial_3.parse_comments", "false" },
{ "titlemessage_initial_3.sort_priority", "0" },
{ "titlemessage_initial_4.x", "336" },
{ "titlemessage_initial_4.y", "280" },
{ "titlemessage_initial_4.font", "font.text_1" },
{ "titlemessage_initial_4.autowrap", "false" },
{ "titlemessage_initial_4.centered", "false" },
- { "titlemessage_initial_4.skip_comments", "false" },
+ { "titlemessage_initial_4.parse_comments", "false" },
{ "titlemessage_initial_4.sort_priority", "0" },
{ "titlemessage_initial_5.x", "336" },
{ "titlemessage_initial_5.y", "280" },
{ "titlemessage_initial_5.font", "font.text_1" },
{ "titlemessage_initial_5.autowrap", "false" },
{ "titlemessage_initial_5.centered", "false" },
- { "titlemessage_initial_5.skip_comments", "false" },
+ { "titlemessage_initial_5.parse_comments", "false" },
{ "titlemessage_initial_5.sort_priority", "0" },
{ "titlemessage_1.x", "336" },
{ "titlemessage_1.y", "280" },
{ "titlemessage_1.font", "font.text_1" },
{ "titlemessage_1.autowrap", "false" },
{ "titlemessage_1.centered", "false" },
- { "titlemessage_1.skip_comments", "false" },
+ { "titlemessage_1.parse_comments", "false" },
{ "titlemessage_1.sort_priority", "0" },
{ "titlemessage_2.x", "336" },
{ "titlemessage_2.y", "280" },
{ "titlemessage_2.font", "font.text_1" },
{ "titlemessage_2.autowrap", "false" },
{ "titlemessage_2.centered", "false" },
- { "titlemessage_2.skip_comments", "false" },
+ { "titlemessage_2.parse_comments", "false" },
{ "titlemessage_2.sort_priority", "0" },
{ "titlemessage_3.x", "336" },
{ "titlemessage_3.y", "280" },
{ "titlemessage_3.font", "font.text_1" },
{ "titlemessage_3.autowrap", "false" },
{ "titlemessage_3.centered", "false" },
- { "titlemessage_3.skip_comments", "false" },
+ { "titlemessage_3.parse_comments", "false" },
{ "titlemessage_3.sort_priority", "0" },
{ "titlemessage_4.x", "336" },
{ "titlemessage_4.y", "280" },
{ "titlemessage_4.font", "font.text_1" },
{ "titlemessage_4.autowrap", "false" },
{ "titlemessage_4.centered", "false" },
- { "titlemessage_4.skip_comments", "false" },
+ { "titlemessage_4.parse_comments", "false" },
{ "titlemessage_4.sort_priority", "0" },
{ "titlemessage_5.x", "336" },
{ "titlemessage_5.y", "280" },
{ "titlemessage_5.font", "font.text_1" },
{ "titlemessage_5.autowrap", "false" },
{ "titlemessage_5.centered", "false" },
- { "titlemessage_5.skip_comments", "false" },
+ { "titlemessage_5.parse_comments", "false" },
{ "titlemessage_5.sort_priority", "0" },
{ "readme.x", "272" },
{ "readme.font", "font.info.levelset" },
{ "readme.autowrap", "true" },
{ "readme.centered", "false" },
- { "readme.skip_comments", "true" },
+ { "readme.parse_comments", "true" },
{ "readme.sort_priority", "0" },
{ "global.num_toons", "20" },
&titlemessage_initial_default.centered
},
{
- "[titlemessage_initial].skip_comments",
- &titlemessage_initial_default.skip_comments
+ "[titlemessage_initial].parse_comments",
+ &titlemessage_initial_default.parse_comments
},
{
"[titlemessage_initial].sort_priority",
&titlemessage_default.centered
},
{
- "[titlemessage].skip_comments",
- &titlemessage_default.skip_comments
+ "[titlemessage].parse_comments",
+ &titlemessage_default.parse_comments
},
{
"[titlemessage].sort_priority",
&titlemessage_initial[0].centered
},
{
- "titlemessage_initial_1.skip_comments",
- &titlemessage_initial[0].skip_comments
+ "titlemessage_initial_1.parse_comments",
+ &titlemessage_initial[0].parse_comments
},
{
"titlemessage_initial_1.sort_priority",
&titlemessage_initial[1].centered
},
{
- "titlemessage_initial_2.skip_comments",
- &titlemessage_initial[1].skip_comments
+ "titlemessage_initial_2.parse_comments",
+ &titlemessage_initial[1].parse_comments
},
{
"titlemessage_initial_2.sort_priority",
&titlemessage_initial[2].centered
},
{
- "titlemessage_initial_3.skip_comments",
- &titlemessage_initial[2].skip_comments
+ "titlemessage_initial_3.parse_comments",
+ &titlemessage_initial[2].parse_comments
},
{
"titlemessage_initial_3.sort_priority",
&titlemessage_initial[3].centered
},
{
- "titlemessage_initial_4.skip_comments",
- &titlemessage_initial[3].skip_comments
+ "titlemessage_initial_4.parse_comments",
+ &titlemessage_initial[3].parse_comments
},
{
"titlemessage_initial_4.sort_priority",
&titlemessage_initial[4].centered
},
{
- "titlemessage_initial_5.skip_comments",
- &titlemessage_initial[4].skip_comments
+ "titlemessage_initial_5.parse_comments",
+ &titlemessage_initial[4].parse_comments
},
{
"titlemessage_initial_5.sort_priority",
&titlemessage[0].centered
},
{
- "titlemessage_1.skip_comments",
- &titlemessage[0].skip_comments
+ "titlemessage_1.parse_comments",
+ &titlemessage[0].parse_comments
},
{
"titlemessage_1.sort_priority",
&titlemessage[1].centered
},
{
- "titlemessage_2.skip_comments",
- &titlemessage[1].skip_comments
+ "titlemessage_2.parse_comments",
+ &titlemessage[1].parse_comments
},
{
"titlemessage_2.sort_priority",
&titlemessage[2].centered
},
{
- "titlemessage_3.skip_comments",
- &titlemessage[2].skip_comments
+ "titlemessage_3.parse_comments",
+ &titlemessage[2].parse_comments
},
{
"titlemessage_3.sort_priority",
&titlemessage[3].centered
},
{
- "titlemessage_4.skip_comments",
- &titlemessage[3].skip_comments
+ "titlemessage_4.parse_comments",
+ &titlemessage[3].parse_comments
},
{
"titlemessage_4.sort_priority",
&titlemessage[4].centered
},
{
- "titlemessage_5.skip_comments",
- &titlemessage[4].skip_comments
+ "titlemessage_5.parse_comments",
+ &titlemessage[4].parse_comments
},
{
"titlemessage_5.sort_priority",
&readme.centered
},
{
- "readme.skip_comments",
- &readme.skip_comments
+ "readme.parse_comments",
+ &readme.parse_comments
},
{
"readme.sort_priority",
-#define COMPILE_DATE_STRING "2007-03-18 20:13"
+#define COMPILE_DATE_STRING "2007-03-18 22:44"
freeSetupFileHash(setup_file_hash);
}
-static int get_token_parameter_value(char *token, char *value_raw)
-{
- char *suffix;
-
- if (token == NULL || value_raw == NULL)
- return ARG_UNDEFINED_VALUE;
-
- suffix = strrchr(token, '.');
- if (suffix == NULL)
- suffix = token;
-
- if (strncmp(suffix, ".font", 5) == 0)
- {
- int i;
-
- /* !!! OPTIMIZE THIS BY USING HASH !!! */
- for (i = 0; i < NUM_FONTS; i++)
- if (strEqual(value_raw, font_info[i].token_name))
- return i;
-
- /* if font not found, use reliable default value */
- return FONT_INITIAL_1;
- }
-
- return get_parameter_value(value_raw, suffix, TYPE_INTEGER);
-}
-
static void LoadSpecialMenuDesignSettingsFromFilename(char *filename)
{
static struct TitleMessageInfo tmi;
{ TYPE_INTEGER, &tmi.font, ".font" },
{ TYPE_BOOLEAN, &tmi.autowrap, ".autowrap" },
{ TYPE_BOOLEAN, &tmi.centered, ".centered" },
- { TYPE_BOOLEAN, &tmi.skip_comments, ".skip_comments" },
+ { TYPE_BOOLEAN, &tmi.parse_comments, ".parse_comments" },
{ TYPE_INTEGER, &tmi.sort_priority, ".sort_priority" },
{ -1, NULL, NULL }
return font_nr;
}
+static int getFontFromToken(char *token)
+{
+ int i;
+
+ /* !!! OPTIMIZE THIS BY USING HASH !!! */
+ for (i = 0; i < NUM_FONTS; i++)
+ if (strEqual(token, font_info[i].token_name))
+ return i;
+
+ /* if font not found, use reliable default value */
+ return FONT_INITIAL_1;
+}
+
void InitFontGraphicInfo()
{
static struct FontBitmapInfo *font_bitmap_info = NULL;
if (graphic_info == NULL) /* still at startup phase */
{
- InitFontInfo(font_initial, NUM_INITIAL_FONTS, getFontBitmapID);
+ InitFontInfo(font_initial, NUM_INITIAL_FONTS,
+ getFontBitmapID, getFontFromToken);
return;
}
}
}
- InitFontInfo(font_bitmap_info, num_font_bitmaps, getFontBitmapID);
+ InitFontInfo(font_bitmap_info, num_font_bitmaps,
+ getFontBitmapID, getFontFromToken);
}
void InitElementGraphicInfo()
if (string_has_parameter(value, "static_panel"))
result |= ANIM_STATIC_PANEL;
}
+ else if (strEqual(suffix, ".font"))
+ {
+ result = gfx.get_font_from_token_function(value);
+ }
else /* generic parameter of type integer or boolean */
{
result = (strEqual(value, ARG_UNDEFINED) ? ARG_UNDEFINED_VALUE :
return result;
}
+int get_token_parameter_value(char *token, char *value_raw)
+{
+ char *suffix;
+
+ if (token == NULL || value_raw == NULL)
+ return ARG_UNDEFINED_VALUE;
+
+ suffix = strrchr(token, '.');
+ if (suffix == NULL)
+ suffix = token;
+
+#if 0
+ if (strncmp(suffix, ".font", 5) == 0)
+ {
+ int i;
+
+ /* !!! OPTIMIZE THIS BY USING HASH !!! */
+ for (i = 0; i < NUM_FONTS; i++)
+ if (strEqual(value_raw, font_info[i].token_name))
+ return i;
+
+ /* if font not found, use reliable default value */
+ return FONT_INITIAL_1;
+ }
+#endif
+
+ return get_parameter_value(value_raw, suffix, TYPE_INTEGER);
+}
+
struct ScreenModeInfo *get_screen_mode_from_string(char *screen_mode_string)
{
static struct ScreenModeInfo screen_mode;
char *get_mapped_token(char *);
int get_parameter_value(char *, char *, int);
+int get_token_parameter_value(char *, char *);
struct ScreenModeInfo *get_screen_mode_from_string(char *);
void get_aspect_ratio_from_screen_mode(struct ScreenModeInfo *, int *x, int *y);
int num_fonts;
struct FontBitmapInfo *font_bitmap_info;
int (*select_font_function)(int);
+ int (*get_font_from_token_function)(char *);
int anim_random_frame;
};
#endif /* TARGET_X11_NATIVE_PERFORMANCE_WORKAROUND */
void InitFontInfo(struct FontBitmapInfo *font_bitmap_info, int num_fonts,
- int (*select_font_function)(int))
+ int (*select_font_function)(int),
+ int (*get_font_from_token_function)(char *))
{
gfx.num_fonts = num_fonts;
gfx.font_bitmap_info = font_bitmap_info;
gfx.select_font_function = select_font_function;
+ gfx.get_font_from_token_function = get_font_from_token_function;
#if defined(TARGET_X11_NATIVE_PERFORMANCE_WORKAROUND)
InitFontClipmasks();
int DrawTextBuffer(int x, int y, char *text_buffer, int font_nr,
int line_length, int cut_length, int max_lines,
int mask_mode, boolean autowrap, boolean centered,
- boolean skip_comments)
+ boolean parse_comments)
{
#if 0
int font_width = getFontWidth(font_nr);
text_buffer++;
/* skip comments (lines directly beginning with '#') */
- if (line[0] == '#' && skip_comments)
+ if (line[0] == '#' && parse_comments)
{
char *token, *value;
buffer_len = 0;
}
- if (strEqual(token, ".autowrap"))
+ if (strEqual(token, ".font"))
+ font_nr = gfx.get_font_from_token_function(value);
+ else if (strEqual(token, ".autowrap"))
autowrap = get_boolean_from_string(value);
else if (strEqual(token, ".centered"))
centered = get_boolean_from_string(value);
- else if (strEqual(token, ".skip_comments"))
- skip_comments = get_boolean_from_string(value);
+ else if (strEqual(token, ".parse_comments"))
+ parse_comments = get_boolean_from_string(value);
}
continue;
int DrawTextFile(int x, int y, char *filename, int font_nr,
int line_length, int cut_length, int max_lines,
int mask_mode, boolean autowrap, boolean centered,
- boolean skip_comments)
+ boolean parse_comments)
{
char *text_buffer = GetTextBufferFromFile(filename, MAX_LINES_FROM_FILE);
int num_lines_printed = DrawTextBuffer(x, y, text_buffer, font_nr,
line_length, cut_length, max_lines,
mask_mode, autowrap, centered,
- skip_comments);
+ parse_comments);
checked_free(text_buffer);
return num_lines_printed;
/* font structure definitions */
-void InitFontInfo(struct FontBitmapInfo *, int, int (*function)(int));
+void InitFontInfo(struct FontBitmapInfo *, int,
+ int (*function1)(int), int (*function2)(char *));
void FreeFontInfo(struct FontBitmapInfo *);
struct FontBitmapInfo *getFontBitmapInfo(int);
int font;
boolean autowrap;
boolean centered;
- boolean skip_comments;
+ boolean parse_comments;
int sort_priority;
};
#if 1
DrawTextFile(ALIGNED_TEXT_XPOS(tmi), ALIGNED_TEXT_YPOS(tmi),
filename, tmi->font, tmi->chars, -1, tmi->lines, -1,
- tmi->autowrap, tmi->centered, tmi->skip_comments);
+ tmi->autowrap, tmi->centered, tmi->parse_comments);
#else
DrawTextFile(sx, sy, filename, font_nr, max_chars_per_line, -1,
max_lines_per_screen, -1, tmi->autowrap, tmi->centered,
- tmi->skip_comments);
+ tmi->parse_comments);
#endif
game_status = last_game_status; /* restore current game status */
if (filename != NULL)
DrawTextFile(mSX + ALIGNED_TEXT_XPOS(tmi), mSY + ALIGNED_TEXT_YPOS(tmi),
filename, tmi->font, tmi->chars, -1, tmi->lines, -1,
- tmi->autowrap, tmi->centered, tmi->skip_comments);
+ tmi->autowrap, tmi->centered, tmi->parse_comments);
else
DrawTextCentered(mSY + ALIGNED_TEXT_YPOS(tmi), FONT_TEXT_2,
"No information for this level set.");