rnd-20030509-1-src
[rocksndiamonds.git] / src / tools.c
index 89de2f61e3647b96decb48cfcbd8ee8de248de71..4fe2668937485e97ab2235f780cd78a38a3947c3 100644 (file)
@@ -1199,7 +1199,8 @@ static void DrawLevelFieldCrumbledSandExt(int x, int y, int graphic, int frame)
 
       element = (IN_LEV_FIELD(xx, yy) ? Feld[xx][yy] : EL_STEELWALL);
 
-      if (CAN_BE_CRUMBLED(element))    /* neighbour is of same type */
+      /* check if neighbour field is of same type */
+      if (CAN_BE_CRUMBLED(element))
        continue;
 
       if (i == 1 || i == 2)
@@ -2010,8 +2011,8 @@ unsigned int MoveDoor(unsigned int door_state)
   static int door1 = DOOR_OPEN_1;
   static int door2 = DOOR_CLOSE_2;
   static unsigned long door_delay = 0;
-  int x, start, stepsize = global.door_step_offset;
-  unsigned long door_delay_value = global.door_step_delay;
+  int x, start, stepsize = door.step_offset;
+  unsigned long door_delay_value = door.step_delay;
 
   if (door_state == DOOR_GET_STATE)
     return(door1 | door2);
@@ -2390,6 +2391,7 @@ int get_next_element(int element)
 
 int el_act_dir2img(int element, int action, int direction)
 {
+  element = GFX_ELEMENT(element);
   direction = MV_DIR_BIT(direction);
 
   return element_info[element].direction_graphic[action][direction];
@@ -2397,25 +2399,35 @@ int el_act_dir2img(int element, int action, int direction)
 
 int el_act2img(int element, int action)
 {
+  element = GFX_ELEMENT(element);
+
   return element_info[element].graphic[action];
 }
 
 int el_dir2img(int element, int direction)
 {
+  element = GFX_ELEMENT(element);
+
   return el_act_dir2img(element, ACTION_DEFAULT, direction);
 }
 
 int el2img(int element)
 {
+  element = GFX_ELEMENT(element);
+
   return element_info[element].graphic[ACTION_DEFAULT];
 }
 
 int el2edimg(int element)
 {
+  element = GFX_ELEMENT(element);
+
   return element_info[element].special_graphic[GFX_SPECIAL_ARG_EDITOR];
 }
 
 int el2preimg(int element)
 {
+  element = GFX_ELEMENT(element);
+
   return element_info[element].special_graphic[GFX_SPECIAL_ARG_PREVIEW];
 }