rnd-20030416-2-src
authorHolger Schemel <info@artsoft.org>
Wed, 16 Apr 2003 17:40:58 +0000 (19:40 +0200)
committerHolger Schemel <info@artsoft.org>
Sat, 30 Aug 2014 08:41:12 +0000 (10:41 +0200)
src/conftime.h
src/game.c
src/init.c
src/main.h
src/tools.c

index 6338934d4f22cf9d953bae1e4d6159c86e264b4b..26c387b9203e7dd277a505ade0ed392dbf29b1c4 100644 (file)
@@ -1 +1 @@
-#define COMPILE_DATE_STRING "[2003-04-15 23:44]"
+#define COMPILE_DATE_STRING "[2003-04-16 19:38]"
index 338e670b5f686b818847cef68dc46279d0cbfd7e..ce66ee8711fecdaeaee3a670fc7c5924ce5a23e3 100644 (file)
@@ -5030,7 +5030,7 @@ static void CheckGravityMovement(struct PlayerInfo *player)
 
     if (field_under_player_is_free &&
        !player_is_moving_to_valid_field &&
-       !IS_WALKABLE_UNDER(Feld[jx][jy]))
+       !IS_WALKABLE_THROUGH(Feld[jx][jy]))
       player->programmed_action = MV_DOWN;
   }
 }
