* added remaining menu draw offset definitions for info sub-screens
2007-02-05
+ * added setup option to select game speed (from very slow to very fast)
* improved handling of title text messages (initial and for level set)
2007-02-03
{ "titlemessage_5.skip_comments", "false" },
{ "titlemessage_5.sort_priority", "0" },
+ { "readme.x", "-1" },
+ { "readme.y", "-1" },
+ { "readme.width", "-1" },
+ { "readme.height", "-1" },
+ { "readme.chars", "-1" },
+ { "readme.lines", "-1" },
+ { "readme.align", "center" },
+ { "readme.autowrap", "true" },
+ { "readme.centered", "false" },
+ { "readme.skip_comments", "true" },
+ { "readme.sort_priority", "0" },
+
{ "global.num_toons", "20" },
{ "border.draw_masked.TITLE", "false" },
-#define COMPILE_DATE_STRING "2007-02-09 02:02"
+#define COMPILE_DATE_STRING "2007-02-14 23:53"
int max_chars_per_line = (SXSIZE - 2 * pad_x) / font_width;
int max_lines_per_screen = (SYSIZE - pad_y) / font_height - 1;
- return DrawTextFromFile(sx, sy, filename, font_nr, max_chars_per_line,
- max_lines_per_screen, TRUE);
+ return DrawTextFile(sx, sy, filename, font_nr, max_chars_per_line, -1,
+ max_lines_per_screen, -1, TRUE, FALSE, FALSE);
}
static void DrawPropertiesTabulatorGadgets()
gi->height - 2 * border_y);
/* gadget text value */
+#if 1
+ DrawTextBuffer(gi->x + border_x, gi->y + border_y, gi->textarea.value,
+ font_nr, gi->textarea.xsize, -1, gi->textarea.ysize,
+ BLIT_ON_BACKGROUND, FALSE, FALSE, FALSE);
+#else
DrawTextToTextArea(gi->x + border_x, gi->y + border_y,
gi->textarea.value, font_nr, gi->textarea.xsize,
gi->textarea.xsize, gi->textarea.ysize,
BLIT_ON_BACKGROUND);
+#endif
cursor_letter = gi->textarea.value[gi->textarea.cursor_position];
cursor_string[0] = (cursor_letter != '\0' ? cursor_letter : ' ');
/* hot spot */
"0,0"
};
-#if defined(USE_ONE_PIXEL_PLAYFIELD_MOUSEPOINTER)
+#if USE_ONE_PIXEL_PLAYFIELD_MOUSEPOINTER
static const char *cursor_image_dot[] =
{
/* width height num_colors chars_per_pixel */
/* text buffer drawing functions */
/* ========================================================================= */
+#define MAX_LINES_FROM_FILE 1024
+
char *GetTextBufferFromFile(char *filename, int max_lines)
{
FILE *file;
redraw_mask |= REDRAW_FIELD;
}
-boolean RenderLineToBuffer(char **src_buffer_ptr, char *dst_buffer,
- int *dst_buffer_len, boolean last_line_was_empty,
- int line_length)
+static boolean RenderLineToBuffer(char **src_buffer_ptr, char *dst_buffer,
+ int *dst_buffer_len, int line_length,
+ boolean last_line_was_empty)
{
char *text_ptr = *src_buffer_ptr;
char *buffer = dst_buffer;
buffer[0] = '\0';
- RenderLineToBuffer(&text_ptr, buffer, &buffer_len, TRUE, line_length);
+ RenderLineToBuffer(&text_ptr, buffer, &buffer_len, line_length, TRUE);
DrawText(x, y + current_line * font_height, buffer, font_nr);
current_line++;
if (wrap_text)
{
- buffer_filled = RenderLineToBuffer(&line_ptr,
- buffer, &buffer_len,
- last_line_was_empty,
- line_length);
+ buffer_filled = RenderLineToBuffer(&line_ptr, buffer, &buffer_len,
+ line_length, last_line_was_empty);
}
else
{
buffer_filled = TRUE;
}
#else
- boolean buffer_filled = RenderLineToBuffer(&line_ptr,
- buffer, &buffer_len,
- last_line_was_empty,
- line_length);
+ boolean buffer_filled = RenderLineToBuffer(&line_ptr, buffer, &buffer_len,
+ line_length, last_line_was_empty);
#endif
if (buffer_filled)
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 formatted, boolean centered)
+ int mask_mode, boolean autowrap, boolean centered,
+ boolean skip_comments)
{
int font_width = getFontWidth(font_nr);
int font_height = getFontHeight(font_nr);
char line[MAX_LINE_LEN + 1];
char *line_ptr;
boolean last_line_was_empty = TRUE;
- int num_line_chars = (formatted ? MAX_LINE_LEN : line_length);
+ int num_line_chars = (autowrap ? MAX_LINE_LEN : line_length);
int i;
/* copy next line from text buffer to line buffer (nearly fgets() style) */
line[i] = '\0';
/* skip comments (lines directly beginning with '#') */
- if (line[0] == '#')
+ if (line[0] == '#' && skip_comments)
continue;
/* cut trailing newline and carriage return from input line */
{
boolean buffer_filled;
- if (formatted)
+ if (autowrap)
{
- buffer_filled = RenderLineToBuffer(&line_ptr,
- buffer, &buffer_len,
- last_line_was_empty,
- line_length);
+ buffer_filled = RenderLineToBuffer(&line_ptr, buffer, &buffer_len,
+ line_length, last_line_was_empty);
}
else
{
return current_line;
}
-int DrawTextFromFile(int x, int y, char *filename, int font_nr,
- int line_length, int max_lines, boolean formatted)
+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)
{
- char *text_buffer = GetTextBufferFromFile(filename, 1000);
+ char *text_buffer = GetTextBufferFromFile(filename, MAX_LINES_FROM_FILE);
int num_lines_printed = DrawTextBuffer(x, y, text_buffer, font_nr,
- line_length, -1, max_lines, -1,
- formatted, FALSE);
+ line_length, cut_length, max_lines,
+ mask_mode, autowrap, centered,
+ skip_comments);
checked_free(text_buffer);
return num_lines_printed;
}
+#if 0
void DrawTextWrapped(int x, int y, char *text, int font_nr, int line_length,
int max_lines)
{
DrawTextBuffer(x, y, text, font_nr, line_length, -1, max_lines, -1, TRUE,
- FALSE);
+ FALSE, FALSE);
}
void DrawTextToTextArea(int x, int y, char *text, int font_nr, int line_length,
int cut_length, int max_lines, int mask_mode)
{
DrawTextBuffer(x, y, text, font_nr, line_length, cut_length, max_lines,
- mask_mode, FALSE, FALSE);
+ mask_mode, FALSE, FALSE, FALSE);
}
+#endif
void DrawTextExt(DrawBuffer *, int, int, char *, int, int);
char *GetTextBufferFromFile(char *, int);
-void DrawTextToTextArea(int, int, char *, int, int, int, int, int);
-boolean RenderLineToBuffer(char **, char *, int *, boolean, int);
-void DrawTextWrapped(int, int, char *, int, int, int);
-int DrawTextBuffer(int, int, char *, int, int, int, int, int, boolean, boolean);
-int DrawTextFromFile(int, int, char *, int, int, int, boolean);
+int DrawTextBuffer(int, int, char *, int, int, int, int, int, boolean, boolean,
+ boolean);
+int DrawTextFile(int, int, char *, int, int, int, int, int, boolean, boolean,
+ boolean);
#endif /* TEXT_H */
struct GlobalInfo global;
struct BorderInfo border;
struct TitleInfo title;
-struct TitleMessageInfo titlemessage[MAX_NUM_TITLE_MESSAGES];
struct TitleMessageInfo titlemessage_initial[MAX_NUM_TITLE_MESSAGES];
+struct TitleMessageInfo titlemessage[MAX_NUM_TITLE_MESSAGES];
+struct TitleMessageInfo readme;
struct MenuInfo menu;
struct DoorInfo door_1, door_2;
struct PreviewInfo preview;
&titlemessage[4].sort_priority
},
+ {
+ "readme.x",
+ &readme.x
+ },
+ {
+ "readme.y",
+ &readme.y
+ },
+ {
+ "readme.width",
+ &readme.width
+ },
+ {
+ "readme.height",
+ &readme.height
+ },
+ {
+ "readme.chars",
+ &readme.chars
+ },
+ {
+ "readme.lines",
+ &readme.lines
+ },
+ {
+ "readme.align",
+ &readme.align
+ },
+ {
+ "readme.autowrap",
+ &readme.autowrap
+ },
+ {
+ "readme.centered",
+ &readme.centered
+ },
+ {
+ "readme.skip_comments",
+ &readme.skip_comments
+ },
+ {
+ "readme.sort_priority",
+ &readme.sort_priority
+ },
+
{
"global.num_toons",
&global.num_toons
extern struct GlobalInfo global;
extern struct BorderInfo border;
extern struct TitleInfo title;
-extern struct TitleMessageInfo titlemessage[], titlemessage_initial[];
+extern struct TitleMessageInfo titlemessage_initial[];
+extern struct TitleMessageInfo titlemessage[];
+extern struct TitleMessageInfo readme;
extern struct MenuInfo menu;
extern struct DoorInfo door_1, door_2;
extern struct PreviewInfo preview;
max_chars_per_line = (WIN_XSIZE - 2 * pad_x) / font_width;
max_lines_per_screen = (WIN_YSIZE - pad_y) / font_height - 1;
- DrawTextFromFile(sx, sy, filename, font_nr, max_chars_per_line,
- max_lines_per_screen, FALSE);
+ DrawTextFile(sx, sy, filename, font_nr, max_chars_per_line, -1,
+ max_lines_per_screen, -1, FALSE, FALSE, FALSE);
game_status = last_game_status; /* restore current game status */
}
if (strlen(text) <= max_chars_per_line) /* only one line of text */
sy += getFontHeight(font_nr) / 2;
+#if 1
+ DrawTextBuffer(sx, sy + ypos * ystep, text, font_nr,
+ max_chars_per_line, -1, max_lines_per_text, -1,
+ TRUE, FALSE, FALSE);
+#else
DrawTextWrapped(sx, sy + ypos * ystep, text, font_nr,
max_chars_per_line, max_lines_per_text);
+#endif
}
void DrawInfoScreen_TitleScreen()
"Press any key or button for info menu");
if (filename != NULL)
- DrawTextFromFile(sx, sy, filename, font_nr, max_chars_per_line,
- max_lines_per_screen, TRUE);
+ DrawTextFile(sx, sy, filename, font_nr, max_chars_per_line, -1,
+ max_lines_per_screen, -1, TRUE, FALSE, TRUE);
else
DrawTextSCentered(ystart2, FONT_TEXT_2,
"No information for this level set.");
level.envelope[envelope_nr].text, font_nr, max_xsize,
xsize - 2, ysize - 2, mask_mode,
level.envelope[envelope_nr].autowrap,
- level.envelope[envelope_nr].centered);
+ level.envelope[envelope_nr].centered, FALSE);
#else
DrawTextToTextArea(SX + sx + font_width, SY + sy + font_height,
level.envelope[envelope_nr].text, font_nr, max_xsize,