rnd-20020323-2-src
[rocksndiamonds.git] / src / tools.c
index f7a67afb42b0a9a3a9a1e345923ed77c08eaf1c4..8a5f48e0e0f4197b78718a5130ff5b03fe34132a 100644 (file)
 * tools.c                                                  *
 ***********************************************************/
 
+#if 0
 #include <stdarg.h>
 
 #if defined(PLATFORM_FREEBSD)
 #include <machine/joystick.h>
 #endif
+#endif
 
 #include "libgame/libgame.h"
 
 #include "tools.h"
 #include "game.h"
 #include "events.h"
-#include "joystick.h"
 #include "cartoons.h"
 #include "network.h"
 #include "tape.h"
@@ -434,7 +435,10 @@ void DrawPlayer(struct PlayerInfo *player)
     if (Store[last_jx][last_jy] && IS_DRAWABLE(last_element))
     {
       DrawLevelElement(last_jx, last_jy, Store[last_jx][last_jy]);
-      DrawLevelFieldThruMask(last_jx, last_jy);
+      if (last_element == EL_DYNAMITE_ACTIVE)
+       DrawDynamite(last_jx, last_jy);
+      else
+       DrawLevelFieldThruMask(last_jx, last_jy);
     }
     else if (last_element == EL_DYNAMITE_ACTIVE)
       DrawDynamite(last_jx, last_jy);
@@ -467,6 +471,8 @@ void DrawPlayer(struct PlayerInfo *player)
     DrawLevelElement(jx, jy, Store[jx][jy]);
   else if (!IS_ACTIVE_BOMB(element))
     DrawLevelField(jx, jy);
+  else
+    DrawLevelElement(jx, jy, EL_LEERRAUM);
 
   /* draw player himself */
 
@@ -1107,7 +1113,9 @@ void DrawScreenElementExt(int x, int y, int dx, int dy, int element,
   else if ((element == EL_FELSBROCKEN ||
            element == EL_SP_ZONK ||
            element == EL_BD_ROCK ||
-           IS_GEM(element)) && !cut_mode)
+           element == EL_SP_INFOTRON ||
+           IS_GEM(element))
+          && !cut_mode)
   {
     if (uy >= lev_fieldy-1 || !IS_BELT(Feld[ux][uy+1]))
     {
@@ -1127,13 +1135,15 @@ void DrawScreenElementExt(int x, int y, int dx, int dy, int element,
     }
   }
   else if (element == EL_MAGIC_WALL_EMPTY ||
+          element == EL_MAGIC_WALL_EMPTYING ||
           element == EL_MAGIC_WALL_BD_EMPTY ||
+          element == EL_MAGIC_WALL_BD_EMPTYING ||
           element == EL_MAGIC_WALL_FULL ||
           element == EL_MAGIC_WALL_BD_FULL)
   {
     graphic += 3 + getGraphicAnimationPhase(4, 4, ANIM_REVERSE);
   }
-  else if (IS_AMOEBOID(element))
+  else if (IS_AMOEBOID(element) || element == EL_AMOEBA_DRIPPING)
   {
     graphic = (element == EL_AMOEBE_TOT ? GFX_AMOEBE_TOT : GFX_AMOEBE_LEBT);
     graphic += (x + 2 * y + 4) % 4;
@@ -1358,34 +1368,26 @@ void DrawScreenField(int x, int y)
     boolean cut_mode = NO_CUTTING;
 
     if (element == EL_QUICKSAND_EMPTYING ||
-       content == EL_MAGIC_WALL_EMPTY ||
-       content == EL_MAGIC_WALL_BD_EMPTY ||
-       content == EL_AMOEBE_NASS)
+       element == EL_MAGIC_WALL_EMPTYING ||
+       element == EL_MAGIC_WALL_BD_EMPTYING ||
+       element == EL_AMOEBA_DRIPPING)
       cut_mode = CUT_ABOVE;
     else if (element == EL_QUICKSAND_FILLING ||
-            content == EL_MAGIC_WALL_FULL ||
-            content == EL_MAGIC_WALL_BD_FULL)
+            element == EL_MAGIC_WALL_FILLING ||
+            element == EL_MAGIC_WALL_BD_FILLING)
       cut_mode = CUT_BELOW;
 
     if (cut_mode == CUT_ABOVE)
-    {
-      if (element == EL_QUICKSAND_EMPTYING)
-       DrawScreenElementShifted(x, y, 0, 0, element, NO_CUTTING);
-      else
-       DrawScreenElementShifted(x, y, 0, 0, content, NO_CUTTING);
-    }
+      DrawScreenElementShifted(x, y, 0, 0, element, NO_CUTTING);
     else
       DrawScreenElement(x, y, EL_LEERRAUM);
 
     if (horiz_move)
       DrawScreenElementShifted(x, y, MovPos[ux][uy], 0, element, NO_CUTTING);
+    else if (cut_mode == NO_CUTTING)
+      DrawScreenElementShifted(x, y, 0, MovPos[ux][uy], element, cut_mode);
     else
-    {
-      if (element == EL_QUICKSAND_FILLING || element == EL_QUICKSAND_EMPTYING)
-       DrawScreenElementShifted(x, y, 0, MovPos[ux][uy], content, cut_mode);
-      else
-       DrawScreenElementShifted(x, y, 0, MovPos[ux][uy], element, cut_mode);
-    }
+      DrawScreenElementShifted(x, y, 0, MovPos[ux][uy], content, cut_mode);
 
     if (content == EL_SALZSAEURE)
       DrawLevelElementThruMask(ux, uy + 1, EL_SALZSAEURE);
