rnd-20060726-6-src
[rocksndiamonds.git] / src / tools.c
index 65c6255871d133ba329e29f677649d03ef6a0429..3a2b962a3469435f1d8f00d6acf497f5be894d87 100644 (file)
@@ -1398,8 +1398,8 @@ void AnimateEnvelope(int envelope_nr, int anim_mode, int action)
   int font_nr = FONT_ENVELOPE_1 + envelope_nr;
   int font_width = getFontWidth(font_nr);
   int font_height = getFontHeight(font_nr);
-  int max_xsize = level.envelope_xsize[envelope_nr];
-  int max_ysize = level.envelope_ysize[envelope_nr];
+  int max_xsize = level.envelope[envelope_nr].xsize;
+  int max_ysize = level.envelope[envelope_nr].ysize;
   int xstart = (anim_mode & ANIM_VERTICAL ? max_xsize : 0);
   int ystart = (anim_mode & ANIM_HORIZONTAL ? max_ysize : 0);
   int xend = max_xsize;
@@ -1426,7 +1426,7 @@ void AnimateEnvelope(int envelope_nr, int anim_mode, int action)
       DrawEnvelopeBackground(envelope_nr, sx,sy, xx,yy, xsize, ysize, font_nr);
 
     DrawTextToTextArea(SX + sx + font_width, SY + sy + font_height,
-                      level.envelope_text[envelope_nr], font_nr, max_xsize,
+                      level.envelope[envelope_nr].text, font_nr, max_xsize,
                       xsize - 2, ysize - 2, mask_mode);
 
     redraw_mask |= REDRAW_FIELD | REDRAW_FROM_BACKBUFFER;
@@ -1960,8 +1960,17 @@ void DrawPlayer(struct PlayerInfo *player)
             last_element == EL_EM_DYNAMITE_ACTIVE ||
             last_element == EL_SP_DISK_RED_ACTIVE)
       DrawDynamite(last_jx, last_jy);
+#if 0
+    /* !!! this is not enough to prevent flickering of players which are
+       moving next to each others without a free tile between them -- this
+       can only be solved by drawing all players layer by layer (first the
+       background, then the foreground etc.) !!! => TODO */
+    else if (!IS_PLAYER(last_jx, last_jy))
+      DrawLevelField(last_jx, last_jy);
+#else
     else
       DrawLevelField(last_jx, last_jy);
+#endif
 
     if (player->is_pushing && IN_SCR_FIELD(SCREENX(next_jx), SCREENY(next_jy)))
       DrawLevelElement(next_jx, next_jy, EL_EMPTY);
@@ -2615,8 +2624,8 @@ unsigned int MoveDoor(unsigned int door_state)
 #if 1
     int end = door_size;
 #else
-    int end = (door_state & DOOR_ACTION_1 &&
-              door_1.anim_mode & ANIM_VERTICAL ? DYSIZE : DXSIZE);
+    int end = (door_state & DOOR_ACTION_1 && door_1.anim_mode & ANIM_VERTICAL ?
+              DYSIZE : DXSIZE);
 #endif
 #if 1
     int start = ((door_state & DOOR_NO_DELAY) ? end : 0);
@@ -2734,9 +2743,15 @@ unsigned int MoveDoor(unsigned int door_state)
 
       if (door_state & DOOR_ACTION_2)
       {
+#if 1
+       int a = MIN(x * door_2.step_offset, door_size);
+       int p = (door_state & DOOR_OPEN_2 ? door_size - a : a);
+       int i = p + door_skip;
+#else
        int a = MIN(x * door_2.step_offset, door_size_2);
        int p = (door_state & DOOR_OPEN_2 ? door_size_2 - a : a);
        int i = p + door_skip;
+#endif
 
        if (door_2.anim_mode & ANIM_STATIC_PANEL)
        {