rnd-20050129-1-src
[rocksndiamonds.git] / src / init.c
index f2f628b0363dcd0c370f3f31c6476cac114d0d8f..8e8694ef73aef7e03a35b92ed4c16024b9359632 100644 (file)
@@ -270,7 +270,7 @@ void InitElementSmallImages()
       InitElementSmallImagesScaledUp(property_mapping[i].artwork_index);
 #endif
 
-#if 1
+#if 0
   /* !!! FIX THIS (CHANGE TO USING NORMAL ELEMENT GRAPHIC DEFINITIONS) !!! */
   for (i = IMG_EMC_OBJECT; i <= IMG_EMC_SPRITE; i++)
     InitElementSmallImagesScaledUp(i);
@@ -722,8 +722,14 @@ void InitElementGraphicInfo()
 
     if (default_graphic == -1)
       default_graphic = IMG_UNKNOWN;
+#if 1
+    if (default_crumbled == -1)
+      default_crumbled = default_graphic;
+#else
+    /* !!! THIS LOOKS CRAPPY FOR SAND ETC. WITHOUT CRUMBLED GRAPHICS !!! */
     if (default_crumbled == -1)
       default_crumbled = IMG_EMPTY;
+#endif
 
     for (dir = 0; dir < NUM_DIRECTIONS; dir++)
     {
@@ -734,8 +740,14 @@ void InitElementGraphicInfo()
 
       if (default_direction_graphic[dir] == -1)
        default_direction_graphic[dir] = default_graphic;
+#if 1
+      if (default_direction_crumbled[dir] == -1)
+       default_direction_crumbled[dir] = default_direction_graphic[dir];
+#else
+      /* !!! THIS LOOKS CRAPPY FOR SAND ETC. WITHOUT CRUMBLED GRAPHICS !!! */
       if (default_direction_crumbled[dir] == -1)
        default_direction_crumbled[dir] = default_crumbled;
+#endif
     }
 
     for (act = 0; act < NUM_ACTIONS; act++)
@@ -783,35 +795,63 @@ void InitElementGraphicInfo()
 
       if (default_action_graphic == -1)
        default_action_graphic = default_graphic;
+#if 1
+      if (default_action_crumbled == -1)
+       default_action_crumbled = default_action_graphic;
+#else
+      /* !!! THIS LOOKS CRAPPY FOR SAND ETC. WITHOUT CRUMBLED GRAPHICS !!! */
       if (default_action_crumbled == -1)
        default_action_crumbled = default_crumbled;
+#endif
 
       for (dir = 0; dir < NUM_DIRECTIONS; dir++)
       {
+       /* use action graphic as the default direction graphic, if undefined */
        int default_action_direction_graphic = element_info[i].graphic[act];
        int default_action_direction_crumbled = element_info[i].crumbled[act];
 
        /* no graphic for current action -- use default direction graphic */
-       /* !!! maybe it's better to use default _action_ graphic here !!! */
        if (default_action_direction_graphic == -1)
          default_action_direction_graphic =
            (act_remove ? default_remove_graphic :
             act_turning ?
             element_info[i].direction_graphic[ACTION_TURNING][dir] :
+            default_action_graphic != default_graphic ?
+            default_action_graphic :
             default_direction_graphic[dir]);
+
+       if (element_info[i].direction_graphic[act][dir] == -1)
+         element_info[i].direction_graphic[act][dir] =
+           default_action_direction_graphic;
+
+#if 1
+       if (default_action_direction_crumbled == -1)
+         default_action_direction_crumbled =
+           element_info[i].direction_graphic[act][dir];
+#else
        if (default_action_direction_crumbled == -1)
          default_action_direction_crumbled =
            (act_remove ? default_remove_graphic :
             act_turning ?
             element_info[i].direction_crumbled[ACTION_TURNING][dir] :
+            default_action_crumbled != default_crumbled ?
+            default_action_crumbled :
             default_direction_crumbled[dir]);
+#endif
 
-       if (element_info[i].direction_graphic[act][dir] == -1)
-         element_info[i].direction_graphic[act][dir] =
-           default_action_direction_graphic;
        if (element_info[i].direction_crumbled[act][dir] == -1)
          element_info[i].direction_crumbled[act][dir] =
            default_action_direction_crumbled;
+
+#if 0
+       if (i == EL_EMC_GRASS &&
+           act == ACTION_DIGGING &&
+           dir == MV_BIT_DOWN)
+         printf("::: direction_crumbled == %d, %d, %d\n",
+                element_info[i].direction_crumbled[act][dir],
+                default_action_direction_crumbled,
+                element_info[i].crumbled[act]);
+#endif
       }
 
       /* no graphic for this specific action -- use default action graphic */
