rnd-20080615-1-src
[rocksndiamonds.git] / src / init.c
index 6ef48aee97da2ced884db8f8a24a540967fe1740..6b7cc72e6d8fbe8529e758d281f82d843cfa551b 100644 (file)
@@ -344,6 +344,15 @@ static int getFontBitmapID(int font_nr)
     special = GFX_SPECIAL_ARG_DOOR;
 #endif
 
+#if 0
+  if (special != -1)
+  {
+    printf("%s%s\n",
+          font_info[font_nr].token_name,
+          special_suffix_info[special].suffix);
+  }
+#endif
+
   if (special != -1)
     return font_info[font_nr].special_bitmap_id[special];
   else
@@ -4849,6 +4858,14 @@ void InitElementPropertiesEngine(int engine_version)
       -1
     };
 
+    static int ep_em_explodes_by_fire[] =
+    {
+      EL_EM_DYNAMITE,
+      EL_EM_DYNAMITE_ACTIVE,
+      EL_MOLE,
+      -1
+    };
+
     /* special EM style gems behaviour */
     for (i = 0; ep_em_slippery_wall[i] != -1; i++)
       SET_PROPERTY(ep_em_slippery_wall[i], EP_EM_SLIPPERY_WALL,
@@ -4858,6 +4875,11 @@ void InitElementPropertiesEngine(int engine_version)
     SET_PROPERTY(EL_EXPANDABLE_WALL_GROWING, EP_EM_SLIPPERY_WALL,
                 (level.em_slippery_gems &&
                  engine_version > VERSION_IDENT(2,0,1,0)));
+
+    /* special EM style explosion behaviour regarding chain reactions */
+    for (i = 0; ep_em_explodes_by_fire[i] != -1; i++)
+      SET_PROPERTY(ep_em_explodes_by_fire[i], EP_EXPLODES_BY_FIRE,
+                  level.em_explodes_by_fire);
   }
 
   /* this is needed because some graphics depend on element properties */
@@ -4884,6 +4906,18 @@ void InitElementPropertiesAfterLoading(int engine_version)
   }
 }
 
+void InitElementPropertiesGfxElement()
+{
+  int i;
+
+  for (i = 0; i < MAX_NUM_ELEMENTS; i++)
+  {
+    struct ElementInfo *ei = &element_info[i];
+
+    ei->gfx_element = (ei->use_gfx_element ? ei->gfx_element_initial : i);
+  }
+}
+
 static void InitGlobal()
 {
   int graphic;
@@ -4976,6 +5010,7 @@ static void InitGlobal()
 
   global.autoplay_leveldir = NULL;
   global.convert_leveldir = NULL;
+  global.create_images_dir = NULL;
 
   global.frames_per_second = 0;
   global.fps_slowdown = FALSE;
@@ -5157,6 +5192,18 @@ void Execute_Command(char *command)
       global.convert_level_nr = atoi(str_ptr); /* get level_nr value */
     }
   }
+  else if (strncmp(command, "create images ", 14) == 0)
+  {
+#if defined(TARGET_SDL)
+    global.create_images_dir = getStringCopy(&command[14]);
+
+    if (access(global.create_images_dir, W_OK) != 0)
+      Error(ERR_EXIT, "image target directory '%s' not found or not writable",
+           global.create_images_dir);
+#else
+    Error(ERR_EXIT, "command only available for SDL target");
+#endif
+  }
 
 #if DEBUG
 #if defined(TARGET_SDL)
@@ -6178,6 +6225,11 @@ void OpenAll()
     ConvertLevels();
     return;
   }
+  else if (global.create_images_dir)
+  {
+    CreateLevelSketchImages();
+    return;
+  }
 
   game_status = GAME_MODE_MAIN;