rnd-19981003-2
[rocksndiamonds.git] / src / tools.c
index 3d1ec872b625d7e27fb20f3de482c78ba3205e10..a705df5603bf498f82f15aa2c42246bd067a1eef 100644 (file)
@@ -1,13 +1,12 @@
 /***********************************************************
 *  Rocks'n'Diamonds -- McDuffin Strikes Back!              *
 *----------------------------------------------------------*
-*  ©1995 Artsoft Development                               *
-*        Holger Schemel                                    *
-*        33659 Bielefeld-Senne                             *
-*        Telefon: (0521) 493245                            *
-*        eMail: aeglos@valinor.owl.de                      *
-*               aeglos@uni-paderborn.de                    *
-*               q99492@pbhrzx.uni-paderborn.de             *
+*  (c) 1995-98 Artsoft Entertainment                       *
+*              Holger Schemel                              *
+*              Oststrasse 11a                              *
+*              33604 Bielefeld                             *
+*              phone: ++49 +521 290471                     *
+*              email: aeglos@valinor.owl.de                *
 *----------------------------------------------------------*
 *  tools.c                                                 *
 ***********************************************************/
@@ -72,7 +71,7 @@ void BackToFront()
   if (redraw_mask & REDRAW_TILES && redraw_tiles > REDRAWTILES_THRESHOLD)
     redraw_mask |= REDRAW_FIELD;
 
-  if (redraw_mask & REDRAW_FIELD || ScreenMovPos)
+  if (redraw_mask & REDRAW_FIELD || ScreenGfxPos)
     redraw_mask &= ~REDRAW_TILES;
 
   if (!redraw_mask)
@@ -109,8 +108,8 @@ void BackToFront()
 
       if (soft_scrolling_on)
       {
-       fx += (local_player->MovDir & (MV_LEFT|MV_RIGHT) ? ScreenMovPos : 0);
-       fy += (local_player->MovDir & (MV_UP|MV_DOWN)    ? ScreenMovPos : 0);
+       fx += (ScreenMovDir & (MV_LEFT|MV_RIGHT) ? ScreenGfxPos : 0);
+       fy += (ScreenMovDir & (MV_UP|MV_DOWN)    ? ScreenGfxPos : 0);
       }
 
       XCopyArea(display,buffer,window,gc,
@@ -383,7 +382,7 @@ void DrawPlayer(struct PlayerInfo *player)
     if (Store[last_jx][last_jy])
     {
       DrawLevelElement(last_jx,last_jy, Store[last_jx][last_jy]);
-      DrawLevelElementThruMask(last_jx,last_jy, Feld[last_jx][last_jy]);
+      DrawLevelFieldThruMask(last_jx,last_jy);
     }
     else if (Feld[last_jx][last_jy] == EL_DYNAMIT)
       DrawDynamite(last_jx,last_jy);
@@ -484,20 +483,22 @@ void DrawPlayer(struct PlayerInfo *player)
     DrawGraphicThruMask(sx,sy, graphic + phase);
   }
 
-  if (direct_draw_on)
+  if ((last_jx != jx || last_jy != jy) && Feld[last_jx][last_jy]==EL_EXPLODING)
   {
-    int dest_x = SX + sx*TILEX;
-    int dest_y = SY + sy*TILEY;
-    int x_size = TILEX;
-    int y_size = TILEY;
+    int phase = Frame[last_jx][last_jy];
+    int delay = 2;
 
-    if (!ScreenMovPos)
-    {
-      dest_x = SX + SCREENX(MIN(jx,last_jx))*TILEX;
-      dest_y = SY + SCREENY(MIN(jy,last_jy))*TILEY;
-      x_size = TILEX * (1 + ABS(jx - last_jx));
-      y_size = TILEY * (1 + ABS(jy - last_jy));
-    }
+    if (phase > 2)
+      DrawGraphicThruMask(SCREENX(last_jx),SCREENY(last_jy),
+                         GFX_EXPLOSION + ((phase-1)/delay-1));
+  }
+
+  if (direct_draw_on)
+  {
+    int dest_x = SX + SCREENX(MIN(jx,last_jx))*TILEX;
+    int dest_y = SY + SCREENY(MIN(jy,last_jy))*TILEY;
+    int x_size = TILEX * (1 + ABS(jx - last_jx));
+    int y_size = TILEY * (1 + ABS(jy - last_jy));
 
     XCopyArea(display,drawto_field,window,gc,
              dest_x,dest_y, x_size,y_size, dest_x,dest_y);
@@ -955,6 +956,11 @@ void DrawLevelElementThruMask(int x, int y, int element)
   DrawLevelElementExt(x,y, 0,0, element, NO_CUTTING, USE_MASKING);
 }
 
+void DrawLevelFieldThruMask(int x, int y)
+{
+  DrawLevelElementExt(x,y, 0,0, Feld[x][y], NO_CUTTING, USE_MASKING);
+}
+
 void ErdreichAnbroeckeln(int x, int y)
 {
   int i, width, height, cx,cy;
@@ -1096,13 +1102,8 @@ void DrawScreenField(int x, int y)
        Store[ux][uy]==EL_AMOEBE_NASS)
       cut_mode = CUT_ABOVE;
     else if (Store[ux][uy]==EL_MORAST_VOLL ||
-
-#if 0
-       Store[ux][uy]==EL_SALZSAEURE ||
-#endif
-
-       Store[ux][uy]==EL_SIEB_VOLL ||
-       Store[ux][uy]==EL_SIEB2_VOLL)
+            Store[ux][uy]==EL_SIEB_VOLL ||
+            Store[ux][uy]==EL_SIEB2_VOLL)
       cut_mode = CUT_BELOW;
 
     if (cut_mode==CUT_ABOVE)
@@ -1115,11 +1116,8 @@ void DrawScreenField(int x, int y)
     else
       DrawScreenElementShifted(x,y, 0,MovPos[ux][uy], element, cut_mode);
 
-#if 1
     if (Store[ux][uy] == EL_SALZSAEURE)
       DrawLevelElementThruMask(ux,uy+1, EL_SALZSAEURE);
-#endif
-
   }
   else if (IS_BLOCKED(ux,uy))
   {
@@ -1745,6 +1743,9 @@ int el2gfx(int element)
     case EL_ZEIT_VOLL:         return(GFX_ZEIT_VOLL);
     case EL_ZEIT_LEER:         return(GFX_ZEIT_LEER);
     case EL_MAUER_LEBT:                return(GFX_MAUER_LEBT);
+    case EL_MAUER_X:           return(GFX_MAUER_X);
+    case EL_MAUER_Y:           return(GFX_MAUER_Y);
+    case EL_MAUER_XY:          return(GFX_MAUER_XY);
     case EL_EDELSTEIN_BD:      return(GFX_EDELSTEIN_BD);
     case EL_EDELSTEIN_GELB:    return(GFX_EDELSTEIN_GELB);
     case EL_EDELSTEIN_ROT:     return(GFX_EDELSTEIN_ROT);