rnd-20070215-1-src
authorHolger Schemel <info@artsoft.org>
Wed, 14 Feb 2007 23:04:46 +0000 (00:04 +0100)
committerHolger Schemel <info@artsoft.org>
Sat, 30 Aug 2014 08:54:26 +0000 (10:54 +0200)
* added setup option to select game speed (from very slow to very fast)

12 files changed:
ChangeLog
src/conf_gfx.c
src/conftime.h
src/editor.c
src/libgame/gadgets.c
src/libgame/system.c
src/libgame/text.c
src/libgame/text.h
src/main.c
src/main.h
src/screens.c
src/tools.c

index 5d3960afe581051e7f8be5ed9445d6cc1f747da1..42c67769f95a8a63f9f6162a39b038aaa2f0cf8d 100644 (file)
--- 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
index 8aafe241ed631f69c0b4ec1d129fcd883ebd8a31..2a02b3c19b50b0c0447668949d86bde55d6683c0 100644 (file)
@@ -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"                 },
index 2ea6f5c2d4f834fd2bd8e5cfc32b6dfc5420d84b..4add64c56b9edae7f7b99d288996f34417c68499 100644 (file)
@@ -1 +1 @@
-#define COMPILE_DATE_STRING "2007-02-09 02:02"
+#define COMPILE_DATE_STRING "2007-02-14 23:53"
index 4c592cf8c2a674ba36efba07f5ea280a1593f9b1..1ec48e18f5c19486e62cd27a36a7ced35de26ab0 100644 (file)
@@ -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()
index 23c51d36f4a9a15ff0608a3a6f27a1c00ff0cca4..3d593a9b1f12ba6ee05346c898bcb6775ddf29ee 100644 (file)
@@ -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 : ' ');
index 46910d43c41f0d9f40a256970095df397fb43253..1c8bb658403a92a378ea274718c9f5e8108532af 100644 (file)
@@ -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 */
index f7369f338b531b140652d3ae3ef8d17067977a87..588263503cba618bb27ddc1dbe8ac4deb16c1fd6 100644 (file)
@@ -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
index 6e510bc6b0098702790be1670c2312a92540743e..f5088b4a6d70525b6e7222eca1da5fd7e91ed888 100644 (file)
@@ -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 */
index 3911f3912d84610daf851c5cc086dd1cd061d901..bfa11abd651c4b346c8f4977443f9a56c7c93fbc 100644 (file)
@@ -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
index f9ab95f40e1b733eb7d4e3b1929d39b44d5e2bbc..ab14f1415fdf059969128d2351caa49fd86bc603 100644 (file)
@@ -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;
index dd25d120c15f80a5c68ce6d7c442a44a2f1fd5c6..6d3bd17057918404aa975464842771d8cf65b760 100644 (file)
@@ -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.");
index 6b1c61cf6c7ca89e231a1a18309b98dc11ac12a9..88c813441050f05ac9595b2a56261e3d586b1866 100644 (file)
@@ -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,