rnd-20131120-1-src
[rocksndiamonds.git] / src / libgame / text.c
index 23de7cac548849a90e4c395a35391e9b0b1fb640..dd926f62350be231f77e5640aea4d88d2b6b4dd5 100644 (file)
@@ -28,7 +28,7 @@ static GC     font_clip_gc = None;
 static void InitFontClipmasks()
 {
   XGCValues clip_gc_values;
-  unsigned long clip_gc_valuemask;
+  unsigned int clip_gc_valuemask;
   GC copy_clipmask_gc;
   int i, j;
 
@@ -210,8 +210,8 @@ int maxWordLengthInString(char *text)
 
 void DrawInitTextExt(char *text, int ypos, int font_nr, boolean force)
 {
-  static unsigned long progress_delay = 0;
-  unsigned long progress_delay_value = 100;    /* (in milliseconds) */
+  static unsigned int progress_delay = 0;
+  unsigned int progress_delay_value = 100;     /* (in milliseconds) */
 
   UPDATE_BUSY_STATE();
 
@@ -947,6 +947,24 @@ int DrawTextBuffer(int x, int y, char *text_buffer, int font_nr,
   return current_line;
 }
 
+int DrawTextBufferVA(int x, int y, char *format, va_list ap, int font_nr,
+                    int line_length, int cut_length, int max_lines,
+                    int line_spacing, int mask_mode, boolean autowrap,
+                    boolean centered, boolean parse_comments)
+{
+  char text_buffer[MAX_OUTPUT_LINESIZE];
+  int text_length = vsnprintf(text_buffer, MAX_OUTPUT_LINESIZE, format, ap);
+
+  if (text_length >= MAX_OUTPUT_LINESIZE)
+    Error(ERR_WARN, "string too long in DrawTextBufferVA() -- truncated");
+
+  int num_lines_printed = DrawTextBuffer(x, y, text_buffer, font_nr,
+                                        line_length, cut_length, max_lines,
+                                        line_spacing, mask_mode, autowrap,
+                                        centered, parse_comments);
+  return num_lines_printed;
+}
+
 int DrawTextFile(int x, int y, char *filename, int font_nr,
                 int line_length, int cut_length, int max_lines,
                 int line_spacing, int mask_mode, boolean autowrap,