@@ -5706,7 +5706,7 @@ int DigField(struct PlayerInfo *player,
   if (IS_MOVING(x, y) || IS_PLAYER(x, y))
     return MF_NO_ACTION;
 
-  if (IS_WALKABLE_UNDER(Feld[jx][jy]))
+  if (IS_WALKABLE_THROUGH(Feld[jx][jy]))
   {
     int i = 0;
     int tube_leave_directions[][2] =
index 508a50af5580138576d56812052d4f5029ec8e14..9224bb64fd5958983e155f303c083852431e8ef2 100644 (file)
@@ -1957,6 +1957,63 @@ void InitElementProperties()
     -1
   };
 
+  static int ep_walkable_through[] =
+  {
+    EL_TUBE_ANY,
+    EL_TUBE_VERTICAL,
+    EL_TUBE_HORIZONTAL,
+    EL_TUBE_VERTICAL_LEFT,
+    EL_TUBE_VERTICAL_RIGHT,
+    EL_TUBE_HORIZONTAL_UP,
+    EL_TUBE_HORIZONTAL_DOWN,
+    EL_TUBE_LEFT_UP,
+    EL_TUBE_LEFT_DOWN,
+    EL_TUBE_RIGHT_UP,
+    EL_TUBE_RIGHT_DOWN,
+    -1
+  };
+
+  static int ep_walkable_under[] =
+  {
+    -1
+  };
+
+  static int ep_passable_over[] =
+  {
+    EL_EM_GATE_1,
+    EL_EM_GATE_2,
+    EL_EM_GATE_3,
+    EL_EM_GATE_4,
+    EL_EM_GATE_1_GRAY,
+    EL_EM_GATE_2_GRAY,
+    EL_EM_GATE_3_GRAY,
+    EL_EM_GATE_4_GRAY,
+    EL_SWITCHGATE_OPEN,
+    EL_TIMEGATE_OPEN,
+    -1
+  };
+
+  static int ep_passable_through[] =
+  {
+    EL_SP_PORT_LEFT,
+    EL_SP_PORT_RIGHT,
+    EL_SP_PORT_UP,
+    EL_SP_PORT_DOWN,
+    EL_SP_PORT_HORIZONTAL,
+    EL_SP_PORT_VERTICAL,
+    EL_SP_PORT_ANY,
+    EL_SP_GRAVITY_PORT_LEFT,
+    EL_SP_GRAVITY_PORT_RIGHT,
+    EL_SP_GRAVITY_PORT_UP,
+    EL_SP_GRAVITY_PORT_DOWN,
+    -1
+  };
+
+  static int ep_passable_under[] =
+  {
+    -1
+  };
+
   static int ep_diggable[] =
   {
     EL_SAND,
@@ -2006,32 +2063,6 @@ void InitElementProperties()
     -1
   };
 
-  static int ep_walkable_through[] =
-  {
-    EL_EM_GATE_1,
-    EL_EM_GATE_2,
-    EL_EM_GATE_3,
-    EL_EM_GATE_4,
-    EL_EM_GATE_1_GRAY,
-    EL_EM_GATE_2_GRAY,
-    EL_EM_GATE_3_GRAY,
-    EL_EM_GATE_4_GRAY,
-    EL_SP_PORT_LEFT,
-    EL_SP_PORT_RIGHT,
-    EL_SP_PORT_UP,
-    EL_SP_PORT_DOWN,
-    EL_SP_PORT_HORIZONTAL,
-    EL_SP_PORT_VERTICAL,
-    EL_SP_PORT_ANY,
-    EL_SP_GRAVITY_PORT_LEFT,
-    EL_SP_GRAVITY_PORT_RIGHT,
-    EL_SP_GRAVITY_PORT_UP,
-    EL_SP_GRAVITY_PORT_DOWN,
-    EL_SWITCHGATE_OPEN,
-    EL_TIMEGATE_OPEN,
-    -1
-  };
-
   static int ep_over_player[] =
   {
     EL_SP_PORT_LEFT,
@@ -2121,22 +2152,6 @@ void InitElementProperties()
     -1
   };
 
-  static int ep_walkable_under[] =
-  {
-    EL_TUBE_ANY,
-    EL_TUBE_VERTICAL,
-    EL_TUBE_HORIZONTAL,
-    EL_TUBE_VERTICAL_LEFT,
-    EL_TUBE_VERTICAL_RIGHT,
-    EL_TUBE_HORIZONTAL_UP,
-    EL_TUBE_HORIZONTAL_DOWN,
-    EL_TUBE_LEFT_UP,
-    EL_TUBE_LEFT_DOWN,
-    EL_TUBE_RIGHT_UP,
-    EL_TUBE_RIGHT_DOWN,
-    -1
-  };
-
   static int ep_sp_element[] =
   {
     EL_SP_EMPTY,
@@ -2197,11 +2212,6 @@ void InitElementProperties()
     -1
   };
 
-  static int ep_solid_new[] =
-  {
-    -1
-  };
-
   static struct
   {
     int *elements;
@@ -2234,18 +2244,21 @@ void InitElementProperties()
     { ep_pushable,             EP_PUSHABLE             },
     { ep_player,               EP_PLAYER               },
     { ep_walkable_over,                EP_WALKABLE_OVER        },
+    { ep_walkable_through,     EP_WALKABLE_THROUGH     },
+    { ep_walkable_under,       EP_WALKABLE_UNDER       },
+    { ep_passable_over,                EP_PASSABLE_OVER        },
+    { ep_passable_through,     EP_PASSABLE_THROUGH     },
+    { ep_passable_under,       EP_PASSABLE_UNDER       },
+
     { ep_diggable,             EP_DIGGABLE             },
     { ep_collectible,          EP_COLLECTIBLE          },
-    { ep_walkable_through,     EP_WALKABLE_THROUGH     },
     { ep_over_player,          EP_OVER_PLAYER          },
     { ep_active_bomb,          EP_ACTIVE_BOMB          },
     { ep_belt,                 EP_BELT                 },
     { ep_belt_active,          EP_BELT_ACTIVE          },
     { ep_belt_switch,          EP_BELT_SWITCH          },
-    { ep_walkable_under,       EP_WALKABLE_UNDER       },
     { ep_sp_element,           EP_SP_ELEMENT           },
     { ep_has_content,          EP_HAS_CONTENT          },
-    { ep_solid_new,            EP_SOLID_NEW            },
     { NULL,                    -1                      }
   };
 
@@ -2271,7 +2284,7 @@ void InitElementProperties()
     EP_PLAYER,
     EP_HAS_CONTENT,
     EP_DIGGABLE,
-    EP_WALKABLE_THROUGH,
+    EP_PASSABLE_THROUGH,
     EP_OVER_PLAYER,
     EP_ACTIVE_BOMB,
 
@@ -2299,6 +2312,25 @@ void InitElementProperties()
   for (i=EL_CHAR_START; i<=EL_CHAR_END; i++)
     SET_PROPERTY(i, EP_INACTIVE, TRUE);
 
+  /* set properties derived from other properties */
+  for (i=0; i<MAX_NUM_ELEMENTS; i++)
+  {
+    if (IS_WALKABLE_OVER(i) || IS_WALKABLE_THROUGH(i) || IS_WALKABLE_UNDER(i))
+      SET_PROPERTY(i, EP_WALKABLE, TRUE);
+
+    if (IS_PASSABLE_OVER(i) || IS_PASSABLE_THROUGH(i) || IS_PASSABLE_UNDER(i))
+      SET_PROPERTY(i, EP_PASSABLE, TRUE);
+
+    if (IS_WALKABLE_OVER(i) || IS_PASSABLE_OVER(i))
+      SET_PROPERTY(i, EP_PLAYER_OVER, TRUE);
+
+    if (IS_WALKABLE_THROUGH(i) || IS_PASSABLE_THROUGH(i))
+      SET_PROPERTY(i, EP_PLAYER_INSIDE, TRUE);
+
+    if (IS_WALKABLE_UNDER(i) || IS_PASSABLE_UNDER(i))
+      SET_PROPERTY(i, EP_PLAYER_UNDER, TRUE);
+  }
+
 #if 0
   /* determine inactive elements (used for engine main loop optimization) */
   for (i=0; i < MAX_NUM_ELEMENTS; i++)
index 6e46f348e52bb8a531acd74c74bd45484554a0c4..656481d5581a5c0a982a2c26e43ba62d8a3bcac4 100644 (file)
@@ -60,7 +60,7 @@
 #define IN_SCR_FIELD(x,y) ((x)>=BX1 && (x)<=BX2 && (y)>=BY1 &&(y)<=BY2)
 #define IN_LEV_FIELD(x,y) ((x)>=0 && (x)<lev_fieldx && (y)>=0 &&(y)<lev_fieldy)
 
-/* property values */
+/* values for base properties */
 #define EP_AMOEBALIVE          0
 #define EP_AMOEBOID            1
 #define EP_CAN_BE_CRUMBLED     2
 #define EP_PUSHABLE            24
 #define EP_PLAYER              25
 #define EP_WALKABLE_OVER       26
-#define EP_DIGGABLE            27
-#define EP_COLLECTIBLE         28
-#define EP_WALKABLE_THROUGH    29
-#define EP_OVER_PLAYER         30
-#define EP_ACTIVE_BOMB         31
-
-#define EP_BELT                        32
-#define EP_BELT_ACTIVE         33
-#define EP_BELT_SWITCH         34
-#define EP_WALKABLE_UNDER      35
-#define EP_SP_ELEMENT          36
-#define EP_HAS_CONTENT         37
-#define EP_SOLID_NEW           38
-
-#define NUM_ELEMENT_PROPERTIES 39
+#define EP_WALKABLE_THROUGH    27
+#define EP_WALKABLE_UNDER      28
+#define EP_PASSABLE_OVER       29
+#define EP_PASSABLE_THROUGH    30
+#define EP_PASSABLE_UNDER      31
+
+/* values for runtime properties */
+#define EP_WALKABLE            32
+#define EP_PASSABLE            33
+#define EP_PLAYER_OVER         34
+#define EP_PLAYER_INSIDE       35
+#define EP_PLAYER_UNDER                36
+#define EP_DIGGABLE            37
+#define EP_COLLECTIBLE         38
+#define EP_OVER_PLAYER         39
+#define EP_ACTIVE_BOMB         40
+#define EP_BELT                        41
+#define EP_BELT_ACTIVE         42
+#define EP_BELT_SWITCH         43
+#define EP_SP_ELEMENT          44
+#define EP_HAS_CONTENT         45
+
+#define NUM_ELEMENT_PROPERTIES 46
 
 #define NUM_EP_BITFIELDS       ((NUM_ELEMENT_PROPERTIES + 31) / 32)
 #define EP_BITFIELD_BASE       0
 
+#define EP_BITMASK_DEFAULT     0
+
 #define PROPERTY_BIT(p)                (1 << ((p) % 32))
 #define PROPERTY_VAR(e, p)     (Properties[e][(p) / 32])
 #define HAS_PROPERTY(e, p)     ((PROPERTY_VAR(e, p) & PROPERTY_BIT(p)) != 0)
                                 (PROPERTY_VAR(e,p) |=  PROPERTY_BIT(p)) : \
                                 (PROPERTY_VAR(e,p) &= ~PROPERTY_BIT(p)))
 
