rnd-20020904-1-src
[rocksndiamonds.git] / src / tools.c
index 801eb6b5b7f9c6e432d964407afe5c30b7565ecc..230f529995363fe10f8c762b7d9035b0333f7a0b 100644 (file)
@@ -1,7 +1,7 @@
 /***********************************************************
 * Rocks'n'Diamonds -- McDuffin Strikes Back!               *
 *----------------------------------------------------------*
-* (c) 1995-2001 Artsoft Entertainment                      *
+* (c) 1995-2002 Artsoft Entertainment                      *
 *               Holger Schemel                             *
 *               Detmolder Strasse 189                      *
 *               33604 Bielefeld                            *
@@ -2100,9 +2100,10 @@ unsigned int MoveDoor(unsigned int door_state)
   {
     if (!(door_state & DOOR_NO_DELAY))
     {
+      /* opening door sound has priority over simultaneously closing door */
       if (door_state & (DOOR_OPEN_1 | DOOR_OPEN_2))
        PlaySoundStereo(SND_MENU_DOOR_OPENING, SOUND_MAX_RIGHT);
-      if (door_state & (DOOR_CLOSE_1 | DOOR_CLOSE_2))
+      else if (door_state & (DOOR_CLOSE_1 | DOOR_CLOSE_2))
        PlaySoundStereo(SND_MENU_DOOR_CLOSING, SOUND_MAX_RIGHT);
     }
 
@@ -2432,7 +2433,7 @@ int get_next_element(int element)
   }
 }
 
-int el2gfx(int element)
+int el2gfx_OLD(int element)
 {
   switch(element)
   {
@@ -2713,3 +2714,22 @@ int el2gfx(int element)
     }
   }
 }
+
+int el2gfx(int element)
+{
+  int graphic_OLD = el2gfx_OLD(element);
+  int graphic_NEW = element_info[element].graphic;
+
+  if (element >= MAX_ELEMENTS)
+  {
+    Error(ERR_WARN, "el2gfx: element == %d >= MAX_ELEMENTS", element);
+  }
+
+  if (graphic_NEW != graphic_OLD)
+  {
+    Error(ERR_WARN, "el2gfx: graphic_NEW (%d) != graphic_OLD (%d)",
+         graphic_NEW, graphic_OLD);
+  }
+
+  return graphic_NEW;
+}