rnd-19990925-1-src
[rocksndiamonds.git] / src / tools.c
index fbd0ca17d7da66db7838717432ca6206eb17ee35..d73c1d8900fa62c3b2dfe276c3aa8e919541271f 100644 (file)
@@ -319,6 +319,7 @@ void ClearWindow()
 int getFontWidth(int font_size, int font_type)
 {
   return (font_size == FS_BIG ? FONT1_XSIZE :
+         font_size == FS_MEDIUM ? FONT6_XSIZE :
          font_type == FC_SPECIAL1 ? FONT3_XSIZE :
          font_type == FC_SPECIAL2 ? FONT4_XSIZE :
          font_type == FC_SPECIAL3 ? FONT5_XSIZE :
@@ -328,12 +329,24 @@ int getFontWidth(int font_size, int font_type)
 int getFontHeight(int font_size, int font_type)
 {
   return (font_size == FS_BIG ? FONT1_YSIZE :
+         font_size == FS_MEDIUM ? FONT6_YSIZE :
          font_type == FC_SPECIAL1 ? FONT3_YSIZE :
          font_type == FC_SPECIAL2 ? FONT4_YSIZE :
          font_type == FC_SPECIAL3 ? FONT5_YSIZE :
          FONT2_YSIZE);
 }
 
+void DrawInitText(char *text, int ypos, int color)
+{
+  if (display && window && pix[PIX_SMALLFONT])
+  {
+    XFillRectangle(display, window, gc, 0, ypos, WIN_XSIZE, FONT2_YSIZE);
+    DrawTextExt(window, gc, (WIN_XSIZE - strlen(text) * FONT2_XSIZE)/2,
+               ypos,text,FS_SMALL,color);
+    XFlush(display);
+  }
+}
+
 void DrawTextFCentered(int y, int font_type, char *format, ...)
 {
   char buffer[FULL_SXSIZE / FONT5_XSIZE + 10];
@@ -377,7 +390,7 @@ void DrawTextExt(Drawable d, GC gc, int x, int y,
   int font_pixmap;
   boolean print_inverse = FALSE;
 
-  if (font_size != FS_SMALL && font_size != FS_BIG)
+  if (font_size != FS_SMALL && font_size != FS_BIG && font_size != FS_MEDIUM)
     font_size = FS_SMALL;
   if (font_type < FC_RED || font_type > FC_SPECIAL3)
     font_type = FC_RED;
@@ -385,8 +398,12 @@ void DrawTextExt(Drawable d, GC gc, int x, int y,
   font_width = getFontWidth(font_size, font_type);
   font_height = getFontHeight(font_size, font_type);
 
-  font_pixmap = (font_size == FS_BIG ? PIX_BIGFONT : PIX_SMALLFONT);
-  font_start = (font_type * (font_size == FS_BIG ? FONT1_YSIZE : FONT2_YSIZE) *
+  font_pixmap = (font_size == FS_BIG ? PIX_BIGFONT :
+                font_size == FS_MEDIUM ? PIX_MEDIUMFONT :
+                PIX_SMALLFONT);
+  font_start = (font_type * (font_size == FS_BIG ? FONT1_YSIZE :
+                            font_size == FS_MEDIUM ? FONT6_YSIZE :
+                            FONT2_YSIZE) *
                FONT_LINES_PER_FONT);
 
   if (font_type == FC_SPECIAL3)
@@ -2568,6 +2585,24 @@ int el2gfx(int element)
     case EL_TIMEGATE_CLOSED:   return GFX_TIMEGATE_CLOSED;
     case EL_TIMEGATE_SWITCH_ON:        return GFX_TIMEGATE_SWITCH;
     case EL_TIMEGATE_SWITCH_OFF:return GFX_TIMEGATE_SWITCH;
+    case EL_BALLOON:           return GFX_BALLOON;
+    case EL_BALLOON_SEND_LEFT: return GFX_BALLOON_SEND_LEFT;
+    case EL_BALLOON_SEND_RIGHT:        return GFX_BALLOON_SEND_RIGHT;
+    case EL_BALLOON_SEND_UP:   return GFX_BALLOON_SEND_UP;
+    case EL_BALLOON_SEND_DOWN: return GFX_BALLOON_SEND_DOWN;
+    case EL_BALLOON_SEND_ANY:  return GFX_BALLOON_SEND_ANY;
+    case EL_EMC_STEEL_WALL_1:  return GFX_EMC_STEEL_WALL_1;
+    case EL_EMC_STEEL_WALL_2:  return GFX_EMC_STEEL_WALL_2;
+    case EL_EMC_STEEL_WALL_3:  return GFX_EMC_STEEL_WALL_3;
+    case EL_EMC_STEEL_WALL_4:  return GFX_EMC_STEEL_WALL_4;
+    case EL_EMC_WALL_1:                return GFX_EMC_WALL_1;
+    case EL_EMC_WALL_2:                return GFX_EMC_WALL_2;
+    case EL_EMC_WALL_3:                return GFX_EMC_WALL_3;
+    case EL_EMC_WALL_4:                return GFX_EMC_WALL_4;
+    case EL_EMC_WALL_5:                return GFX_EMC_WALL_5;
+    case EL_EMC_WALL_6:                return GFX_EMC_WALL_6;
+    case EL_EMC_WALL_7:                return GFX_EMC_WALL_7;
+    case EL_EMC_WALL_8:                return GFX_EMC_WALL_8;
 
     default:
     {