-/* property bit masks */
-#define EP_BIT_AMOEBALIVE      PROPERTY_BIT(EP_AMOEBALIVE)
-#define EP_BIT_AMOEBOID                PROPERTY_BIT(EP_AMOEBOID)
-#define EP_BIT_CAN_BE_CRUMBLED PROPERTY_BIT(EP_CAN_BE_CRUMBLED)
-#define EP_BIT_PFORTE          PROPERTY_BIT(EP_PFORTE)
-#define EP_BIT_SOLID           PROPERTY_BIT(EP_SOLID)
-#define EP_BIT_INDESTRUCTIBLE  PROPERTY_BIT(EP_INDESTRUCTIBLE)
-#define EP_BIT_SLIPPERY                PROPERTY_BIT(EP_SLIPPERY)
-#define EP_BIT_ENEMY           PROPERTY_BIT(EP_ENEMY)
-#define EP_BIT_MAUER           PROPERTY_BIT(EP_MAUER)
-#define EP_BIT_CAN_FALL                PROPERTY_BIT(EP_CAN_FALL)
-#define EP_BIT_CAN_SMASH       PROPERTY_BIT(EP_CAN_SMASH)
-#define EP_BIT_CAN_CHANGE      PROPERTY_BIT(EP_CAN_CHANGE)
-#define EP_BIT_CAN_MOVE                PROPERTY_BIT(EP_CAN_MOVE)
-#define EP_BIT_COULD_MOVE      PROPERTY_BIT(EP_COULD_MOVE)
-#define EP_BIT_DONT_TOUCH      PROPERTY_BIT(EP_DONT_TOUCH)
-#define EP_BIT_DONT_GO_TO      PROPERTY_BIT(EP_DONT_GO_TO)
-#define EP_BIT_FOOD_DARK_YAMYAM        PROPERTY_BIT(EP_FOOD_DARK_YAMYAM)
-#define EP_BIT_EM_SLIPPERY_WALL        PROPERTY_BIT(EP_EM_SLIPPERY_WALL)
-#define EP_BIT_BD_ELEMENT      PROPERTY_BIT(EP_BD_ELEMENT)
-#define EP_BIT_SB_ELEMENT      PROPERTY_BIT(EP_SB_ELEMENT)
-#define EP_BIT_GEM             PROPERTY_BIT(EP_GEM)
-#define EP_BIT_INACTIVE                PROPERTY_BIT(EP_INACTIVE)
-#define EP_BIT_EXPLOSIVE       PROPERTY_BIT(EP_EXPLOSIVE)
-#define EP_BIT_FOOD_PENGUIN    PROPERTY_BIT(EP_FOOD_PENGUIN)
-#define EP_BIT_PUSHABLE                PROPERTY_BIT(EP_PUSHABLE)
-#define EP_BIT_PLAYER          PROPERTY_BIT(EP_PLAYER)
-#define EP_BIT_WALKABLE_OVER   PROPERTY_BIT(EP_WALKABLE_OVER)
-#define EP_BIT_DIGGABLE                PROPERTY_BIT(EP_DIGGABLE)
-#define EP_BIT_COLLECTIBLE     PROPERTY_BIT(EP_COLLECTIBLE)
-#define EP_BIT_WALKABLE_THROUGH PROPERTY_BIT(EP_WALKABLE_THROUGH)
-#define EP_BIT_OVER_PLAYER     PROPERTY_BIT(EP_OVER_PLAYER)
-#define EP_BIT_ACTIVE_BOMB     PROPERTY_BIT(EP_ACTIVE_BOMB)
-
-#define EP_BIT_BELT            PROPERTY_BIT(EP_BELT)
-#define EP_BIT_BELT_ACTIVE     PROPERTY_BIT(EP_BELT_ACTIVE)
-#define EP_BIT_BELT_SWITCH     PROPERTY_BIT(EP_BELT_SWITCH)
-#define EP_BIT_WALKABLE_UNDER  PROPERTY_BIT(EP_WALKABLE_UNDER)
-#define EP_BIT_SP_ELEMENT      PROPERTY_BIT(EP_SP_ELEMENT)
-#define EP_BIT_HAS_CONTENT     PROPERTY_BIT(EP_HAS_CONTENT)
-#define EP_BIT_SOLID_NEW       PROPERTY_BIT(EP_SOLID_NEW)
-
-
-#define EP_BITMASK_DEFAULT     0
-
-/* property macros */
+/* macros for base properties */
 #define IS_AMOEBALIVE(e)       HAS_PROPERTY(e, EP_AMOEBALIVE)
 #define IS_AMOEBOID(e)         HAS_PROPERTY(e, EP_AMOEBOID)
 #define CAN_BE_CRUMBLED(e)     HAS_PROPERTY(e, EP_CAN_BE_CRUMBLED)
 #define IS_PUSHABLE(e)         HAS_PROPERTY(e, EP_PUSHABLE)
 #define ELEM_IS_PLAYER(e)      HAS_PROPERTY(e, EP_PLAYER)
 #define IS_WALKABLE_OVER(e)    HAS_PROPERTY(e, EP_WALKABLE_OVER)
