rnd-20070215-1-src
[rocksndiamonds.git] / src / tools.c
index 84198618ee2a7baad4d783662277f6f49f6ad158..88c813441050f05ac9595b2a56261e3d586b1866 100644 (file)
@@ -600,6 +600,20 @@ void SetMainBackgroundImageIfDefined(int graphic)
     SetMainBackgroundBitmap(graphic_info[graphic].bitmap);
 }
 
+void SetDoorBackgroundImageIfDefined(int graphic)
+{
+  if (graphic_info[graphic].bitmap)
+    SetDoorBackgroundBitmap(graphic_info[graphic].bitmap);
+}
+
+void SetWindowBackgroundImage(int graphic)
+{
+  SetWindowBackgroundBitmap(graphic == IMG_UNDEFINED ? NULL :
+                           graphic_info[graphic].bitmap ?
+                           graphic_info[graphic].bitmap :
+                           graphic_info[IMG_BACKGROUND].bitmap);
+}
+
 void SetMainBackgroundImage(int graphic)
 {
   SetMainBackgroundBitmap(graphic == IMG_UNDEFINED ? NULL :
@@ -1617,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,
@@ -2791,6 +2805,23 @@ boolean Request(char *text, unsigned int req_state)
        result = 0;
     }
 
+#if 1
+
+    if (game_status == GAME_MODE_PLAYING && local_player->LevelSolved_GameEnd)
+    {
+      HandleGameActions();
+      BackToFront();
+    }
+    else
+    {
+      DoAnimation();
+
+      if (!PendingEvent())     /* delay only if no pending events */
+       Delay(10);
+    }
+
+#else
+
     DoAnimation();
 
 #if 1
@@ -2799,6 +2830,8 @@ boolean Request(char *text, unsigned int req_state)
 #else
     /* don't eat all CPU time */
     Delay(10);
+#endif
+
 #endif
   }