Beispiel #1
0
bool
bonus_extract (void)
{
  Uint32 type, frame;
  const char *model = EXPORT_DIR "/bonus-gems/bonus-gem-x/bonus-gem-xx.png";
  char *filename = memory_allocation (strlen (model) + 1);
  if (filename == NULL)
    {
      LOG_ERR ("not enough memory to allocate %i bytes\n",
               (Uint32) (strlen (model) + 1));
      return FALSE;
    }
  if (!create_dir (EXPORT_DIR "/bonus-gems"))
    {
      free_memory (filename);
      return FALSE;
    }
  for (type = 0; type < GEM_NUMOF_TYPES; type++)
    {
      sprintf (filename, EXPORT_DIR "/bonus-gems/bonus-gem-%01d", type + 1);
      if (!create_dir (filename))
        {
          free_memory (filename);
          return FALSE;
        }
      for (frame = 0; frame < GEM_NUMOF_IMAGES; frame++)
        {
          sprintf (filename,
                   EXPORT_DIR "/bonus-gems/bonus-gem-%01d/bonus-gem-%02d.png",
                   type + 1, frame);
          if (!image_to_png (&bonus[type][frame], filename))
            {
              free_memory (filename);
              return FALSE;
            }
        }
    }
  free_memory (filename);
  return TRUE;
}
bool
satellite_extract (void)
{
  Uint32 type, frame;
  const char *model =
    EXPORT_DIR "/satellites/satellite-%01d/satellite-%01d.png";
  char *filename = memory_allocation (strlen (model) + 1);
  if (filename == NULL)
    {
      LOG_ERR ("not enough memory to allocate %i bytes\n",
               (Uint32) (strlen (model) + 1));
      return FALSE;
    }
  if (!create_dir (EXPORT_DIR "/satellites"))
    {
      free_memory (filename);
      return FALSE;
    }
  for (type = 0; type < SATELLITES_NUMOF_TYPES; type++)
    {
      sprintf (filename, EXPORT_DIR "/satellites/satellite-%01d", type + 1);
      if (!create_dir (filename))
        {
          free_memory (filename);
          return FALSE;
        }
      for (frame = 0; frame < SATELLITES_NUMOF_IMAGES; frame++)
        {
          sprintf (filename,
                   EXPORT_DIR "/satellites/satellite-%01d/satellite-%01d.png",
                   type + 1, frame);
          if (!image_to_png (&satellites_images[type][frame], filename))
            {
              free_memory (filename);
              return FALSE;
            }
        }
    }
  return TRUE;
}
Beispiel #3
0
bool
starfield_extract (void)
{
  Uint32 type, frame;
  const char *model = EXPORT_DIR "/stars/stars-%01d/star-%01d.png";
  char *filename = memory_allocation (strlen (model) + 1);
  if (filename == NULL)
    {
      LOG_ERR ("not enough memory to allocate %i bytes\n",
               (Uint32) (strlen (model) + 1));
      return FALSE;
    }
  if (!create_dir (EXPORT_DIR "/stars"))
    {
      return FALSE;
    }
  for (type = 0; type < TYPE_OF_STARS; type++)
    {
      sprintf (filename, EXPORT_DIR "/stars/stars-%01d", type + 1);
      if (!create_dir (filename))
        {
          return FALSE;
        }
      for (frame = 0; frame < STAR_NUMOF_IMAGES; frame++)
        {
          sprintf (filename, EXPORT_DIR "/stars/stars-%01d/star-%01d.png",
                   type + 1, frame);
          if (!image_to_png (&star_field[type][frame], filename))
            {
              free_memory (filename);
              return FALSE;
            }
        }
    }
  free_memory (filename);
  return TRUE;
}