@@ -820,11 +860,16 @@ void InitElementGraphicInfo()
          (act_remove ? default_remove_graphic :
           act_turning ? element_info[i].graphic[ACTION_TURNING] :
           default_action_graphic);
+#if 1
+      if (element_info[i].crumbled[act] == -1)
+       element_info[i].crumbled[act] = element_info[i].graphic[act];
+#else
       if (element_info[i].crumbled[act] == -1)
        element_info[i].crumbled[act] =
          (act_remove ? default_remove_graphic :
           act_turning ? element_info[i].crumbled[ACTION_TURNING] :
           default_action_crumbled);
+#endif
     }
   }
 
@@ -1970,10 +2015,10 @@ void InitElementPropertiesStatic()
     EL_EM_KEY_2,
     EL_EM_KEY_3,
     EL_EM_KEY_4,
-    EL_EM_KEY_5,
-    EL_EM_KEY_6,
-    EL_EM_KEY_7,
-    EL_EM_KEY_8,
+    EL_EMC_KEY_5,
+    EL_EMC_KEY_6,
+    EL_EMC_KEY_7,
+    EL_EMC_KEY_8,
     EL_DYNAMITE,
     EL_DYNABOMB_INCREASE_NUMBER,
     EL_DYNABOMB_INCREASE_SIZE,
@@ -2123,6 +2168,14 @@ void InitElementPropertiesStatic()
     EL_EM_GATE_2_GRAY,
     EL_EM_GATE_3_GRAY,
     EL_EM_GATE_4_GRAY,
+    EL_EMC_GATE_5,
+    EL_EMC_GATE_6,
+    EL_EMC_GATE_7,
+    EL_EMC_GATE_8,
+    EL_EMC_GATE_5_GRAY,
+    EL_EMC_GATE_6_GRAY,
+    EL_EMC_GATE_7_GRAY,
+    EL_EMC_GATE_8_GRAY,
     EL_SWITCHGATE_OPEN,
     EL_SWITCHGATE_OPENING,
     EL_SWITCHGATE_CLOSED,
@@ -2400,18 +2453,18 @@ void InitElementPropertiesStatic()
     EL_EM_GATE_2,
     EL_EM_GATE_3,
     EL_EM_GATE_4,
-    EL_EM_GATE_5,
-    EL_EM_GATE_6,
-    EL_EM_GATE_7,
-    EL_EM_GATE_8,
     EL_EM_GATE_1_GRAY,
     EL_EM_GATE_2_GRAY,
     EL_EM_GATE_3_GRAY,
     EL_EM_GATE_4_GRAY,
-    EL_EM_GATE_5_GRAY,
-    EL_EM_GATE_6_GRAY,
-    EL_EM_GATE_7_GRAY,
-    EL_EM_GATE_8_GRAY,
+    EL_EMC_GATE_5,
+    EL_EMC_GATE_6,
+    EL_EMC_GATE_7,
+    EL_EMC_GATE_8,
+    EL_EMC_GATE_5_GRAY,
+    EL_EMC_GATE_6_GRAY,
+    EL_EMC_GATE_7_GRAY,
+    EL_EMC_GATE_8_GRAY,
     EL_SWITCHGATE_OPEN,
     EL_TIMEGATE_OPEN,
     -1
@@ -2501,18 +2554,18 @@ void InitElementPropertiesStatic()
     EL_EM_GATE_2,
     EL_EM_GATE_3,
     EL_EM_GATE_4,
-    EL_EM_GATE_5,
-    EL_EM_GATE_6,
-    EL_EM_GATE_7,
-    EL_EM_GATE_8,
     EL_EM_GATE_1_GRAY,
     EL_EM_GATE_2_GRAY,
     EL_EM_GATE_3_GRAY,
     EL_EM_GATE_4_GRAY,
-    EL_EM_GATE_5_GRAY,
-    EL_EM_GATE_6_GRAY,
-    EL_EM_GATE_7_GRAY,
-    EL_EM_GATE_8_GRAY,
+    EL_EMC_GATE_5,
+    EL_EMC_GATE_6,
+    EL_EMC_GATE_7,
+    EL_EMC_GATE_8,
+    EL_EMC_GATE_5_GRAY,
+    EL_EMC_GATE_6_GRAY,
+    EL_EMC_GATE_7_GRAY,
+    EL_EMC_GATE_8_GRAY,
     EL_SWITCHGATE_OPEN,
     EL_TIMEGATE_OPEN,
 
