From: Holger Schemel Date: Wed, 14 Feb 2007 23:04:46 +0000 (+0100) Subject: rnd-20070215-1-src X-Git-Tag: 3.2.4^2~92 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=ba702cd338586991ab20176cf5587afbb4d77af7;p=rocksndiamonds.git rnd-20070215-1-src * added setup option to select game speed (from very slow to very fast) --- diff --git a/ChangeLog b/ChangeLog index 5d3960af..42c67769 100644 --- a/ChangeLog +++ b/ChangeLog @@ -9,6 +9,7 @@ * 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 diff --git a/src/conf_gfx.c b/src/conf_gfx.c index 8aafe241..2a02b3c1 100644 --- a/src/conf_gfx.c +++ b/src/conf_gfx.c @@ -5061,6 +5061,18 @@ struct ConfigInfo image_config[] = { "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" }, diff --git a/src/conftime.h b/src/conftime.h index 2ea6f5c2..4add64c5 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "2007-02-09 02:02" +#define COMPILE_DATE_STRING "2007-02-14 23:53" diff --git a/src/editor.c b/src/editor.c index 4c592cf8..1ec48e18 100644 --- a/src/editor.c +++ b/src/editor.c @@ -7562,8 +7562,8 @@ static int PrintElementDescriptionFromFile(char *filename, int start_line) 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() diff --git a/src/libgame/gadgets.c b/src/libgame/gadgets.c index 23c51d36..3d593a9b 100644 --- a/src/libgame/gadgets.c +++ b/src/libgame/gadgets.c @@ -381,10 +381,16 @@ static void DrawGadget(struct GadgetInfo *gi, boolean pressed, boolean direct) 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 : ' '); diff --git a/src/libgame/system.c b/src/libgame/system.c index 46910d43..1c8bb658 100644 --- a/src/libgame/system.c +++ b/src/libgame/system.c @@ -1019,7 +1019,7 @@ static const char *cursor_image_none[] = /* 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 */ diff --git a/src/libgame/text.c b/src/libgame/text.c index f7369f33..58826350 100644 --- a/src/libgame/text.c +++ b/src/libgame/text.c @@ -404,6 +404,8 @@ void DrawTextExt(DrawBuffer *dst_bitmap, int dst_x, int dst_y, char *text, /* text buffer drawing functions */ /* ========================================================================= */ +#define MAX_LINES_FROM_FILE 1024 + char *GetTextBufferFromFile(char *filename, int max_lines) { FILE *file; @@ -466,9 +468,9 @@ void DrawTextToTextArea_OLD(int x, int y, char *text, int font_nr, int line_leng 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; @@ -560,7 +562,7 @@ void DrawTextWrapped_OLD(int x, int y, char *text, int font_nr, int line_length, 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++; @@ -626,10 +628,8 @@ int DrawTextFromFile_OLD(int x, int y, char *filename, int font_nr, 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 { @@ -650,10 +650,8 @@ int DrawTextFromFile_OLD(int x, int y, char *filename, int font_nr, 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) @@ -683,7 +681,8 @@ int DrawTextFromFile_OLD(int x, int y, char *filename, int font_nr, 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); @@ -708,7 +707,7 @@ int DrawTextBuffer(int x, int y, char *text_buffer, int 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) */ @@ -718,7 +717,7 @@ int DrawTextBuffer(int x, int y, char *text_buffer, int font_nr, 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 */ @@ -740,12 +739,10 @@ int DrawTextBuffer(int x, int y, char *text_buffer, int font_nr, { 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 { @@ -814,28 +811,33 @@ int DrawTextBuffer(int x, int y, char *text_buffer, int font_nr, 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 diff --git a/src/libgame/text.h b/src/libgame/text.h index 6e510bc6..f5088b4a 100644 --- a/src/libgame/text.h +++ b/src/libgame/text.h @@ -83,10 +83,9 @@ void DrawText(int, int, char *, int); 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 */ diff --git a/src/main.c b/src/main.c index 3911f391..bfa11abd 100644 --- a/src/main.c +++ b/src/main.c @@ -107,8 +107,9 @@ struct GameInfo game; 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; @@ -5823,6 +5824,51 @@ struct TokenIntPtrInfo image_config_vars[] = &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 diff --git a/src/main.h b/src/main.h index f9ab95f4..ab14f141 100644 --- a/src/main.h +++ b/src/main.h @@ -2666,7 +2666,9 @@ extern struct TapeInfo tape; 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; diff --git a/src/screens.c b/src/screens.c index dd25d120..6d3bd170 100644 --- a/src/screens.c +++ b/src/screens.c @@ -887,8 +887,8 @@ void DrawTitleScreenMessage(int nr, boolean initial) 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 */ } @@ -2248,8 +2248,14 @@ void DrawInfoScreen_HelpText(int element, int action, int direction, int ypos) 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() @@ -2999,8 +3005,8 @@ void DrawInfoScreen_LevelSet() "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."); diff --git a/src/tools.c b/src/tools.c index 6b1c61cf..88c81344 100644 --- a/src/tools.c +++ b/src/tools.c @@ -1631,7 +1631,7 @@ void AnimateEnvelope(int envelope_nr, int anim_mode, int action) 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,