fixed initialization bug when clearing menu list area
[rocksndiamonds.git] / src / screens.c
index 20f5f67ce29dad3fdb2d6b02cb371e431ce8f5ac..469239d18b48fc4b779cc9f0f9823d94718ed1e4 100644 (file)
@@ -961,10 +961,8 @@ static void InitializeMainControls()
 
     if (pos_button != NULL)            /* (x/y may be -1/-1 here) */
     {
-      if (pos_button->width == 0)
-       pos_button->width = button_width;
-      if (pos_button->height == 0)
-       pos_button->height = button_height;
+      pos_button->width  = button_width;
+      pos_button->height = button_height;
     }
 
     if (pos_text != NULL)              /* (x/y may be -1/-1 here) */
@@ -972,18 +970,19 @@ static void InitializeMainControls()
       /* calculate size for non-clickable text -- needed for text alignment */
       boolean calculate_text_size = (pos_button == NULL && text != NULL);
 
+      if (pos_text->width == -1 || calculate_text_size)
+       pos_text->width = text_width;
+      if (pos_text->height == -1 || calculate_text_size)
+       pos_text->height = text_height;
+
       if (visibleMenuPos(pos_button))
       {
        if (pos_text->x == -1)
          pos_text->x = pos_button->x + pos_button->width;
        if (pos_text->y == -1)
-         pos_text->y = pos_button->y;
+         pos_text->y =
+           pos_button->y + (pos_button->height - pos_text->height) / 2;
       }
-
-      if (pos_text->width == -1 || calculate_text_size)
-       pos_text->width = text_width;
-      if (pos_text->height == -1 || calculate_text_size)
-       pos_text->height = text_height;
     }
 
     if (pos_input != NULL)             /* (x/y may be -1/-1 here) */
@@ -1224,10 +1223,7 @@ void DrawTitleScreenImage(int nr, boolean initial)
   ClearRectangleOnBackground(drawto, 0, 0, WIN_XSIZE, WIN_YSIZE);
 
   if (DrawingOnBackground(dst_x, dst_y))
-  {
-    SetClipOrigin(bitmap, bitmap->stored_clip_gc, dst_x - src_x, dst_y - src_y);
     BlitBitmapMasked(bitmap, drawto, src_x, src_y, width, height, dst_x, dst_y);
-  }
   else
     BlitBitmap(bitmap, drawto, src_x, src_y, width, height, dst_x, dst_y);
 
@@ -1684,7 +1680,7 @@ void HandleMainMenu_SelectLevel(int step, int direction, int selected_level_nr)
 
     /* needed because DrawPreviewLevelInitial() takes some time */
     BackToFront();
-    SyncDisplay();
+    /* SyncDisplay(); */
   }
 }
 
@@ -3275,8 +3271,8 @@ static void clearMenuListArea()
   int scrollbar_xpos = mSX + SC_SCROLLBAR_XPOS + menu.scrollbar_xoffset;
 
   /* correct scrollbar position if placed outside menu (playfield) area */
-  if (scrollbar_xpos > SC_SCROLLBAR_XPOS)
-    scrollbar_xpos = SC_SCROLLBAR_XPOS;
+  if (scrollbar_xpos > mSX + SC_SCROLLBAR_XPOS)
+    scrollbar_xpos = mSX + SC_SCROLLBAR_XPOS;
 
   /* clear menu list area, but not title or scrollbar */
   DrawBackground(mSX, mSY + MENU_SCREEN_START_YPOS * 32,
@@ -6571,8 +6567,8 @@ static void CreateScreenScrollbuttons()
     height = SC_SCROLLBUTTON_YSIZE;
 
     /* correct scrollbar position if placed outside menu (playfield) area */
-    if (x > SC_SCROLL_UP_XPOS)
-      x = SC_SCROLL_UP_XPOS;
+    if (x > SX + SC_SCROLL_UP_XPOS)
+      x = SX + SC_SCROLL_UP_XPOS;
 
     if (id == SCREEN_CTRL_ID_SCROLL_DOWN)
       y = mSY + (SC_SCROLL_VERTICAL_YPOS +
@@ -6640,8 +6636,8 @@ static void CreateScreenScrollbars()
     height = scrollbar_info[i].height;
 
     /* correct scrollbar position if placed outside menu (playfield) area */
-    if (x > SC_SCROLL_VERTICAL_XPOS)
-      x = SC_SCROLL_VERTICAL_XPOS;
+    if (x > SX + SC_SCROLL_VERTICAL_XPOS)
+      x = SX + SC_SCROLL_VERTICAL_XPOS;
 
     if (id == SCREEN_CTRL_ID_SCROLL_VERTICAL)
       height = (NUM_MENU_ENTRIES_ON_SCREEN - 2) * SC_SCROLLBUTTON_YSIZE;