+#define IS_WALKABLE_THROUGH(e) HAS_PROPERTY(e, EP_WALKABLE_THROUGH)
+#define IS_WALKABLE_UNDER(e)   HAS_PROPERTY(e, EP_WALKABLE_UNDER)
+#define IS_PASSABLE_OVER(e)    HAS_PROPERTY(e, EP_PASSABLE_OVER)
+#define IS_PASSABLE_THROUGH(e) HAS_PROPERTY(e, EP_PASSABLE_THROUGH)
+#define IS_PASSABLE_UNDER(e)   HAS_PROPERTY(e, EP_PASSABLE_UNDER)
+
+/* macros for runtime properties */
+#define IS_WALKABLE(e)         HAS_PROPERTY(e, EP_WALKABLE)
+#define IS_PASSABLE(e)         HAS_PROPERTY(e, EP_PASSABLE)
+#define IS_PLAYER_OVER(e)      HAS_PROPERTY(e, EP_PLAYER_OVER)
+#define IS_PLAYER_INSIDE(e)    HAS_PROPERTY(e, EP_PLAYER_INSIDE)
+#define IS_PLAYER_UNDER(e)     HAS_PROPERTY(e, EP_PLAYER_UNDER)
 #define IS_DIGGABLE(e)         HAS_PROPERTY(e, EP_DIGGABLE)
 #define IS_COLLECTIBLE(e)      HAS_PROPERTY(e, EP_COLLECTIBLE)