@@ -3174,18 +3227,18 @@ void InitElementPropertiesStatic()
     EL_EM_GATE_2,
     EL_EM_GATE_3,
     EL_EM_GATE_4,
-    EL_EM_GATE_5,
-    EL_EM_GATE_6,
-    EL_EM_GATE_7,
-    EL_EM_GATE_8,
     EL_EM_GATE_1_GRAY,
     EL_EM_GATE_2_GRAY,
     EL_EM_GATE_3_GRAY,
     EL_EM_GATE_4_GRAY,
-    EL_EM_GATE_5_GRAY,
-    EL_EM_GATE_6_GRAY,
-    EL_EM_GATE_7_GRAY,
-    EL_EM_GATE_8_GRAY,
+    EL_EMC_GATE_5,
+    EL_EMC_GATE_6,
+    EL_EMC_GATE_7,
+    EL_EMC_GATE_8,
+    EL_EMC_GATE_5_GRAY,
+    EL_EMC_GATE_6_GRAY,
+    EL_EMC_GATE_7_GRAY,
+    EL_EMC_GATE_8_GRAY,
     -1
   };
 
@@ -3267,10 +3320,10 @@ void InitElementPropertiesStatic()
     EL_EM_KEY_2,
     EL_EM_KEY_3,
     EL_EM_KEY_4,
-    EL_EM_KEY_5,
-    EL_EM_KEY_6,
-    EL_EM_KEY_7,
-    EL_EM_KEY_8,
+    EL_EMC_KEY_5,
+    EL_EMC_KEY_6,
+    EL_EMC_KEY_7,
+    EL_EMC_KEY_8,
     EL_GATE_1,
     EL_GATE_2,
     EL_GATE_3,
@@ -3283,18 +3336,18 @@ void InitElementPropertiesStatic()
     EL_EM_GATE_2,
     EL_EM_GATE_3,
     EL_EM_GATE_4,
-    EL_EM_GATE_5,
-    EL_EM_GATE_6,
-    EL_EM_GATE_7,
-    EL_EM_GATE_8,
     EL_EM_GATE_1_GRAY,
     EL_EM_GATE_2_GRAY,
     EL_EM_GATE_3_GRAY,
     EL_EM_GATE_4_GRAY,
-    EL_EM_GATE_5_GRAY,
-    EL_EM_GATE_6_GRAY,
-    EL_EM_GATE_7_GRAY,
-    EL_EM_GATE_8_GRAY,
+    EL_EMC_GATE_5,
+    EL_EMC_GATE_6,
+    EL_EMC_GATE_7,
+    EL_EMC_GATE_8,
+    EL_EMC_GATE_5_GRAY,
+    EL_EMC_GATE_6_GRAY,
+    EL_EMC_GATE_7_GRAY,
+    EL_EMC_GATE_8_GRAY,
     EL_DYNAMITE,
     EL_INVISIBLE_STEELWALL,
     EL_INVISIBLE_WALL,
@@ -3824,8 +3877,15 @@ void InitElementPropertiesEngine(int engine_version)
        SET_PROPERTY(i, EP_CAN_CHANGE, TRUE);
 
     /* ---------- GFX_CRUMBLED --------------------------------------------- */
+#if 1
+    SET_PROPERTY(i, EP_GFX_CRUMBLED,
+                element_info[i].crumbled[ACTION_DEFAULT] !=
+                element_info[i].graphic[ACTION_DEFAULT]);
+#else
+    /* !!! THIS LOOKS CRAPPY FOR SAND ETC. WITHOUT CRUMBLED GRAPHICS !!! */
     SET_PROPERTY(i, EP_GFX_CRUMBLED,
                 element_info[i].crumbled[ACTION_DEFAULT] != IMG_EMPTY);
+#endif
   }
 
 #if 0
@@ -4642,7 +4702,7 @@ void KeyboardAutoRepeatOffUnlessAutoplay()
 
 void OpenAll()
 {
-  InitGlobal();                /* initialize some global variables */
+  InitGlobal();                        /* initialize some global variables */
 
   if (options.execute_command)
     Execute_Command(options.execute_command);
@@ -4654,7 +4714,8 @@ void OpenAll()
 #else
     Error(ERR_WARN, "networking only supported in Unix version");
 #endif
-    exit(0);   /* never reached */
+
+    exit(0);                   /* never reached, server loops forever */
   }
 
   InitSetup();