@@ -1408,9 +1410,9 @@ void DrawScreenField(int x, int y)
     content_old = Store[oldx][oldy];
 
     if (element_old == EL_QUICKSAND_EMPTYING ||
-       content_old == EL_MAGIC_WALL_EMPTY ||
-       content_old == EL_MAGIC_WALL_BD_EMPTY ||
-       content_old == EL_AMOEBE_NASS)
+       element_old == EL_MAGIC_WALL_EMPTYING ||
+       element_old == EL_MAGIC_WALL_BD_EMPTYING ||
+       element_old == EL_AMOEBA_DRIPPING)
       cut_mode = CUT_ABOVE;
 
     DrawScreenElement(x, y, EL_LEERRAUM);
@@ -1418,15 +1420,12 @@ void DrawScreenField(int x, int y)
     if (horiz_move)
       DrawScreenElementShifted(sx, sy, MovPos[oldx][oldy], 0, element_old,
                               NO_CUTTING);
+    else if (cut_mode == NO_CUTTING)
+      DrawScreenElementShifted(sx, sy, 0, MovPos[oldx][oldy], element_old,
+                              cut_mode);
     else
-    {
-      if (element_old == EL_QUICKSAND_EMPTYING)
-       DrawScreenElementShifted(sx, sy, 0, MovPos[oldx][oldy], content_old,
-                                cut_mode);
-      else
-       DrawScreenElementShifted(sx, sy, 0, MovPos[oldx][oldy], element_old,
-                                cut_mode);
-    }
+      DrawScreenElementShifted(sx, sy, 0, MovPos[oldx][oldy], content_old,
+                              cut_mode);
   }
   else if (IS_DRAWABLE(element))
     DrawScreenElement(x, y, element);
@@ -2284,13 +2283,6 @@ static struct
   }
 };
 
-#if 0
-static void DoNotDisplayInfoText(void *ptr)
-{
-  return;
-}
-#endif
-
 void CreateToolButtons()
 {
   int i;
@@ -2337,11 +2329,6 @@ void CreateToolButtons()
                      GDI_DECORATION_SIZE, MINI_TILEX, MINI_TILEY,
                      GDI_DECORATION_SHIFTING, 1, 1,
                      GDI_EVENT_MASK, event_mask,
-
-#if 0
-                     GDI_CALLBACK_INFO, DoNotDisplayInfoText,
-#endif
-
                      GDI_CALLBACK_ACTION, HandleToolButtons,
                      GDI_END);
 
@@ -2365,6 +2352,22 @@ static void HandleToolButtons(struct GadgetInfo *gi)
   request_gadget_id = gi->custom_id;
 }
 
+int get_next_element(int element)
+{
+  switch(element)
+  {
+    case EL_QUICKSAND_FILLING:         return EL_MORAST_VOLL;
+    case EL_QUICKSAND_EMPTYING:                return EL_MORAST_LEER;
+    case EL_MAGIC_WALL_FILLING:                return EL_MAGIC_WALL_FULL;
+    case EL_MAGIC_WALL_EMPTYING:       return EL_MAGIC_WALL_EMPTY;
+    case EL_MAGIC_WALL_BD_FILLING:     return EL_MAGIC_WALL_BD_FULL;
+    case EL_MAGIC_WALL_BD_EMPTYING:    return EL_MAGIC_WALL_BD_EMPTY;
+    case EL_AMOEBA_DRIPPING:           return EL_AMOEBE_NASS;
+
+    default:                           return element;
+  }
+}
+
 int el2gfx(int element)
 {
   switch(element)
@@ -2415,6 +2418,7 @@ int el2gfx(int element)
     case EL_BOMBE:             return GFX_BOMBE;
     case EL_MAGIC_WALL_OFF:    return GFX_MAGIC_WALL_OFF;
     case EL_MAGIC_WALL_EMPTY:  return GFX_MAGIC_WALL_EMPTY;
+    case EL_MAGIC_WALL_EMPTYING:return GFX_MAGIC_WALL_EMPTY;
     case EL_MAGIC_WALL_FULL:   return GFX_MAGIC_WALL_FULL;
     case EL_MAGIC_WALL_DEAD:   return GFX_MAGIC_WALL_DEAD;
     case EL_SALZSAEURE:                return GFX_SALZSAEURE;
@@ -2424,6 +2428,7 @@ int el2gfx(int element)
     case EL_AMOEBE_VOLL:       return GFX_AMOEBE_VOLL;
     case EL_AMOEBE_BD:         return GFX_AMOEBE_BD;
     case EL_AMOEBA2DIAM:       return GFX_AMOEBA2DIAM;
+    case EL_AMOEBA_DRIPPING:   return GFX_AMOEBE_NASS;
     case EL_KOKOSNUSS:         return GFX_KOKOSNUSS;
     case EL_LIFE:              return GFX_LIFE;
     case EL_LIFE_ASYNC:                return GFX_LIFE_ASYNC;
@@ -2476,6 +2481,7 @@ int el2gfx(int element)
     case EL_MAMPFER2:          return GFX_MAMPFER2;
     case EL_MAGIC_WALL_BD_OFF: return GFX_MAGIC_WALL_BD_OFF;
     case EL_MAGIC_WALL_BD_EMPTY:return GFX_MAGIC_WALL_BD_EMPTY;
+    case EL_MAGIC_WALL_BD_EMPTYING:return GFX_MAGIC_WALL_BD_EMPTY;
     case EL_MAGIC_WALL_BD_FULL:        return GFX_MAGIC_WALL_BD_FULL;
     case EL_MAGIC_WALL_BD_DEAD:        return GFX_MAGIC_WALL_BD_DEAD;
     case EL_DYNABOMB_ACTIVE_1: return GFX_DYNABOMB;