Exemplo n.º 1
0
int		load_hole_cube_datas3(t_hole_cube *s,
				 t_bunny_ini *ini,
				 char *scope)
{
  const char	*field;

  if ((field = bunny_ini_get_field(ini, scope, "opacity", 0)) == NULL)
    return (my_puterr("load_datas: missing hole_cube opacity"));
  s->opacity = (double)my_getnbr((char *)field) / 100;
  if ((field = bunny_ini_get_field(ini, scope, "color1", 0)) == NULL)
    return (my_puterr("load_datas: missing hole_cube color1"));
  s->color1.full = my_getcolor((char *)field, "0123456789ABCDEF");
  if ((field = bunny_ini_get_field(ini, scope, "color2", 0)) == NULL)
    return (my_puterr("load_datas: missing hole_cube color2"));
  s->color2.full = my_getcolor((char *)field, "0123456789ABCDEF");
  s->tex_name = NULL;
  s->texture = NULL;
  if (s->tex_type == IMAGE)
    {
      if ((field = bunny_ini_get_field(ini, scope, "texture", 0)) == NULL)
	return (my_puterr("load_datas: missing hole_cube texture"));
      s->tex_name = my_strdup((char *)field);
      if ((s->texture = bunny_load_pixelarray((char *)field)) == NULL)
	return (my_puterr("load_datas: invalid hole_cube texture1"));
    }
  return (0);
}
Exemplo n.º 2
0
int		_my_init_cylinder(t_bunny_ini *ini,
				  t_info *cylinder,
				  char *forme,
				  int nb)
{
  const char	*field[6];
  t_pars	pars;

  pars.i = 0;
  pars.j = 1;
  while (pars.i < nb)
    {
      pars.k = 0;
      while (pars.k < 6)
	{
	  field[pars.k] = bunny_ini_get_field(ini, forme, "cylinder", pars.j);
	  if (field[pars.k] == NULL)
	    return (1);
	  pars.k = pars.k + 1;
	  pars.j = pars.j + 1;
	}
      if (my_copy_field_cylinder(field, cylinder, pars.i))
	return (2);
      pars.i = pars.i + 1;
    }
  if (bunny_ini_get_field(ini, forme, "cylinder", pars.j) != NULL)
    return (3);
  return (0);
}
t_scene			*parsing_ground_grid(t_scene *scene,
					     t_bunny_ini *ini,
					     char *name,
					     t_ptr_list **ptr_list)
{
  char			*str;

  if ((scene->ground = ground_fill(ini, scene, name)) == NULL)
    return (NULL);
  if ((str = (char *)bunny_ini_get_field(ini, name,
					 "scene_ground_sprite_id", 0)) == NULL)
    return (my_puterror_scene("Error: ", name,
			      ":scene_ground_sprite_id field ",
			      1, " not found\n"));
  if ((scene->sol_id = my_getnbr(str)) < 0)
    return (my_puterror_scene("Error ", name, ":scene_ground_sprite_id field ",
			      1, " should not be negative\n"));
  if ((scene->sol_hitbox = create_sol_hitbox(0, ini, ptr_list, name)) == NULL)
    return (NULL);
  if ((str = (char *)bunny_ini_get_field(ini, name,
					 "scene_grid_height", 0)) == NULL)
    return (my_puterror_scene("Error: ", name, ":scene_grid_height field ",
			      1, " not found\n"));
  if ((scene->height = my_getnbr(str)) < 0)
    return (my_puterror_scene("Error ", name, ":scene_grid_height field ",
      			      1, " should not be negative\n"));
  return (scene);
}
Exemplo n.º 4
0
t_decors		*create_decors_node_bis(int id, t_bunny_ini *ini,
						t_ptr_list **ptr_list,
						t_decors *decors)
{
  char			*str;

  if ((str = (char *)bunny_ini_get_field(ini, "decors",
      					 "decors_id", id)) == NULL)
    return (my_puterror_decors("Error: decors:decors_id field ",
      			       id, " not found\n"));
  if ((decors->decors_id = my_getnbr(str)) < 0)
    return (my_puterror_decors("Error: decors:decors_id field ",
      			       id, " should not be negative\n"));
  if ((str = (char *)bunny_ini_get_field(ini, "decors",
      					 "decors_name", id)) == NULL)
    return (my_puterror_decors("Error: decors:decors_name field ",
      			       id, " not found\n"));
  if ((decors->name = my_strdup(str, ptr_list)) == NULL)
    return (my_puterror_decors("Error: decors->name:my_strdup ",
      			       -1, "failed in create_decors_node\n"));
  if ((str = (char *)bunny_ini_get_field(ini, "decors",
      					 "decors_sprite_id", id)) == NULL)
    return (my_puterror_decors("Error: decors:decors_sprite_id field ",
      			       id, " not found\n"));
  if ((decors->sprite_id = my_getnbr(str)) < 0)
    return (my_puterror_decors("Error: decors:decors_sprite_id field ",
      			       id, " should not be negative\n"));
  return (decors);
}
t_scene			*parsing_ground_startpos(t_scene *scene,
						 t_bunny_ini *ini,
						 char *name,
						 t_ptr_list **ptr_list)
{
  char			*str;

  if ((scene->start_pos = xmalloc(sizeof(*scene->start_pos),
				  ptr_list)) == NULL)
    return (my_puterror_scene("Error: ", "scene->start_pos", ":xmalloc ",
			      -1, "failed in parsing_ground_startpos\n"", -1"));
  if ((str = (char *)bunny_ini_get_field(ini, name,
					 "scene_start_pos_x", 0)) == NULL)
    return (my_puterror_scene("Error: ", name, ":scene_start_pos_x field ",
			      1, " not found\n"));
  if (((scene->start_pos->x = my_getnbr(str)) < 0)
      || (scene->start_pos->x > scene->size.x))
    return (my_puterror_scene("Error: ", name, ":scene_start_pos_x ",
			      scene->start_pos->x, " is out of range\n"));
  if ((str = (char *)bunny_ini_get_field(ini, name,
					 "scene_start_pos_y", 0)) == NULL)
    return (my_puterror_scene("Error: ", name, ":scene_start_pos_y field ",
			      1, " not found\n"));
  if (((scene->start_pos->y = my_getnbr(str)) < 0)
      || (scene->start_pos->y > scene->size.y))
    return (my_puterror_scene("Error: ", name, ":scene_start_pos_y ",
			      scene->start_pos->y, " is out of range\n"));
  return (scene);
}
Exemplo n.º 6
0
t_breakable		*create_decors_breakable_one(int id, t_bunny_ini *ini,
						     t_breakable *breakable)
{
  char			*str;

  if ((str = (char *)bunny_ini_get_field(ini, "decors",
					 "decors_is_breakable", id)) == NULL)
    return (my_puterror_breakable("Error: decors:decors_is_breakable field ",
				  id, " not found\n"));
  breakable->is_breakable = my_getnbr(str);
  if ((breakable->is_breakable != 0) && (breakable->is_breakable != 1))
    return (my_puterror_breakable("Error: decors:decors_is_breakable field ",
				  id, " must be 0 or 1\n"));
  if ((str = (char *)bunny_ini_get_field(ini, "decors",
					 "decors_breakable_life",
					 id)) == NULL)
    return (my_puterror_breakable("Error: decors:decors_breakable_life field ",
				  id, " not found\n"));
  if ((breakable->life = my_getnbr(str)) < 0)
    return (my_puterror_breakable("Error: decors:decors_breakable_life field ",
				  id, " should not be negative\n"));
  if ((breakable->is_breakable == 1) && (breakable->life < 0))
    return (my_puterror_breakable("Error: decors:decors_breakable_life field ",
				  id, " must be positive\n"));
  return (breakable);
}
Exemplo n.º 7
0
int     get_map(t_data *data)
{
  int   curs;

  if ((bunny_ini_get_field(data->ini, "level", "width", 0)) == NULL)
    return (-1);
  data->map->height = mygetnbr(bunny_ini_get_field
			      (data->ini, "level", "height", 0));
  data->map->width = mygetnbr
    (bunny_ini_get_field(data->ini, "level", "width", 0));
  if ((data->map->data =
       bunny_malloc(sizeof(int *) * data->map->height)) == NULL)
    return (-1);
  curs = 0;
  while (curs < data->map->height)
    {
      if ((data->map->data[curs] = bunny_malloc
	   (sizeof(int) * data->map->width)) == NULL)
        return (-1);
      curs++;
    }
  fill_the_data(data->ini, data->map->data, data->map->width);
  if ((data->map->spawn = bunny_malloc(sizeof(float) * 3)) == NULL)
    return (-1);
  all_start_here(data->ini, data);
  return (0);
}
Exemplo n.º 8
0
int		add_one_light(t_figure *data,
			      t_bunny_ini *ini,
			      int light,
			      int rounds)
{
  const char	*extract;

  if (((bunny_ini_get_field(ini, "light", "pos", light * 3)) == NULL)
      || ((bunny_ini_get_field(ini, "light", "pos", light * 3 + 1)) == NULL)
      || ((bunny_ini_get_field(ini, "light", "pos", light * 3 + 2)) == NULL)
      || ((bunny_ini_get_field(ini, "light", "color", light)) == NULL))
    return (failed_figure("light"));
  extract = bunny_ini_get_field(ini, "light", "pos", light * 3);
  data->pos.x = my_getnbr(extract);
  extract = bunny_ini_get_field(ini, "light", "pos", light * 3 + 1);
  data->pos.y = my_getnbr(extract);
  extract = bunny_ini_get_field(ini, "light", "pos", light * 3 + 2);
  data->pos.z = my_getnbr(extract);
  extract = bunny_ini_get_field(ini, "light", "color", light);
  data->color.full = (double)my_getunbr(extract);
  data->color.argb[3] = 0xFF;
  data->type = 5;
  if (light == rounds - 1)
    properly_loaded(data, 1);
  else
    properly_loaded(data, 0);
  return (0);
}
Exemplo n.º 9
0
char                    *get_chmp(char *chmp,
                                  t_bunny_ini *file,
				  int i)
{
  int                   size;
  char                  *str;

  size = my_strlen((char *)bunny_ini_get_field(file, NULL, chmp, i));
  if (size == 0)
    return (NULL);
  if ((str = bunny_malloc(sizeof(char *) * size)) == NULL)
    return (NULL);
  my_strcpy(str, (char *)bunny_ini_get_field(file, NULL, chmp, i));
  return (str);
}
Exemplo n.º 10
0
int			read_start(t_bunny_ini *ini, t_ray *st)
{
  const char		*nb;

  if ((nb = bunny_ini_get_field(ini, "Raytracer", "start", 0)) == NULL)
    return (1);
  st->a_x = my_getnbr(nb);
  if ((nb = bunny_ini_get_field(ini, "Raytracer", "start", 1)) == NULL)
    return (1);
  st->a_y = my_getnbr(nb);
  if ((nb = bunny_ini_get_field(ini, "Raytracer", "start", 2)) == NULL)
    return (1);
  st->a_z = my_getnbr(nb);
  return (0);
}
Exemplo n.º 11
0
int		load_data_field(t_all *all, int i, int j, int count)
{
  char		*b;

  get_width_map(all);
  get_height_map(all);
  b = malloc(sizeof(char) * all->width);
  if ((all->map = bunny_malloc(sizeof(int *) * all->height)) == NULL)
    return (-1);
  while (i < all->height)
    {
      if ((all->map[i] = bunny_malloc(sizeof(int) * all->width)) == NULL)
	return (-1);
      while (j < all->width)
	{
	  b[j] = *(char *)bunny_ini_get_field(all->ini, INI_NAME, "data", count);
	  all->map[i][j] = (b[j] == 49) ? 1 : 0;
	  count++;
	  j++;
	}
      b[all->width] = '\0';
      j = 0;
      i++;
    }
  free(b);
  return (0);
}
Exemplo n.º 12
0
void		from_ini_to_cone(t_bunny_ini *ini, t_ray *ray, char *form)
{
  printf("\nForm = %s\n", form);
  ray->obj->cone.pos[0] =
    my_getdouble(bunny_ini_get_field(ini, form, "x", 0));
  printf("Form = %s\n", form);
  ray->obj->cone.pos[1] = 1.0;
  printf("<<<%s>>>   >>>%s<<<<\n",form,  bunny_ini_get_field(ini, form, "y", 0));
  ray->obj->cone.pos[2] =
    my_getdouble(bunny_ini_get_field(ini, form, "z", 0));
  ray->obj->cone.angle =
    my_getdouble(bunny_ini_get_field(ini, form, "angle", 0));
  ray->obj->cone.color =
    get_ini_color((char *)bunny_ini_get_field(ini, form, "color", 0));
  ray->obj->cone.next = &ray->obj->cone;
}
Exemplo n.º 13
0
int		load_hole_cube_datas1(t_hole_cube *s,
				 t_bunny_ini *ini,
				 char *scope)
{
  const	char	*field;

  if ((field = bunny_ini_get_field(ini, scope, "pos", 0)) == NULL)
    return (my_puterr("load_datas: missing hole_cube x_pos"));
  s->pos.x = my_getnbr((char *)field);
  if ((field = bunny_ini_get_field(ini, scope, "pos", 1)) == NULL)
    return (my_puterr("load_datas: missing hole_cube y_pos"));
  s->pos.y = my_getnbr((char *)field);
  if ((field = bunny_ini_get_field(ini, scope, "pos", 2)) == NULL)
    return (my_puterr("load_datas: missing hole_cube z_pos"));
  s->pos.z = my_getnbr((char *)field);
  if ((field = bunny_ini_get_field(ini, scope, "rot", 0)) == NULL)
    return (my_puterr("load_datas: missing hole_cube x_rot"));
  s->rot.x = my_getnbr((char *)field);
  if ((field = bunny_ini_get_field(ini, scope, "rot", 1)) == NULL)
    return (my_puterr("load_datas: missing hole_cube y_rot"));
  s->rot.y = my_getnbr((char *)field);
  if ((field = bunny_ini_get_field(ini, scope, "rot", 2)) == NULL)
    return (my_puterr("load_datas: missing hole_cube z_rot"));
  s->rot.z = my_getnbr((char *)field);
  if ((field = bunny_ini_get_field(ini, scope, "rad", 0)) == NULL)
    return (my_puterr("load_datas: missing hole_cube rad"));
  s->rad = (double)my_getnbr((char *)field);
  return (load_hole_cube_datas2(s, ini, scope));
}
Exemplo n.º 14
0
int		get_height_map(t_all *all)
{
  char		*b;

  b = (char*)bunny_ini_get_field(all->ini, INI_NAME, "height", 0);
  all->height = my_getnbr(b);
  if (all->whoami == 2)
    msend(all->sock, b);
  return (0);
}
Exemplo n.º 15
0
int		get_width_map(t_all *all)
{
  char		*b;

  b = (char*)bunny_ini_get_field(all->ini, INI_NAME, "width", 0);
  all->width = my_getnbr(b);
  if (all->whoami == 2)
    msend(all->sock, b);
  return (0);
}
Exemplo n.º 16
0
void    fill_the_data(t_bunny_ini *ini, int **data, int x)
{
  int	curs;
  int	curs_2;

  curs = 0;
  curs_2 = 0;
  while (bunny_ini_get_field(ini, "level", "data", curs_2 + x * curs))
    {
      data[curs][curs_2] =
        mygetnbr(bunny_ini_get_field(ini, "level", "data", curs_2 + x * curs));
      if (curs_2 < x - 1)
        curs_2++;
      else
        {
          curs++;
          curs_2 = 0;
        }
    }
}
Exemplo n.º 17
0
int		take_nb_arg_from_ini(t_bunny_ini *ini,
				     char *name,
				     char *type)
{
  int		i;
  const char	*str;

  i = 0;
  while ((str = bunny_ini_get_field(ini, name, type, i)) != NULL)
    i++;
  return (i);
}
Exemplo n.º 18
0
t_breakable		*create_decors_breakable_two(int id, t_bunny_ini *ini,
						     t_breakable *breakable)
{
  char			*str;

  if ((str = (char *)bunny_ini_get_field(ini, "decors",
					 "decors_breakable_breaker",
					 id)) == NULL)
    return (my_puterror_breakable("Error: decors:decors_breakable_breaker \
				field ", id, " not found\n"));
  breakable->breakable_by = my_getnbr(str);
  if ((str = (char *)bunny_ini_get_field(ini, "decors", "decors_is_lootable",
					 id)) == NULL)
    return (my_puterror_breakable("Error: decors:decors_is_lootable ", -1,
				  "field not found\n"));
  breakable->lootable = my_getnbr(str);
  if ((breakable->lootable != 0) && (breakable->lootable != 1))
    return (my_puterror_breakable("Error: decors:decors_is_lootable field ",
				  id, " format 0 or 1\n"));
  return (breakable);
}
Exemplo n.º 19
0
t_breakable		*fill_loot_table(t_breakable *breakable, int id,
					 t_bunny_ini *ini)
{
  char			*str;

  if ((str = (char *)bunny_ini_get_field(ini, "decors",
					 "decors_loot_id", id)) == NULL)
    return (my_puterror_breakable("Error: decors:decors_loot_id field ",
				  id, " not found\n"));
  if ((breakable->loot[0] = my_getnbr(str)) < 0)
    return (my_puterror_breakable("Error: decors:decors_loot_id field ",
				  id, " should not be negative\n"));
  if ((str = (char *)bunny_ini_get_field(ini, "decors",
					 "decors_loot_amount", id)) == NULL)
    return (my_puterror_breakable("Error: decors:decors_loot_amount field ",
				  id, " not found\n"));
  if ((breakable->loot[1] = my_getnbr(str)) < 0)
    return (my_puterror_breakable("Error: decors:decors_loot_id field ",
				  id, " should not be negative\n"));
  return (breakable);
}
Exemplo n.º 20
0
int		load_hole_cube_datas2(t_hole_cube *s,
				 t_bunny_ini *ini,
				 char *scope)
{
  const	char	*field;

  if ((field = bunny_ini_get_field(ini, scope, "tex_type", 0)) == NULL)
    return (my_puterr("load_datas: missing hole_cube type"));
  s->tex_type = my_getnbr((char *)field);
  if ((field = bunny_ini_get_field(ini, scope, "ka", 0)) == NULL)
    return (my_puterr("load_datas: missing hole_cube ambient coef"));
  s->ka = (double)my_getnbr((char *)field) / 100;
  if ((field = bunny_ini_get_field(ini, scope, "kd", 0)) == NULL)
    return (my_puterr("load_datas: missing diffuse coef"));
  s->kd = (double)my_getnbr((char *)field) / 100;
  if ((field = bunny_ini_get_field(ini, scope, "ks", 0)) == NULL)
    return (my_puterr("load_datas: missing hole_cube specular coef"));
  s->ks = (double)my_getnbr((char *)field) / 100;
  if ((field = bunny_ini_get_field(ini, scope, "brightness", 0)) == NULL)
    return (my_puterr("load_datas: missing hole_cube brightness"));
  s->brightness = (double)my_getnbr((char *)field) / 100;
  if ((field = bunny_ini_get_field(ini, scope, "reflection", 0)) == NULL)
    return (my_puterr("load_datas: missing hole_cube reflection"));
  s->reflection = (double)my_getnbr((char *)field) / 100;
  return (load_hole_cube_datas3(s, ini, scope));
}
Exemplo n.º 21
0
t_objs		*get_plan(t_bunny_ini *ini, t_objs *list)
{
  const char	*str;
  int		i;

  i = 0;
  while ((str = bunny_ini_get_field(ini, "list", "plan", i)) != NULL)
    {
      list = get_obj_ini(ini, list, (char *)str, PLAN_VAL);
      i++;
    }
  return (list);
}
Exemplo n.º 22
0
int		my_init_cylinder(t_bunny_ini *ini,
				 t_geom *geom,
				 char *forme)
{
  const char	*field;

  if ((field = bunny_ini_get_field(ini, forme, "cylinder", 0)) == NULL)
    return (1);
  if (my_getnbr_i(field, &geom->nb_cylinder))
    return (2);
  if (geom->nb_cylinder < 0)
    return (3);
  if (geom->nb_cylinder == 0
      && bunny_ini_get_field(ini, forme, "cylinder", 1) != NULL)
    return (4);
  if (geom->nb_cylinder == 0)
    return (0);
  if ((geom->cylinder = bunny_malloc(sizeof(t_info) * geom->nb_cylinder)) == NULL)
    return (5);
  if (_my_init_cylinder(ini, geom->cylinder, forme, geom->nb_cylinder))
    return (6);
  return (0);
}
t_scene			*parsing_ground_setting(t_scene *scene,
						t_bunny_ini *ini,
						char *name)
{
  char			*str;

  if ((str = (char *)bunny_ini_get_field(ini, name,
					 "scene_nb_x_case", 0)) == NULL)
    return (my_puterror_scene("Error: ", name,
			      ":scene_nb_x_case field ", 1, " not found\n"));
  if ((scene->size.x = my_getnbr(str)) < 0)
    return (my_puterror_scene("Error ", name,
			      ":scene_nb_x_case field ", 1,
			      " should not be negative\n"));
  if ((str = (char *)bunny_ini_get_field(ini, name,
					 "scene_nb_y_case", 0)) == NULL)
    return (my_puterror_scene("Error: ", name,
			      ":scene_nb_y_case field ", 1, " not found\n"));
  if ((scene->size.y = my_getnbr(str)) < 0)
    return (my_puterror_scene("Error ", name,
			      ":scene_nb_y_case field ", 1,
			      " should not be negative\n"));
  return (scene);
}
Exemplo n.º 24
0
void    ambient(t_data *data)
{
  if (data->music_play == 1)
    {
      bunny_sound_stop(&data->music->sound);
      bunny_delete_sound(&data->music->sound);
    }
  data->music_play = 1;
  data->music =
    bunny_load_music(bunny_ini_get_field(data->ini, "level", "music", 0));
  bunny_sound_volume(&data->music->sound, 50.0);
  bunny_sound_play(&data->music->sound);
  if (data->map->level != 5)
    bunny_sound_loop(&data->music->sound, 1);
  else
    bunny_sound_loop(&data->music->sound, 0);
}
Exemplo n.º 25
0
int		load_plans(t_bunny_ini *ini, t_rtracer *data)
{
  const char	*extract;
  int		rounds;
  int		i;

  if ((extract = bunny_ini_get_field(ini, "plan", "nb", 0)) == NULL)
    return (0);
  i = 0;
  rounds = my_getnbr(extract);
  while (i < rounds)
    {
      if (add_one_plan(data, ini, i) == -1)
	return (-1);
      i++;
    }
  return (0);
}
Exemplo n.º 26
0
void		from_ini_to_plane(t_bunny_ini *ini, t_ray *ray, char *form)
{
  ray->obj->plane.a[0] =
    my_getdouble(bunny_ini_get_field(ini, form, "a", 0));
  ray->obj->plane.a[1] =
    my_getdouble(bunny_ini_get_field(ini, form, "b", 0));
  ray->obj->plane.a[2] =
    my_getdouble(bunny_ini_get_field(ini, form, "c", 0));
  ray->obj->plane.x[0] =
    my_getdouble(bunny_ini_get_field(ini, form, "x", 0));
  ray->obj->plane.x[1] =
    my_getdouble(bunny_ini_get_field(ini, form, "y", 0));
  ray->obj->plane.x[2] =
    my_getdouble(bunny_ini_get_field(ini, form, "z", 0));
  ray->obj->plane.color =
    get_ini_color((char *)bunny_ini_get_field(ini, form, "color", 0));
  ray->obj->plane.next = &ray->obj->plane;
}
Exemplo n.º 27
0
int		extract_planter(t_bunny_ini	*file,
				t_data		*data,
				int		idx,
				const char	*scope)
{
  const char	*str;

  if ((str = bunny_ini_get_field(file, scope, "texture", 0)) == NULL)
    {
      P_PATH = NULL;
      P_TEXTURE = NULL;
    }
  else
    {
      P_PATH = bunny_strdup(str);
      if ((P_TEXTURE = bunny_load_pixelarray(P_PATH)) == NULL)
	return (print_error("The texture was not found!\n"));
    }
  return (0);
}
Exemplo n.º 28
0
int			read_light(t_bunny_ini *ini, t_ray *st)
{
  const char		*nb[3];
  int			i;
  int			k;
  int			l;

  k = -1;
  i = 0;
  while (++k < st->info.nb_light)
    {
      l = -1;
      while (++l < 3)
	if ((nb[l] = bunny_ini_get_field(ini, "Raytracer", "light", ++i)) == NULL)
	  return (1);
      st->info.light[k].x = my_getnbr(nb[0]);
      st->info.light[k].y = my_getnbr(nb[1]);
      st->info.light[k].z = my_getnbr(nb[2]);
    }
  return (0);
}
Exemplo n.º 29
0
t_hitbox		*decors_hitbox_width(int id, t_bunny_ini *ini,
					     char *name, t_hitbox *hitbox)
{
  char			*str;

  if ((str = (char *)bunny_ini_get_field(ini, name,
					 "decors_sprite_hitbox_width", id))
      == NULL)
    {
      my_puterror_hitbox("Error: ", -1, name);
      return (my_puterror_hitbox(":decors_sprite_hitbox_width field ",
				 id, " not found\n"));
    }
  if ((hitbox->width = my_getnbr(str)) < 0)
    {
      my_puterror_hitbox("Error: ", -1, name);
      return (my_puterror_hitbox(":decors_sprite_hitbox_width field ", id,
				 " should not be negative and only number\n"));
    }
  return (hitbox);
}
Exemplo n.º 30
0
void	all_start_here(t_bunny_ini *ini, t_data *data)
{
  data->map->spawn[0] =  mygetnbr(bunny_ini_get_field
				(ini, "level", "start_position", 0)) + 0.5;
  data->map->spawn[1] =  mygetnbr(bunny_ini_get_field
				(ini, "level", "start_position", 1)) + 0.5;
  data->map->spawn[2] =  mygetnbr(bunny_ini_get_field
				 (ini, "level", "start_position", 2));
  data->pl->pp_y =
    mygetnbr(bunny_ini_get_field(ini, "level", "start_position", 0)) + 0.5;
  data->pl->pp_x =
    mygetnbr(bunny_ini_get_field(ini, "level", "start_position", 1)) + 0.5;
  data->pl->angle =
    mygetnbr(bunny_ini_get_field(ini, "level", "start_position", 2));
  ambient(data);
}