-#define IS_WALKABLE_THROUGH(e) HAS_PROPERTY(e, EP_WALKABLE_THROUGH)
 #define IS_OVER_PLAYER(e)      HAS_PROPERTY(e, EP_OVER_PLAYER)
 #define IS_ACTIVE_BOMB(e)      HAS_PROPERTY(e, EP_ACTIVE_BOMB)
-
 #define IS_BELT(e)             HAS_PROPERTY(e, EP_BELT)
 #define IS_BELT_ACTIVE(e)      HAS_PROPERTY(e, EP_BELT_ACTIVE)
 #define IS_BELT_SWITCH(e)      HAS_PROPERTY(e, EP_BELT_SWITCH)
-#define IS_WALKABLE_UNDER(e)   HAS_PROPERTY(e, EP_WALKABLE_UNDER)
 #define IS_SP_ELEMENT(e)       HAS_PROPERTY(e, EP_SP_ELEMENT)
 #define HAS_CONTENT(e)         HAS_PROPERTY(e, EP_HAS_CONTENT)
-#define IS_SOLID_NEW(e)                HAS_PROPERTY(e, EP_SOLID_NEW)
 
 #define IS_CUSTOM_ELEMENT(e)   ((e) >= EL_CUSTOM_START &&      \
                                 (e) <= EL_CUSTOM_END)
index 8582ac846da647c0845d04e6fe45ce27cbfdb786..f0a2677636c8a7a18f2b576b1b5ba5da96aa89b8 100644 (file)
@@ -745,16 +745,20 @@ void DrawPlayer(struct PlayerInfo *player)
   }
 
   /* ----------------------------------------------------------------------- */
-  /* draw elements that stay over the player                                 */
+  /* draw elements the player is just walking/passing through/under          */
   /* ----------------------------------------------------------------------- */
 
   /* handle the field the player is leaving ... */
-  if (player_is_moving && IS_OVER_PLAYER(last_element))
+  if (player_is_moving && IS_PLAYER_INSIDE(last_element))
     DrawLevelField(last_jx, last_jy);
+  else if (player_is_moving && IS_PLAYER_UNDER(last_element))
+    DrawLevelFieldThruMask(last_jx, last_jy);
 
   /* ... and the field the player is entering */
-  if (IS_OVER_PLAYER(element))
+  if (IS_PLAYER_INSIDE(element))
     DrawLevelField(jx, jy);
+  else if (IS_PLAYER_UNDER(element))
+    DrawLevelFieldThruMask(jx, jy);
 
   if (setup.direct_draw)
   {