t_wolf *init_map(char *av) { t_wolf *wolf; t_bunny_ini_scope *scope; t_bunny_ini *ini; if ((wolf = bunny_malloc(sizeof(t_wolf))) == NULL) return ((t_wolf *)-1); if ((ini = bunny_load_ini(av)) == NULL) return ((t_wolf *)-1); scope = bunny_ini_first(ini); scope = bunny_ini_next(ini, scope); wolf->s_name = bunny_ini_scope_name(ini, scope); wolf->width = 0; wolf->height = 0; wolf = get_dim(wolf, ini); if (check_air(wolf, ini) == -1) return ((t_wolf *)-1); wolf = get_map(wolf, ini); wolf = get_player(wolf, ini); if (init_error(wolf) == -1) return ((t_wolf *)-1); bunny_delete_ini(ini); return (wolf); }
int my_ini_file(t_all *all, char *str) { all->ini = bunny_load_ini(str); if (all->ini == 0) return (-1); return (1); }
char open_ini(t_param *arg, char **av) { if ((arg->ini = bunny_load_ini(av[1])) == NULL) return (1); if (FLD(arg->ini, NULL, "objlist", 0) == NULL) return (2); return (0); }
void load_config(t_data *data) { if ((CONFIG = bunny_malloc(sizeof(t_config))) == NULL) exit(1); if ((CONFIG->ini = bunny_load_ini("files/ini/config.ini")) != NULL) { data->config->fullscreen = my_getnbr((char *)BGF(CONFIG->ini, "config", "fullscreen", 0)); WIDTH = my_getnbr((char *)BGF(CONFIG->ini, "config", "width", 0)); HEIGHT = my_getnbr((char *)BGF(CONFIG->ini, "config", "height", 0)); VOLUME = my_getnbr((char *)BGF(CONFIG->ini, "config", "volume", 0)); CONFIG->fov = my_getnbr((char *)BGF(CONFIG->ini, "config", "fov", 0)); load_input(data); } else default_config(data); }
int main() { t_data data; if ((data.map = bunny_malloc(sizeof(t_map))) == NULL) return (-1); if ((data.pl = bunny_malloc(sizeof(t_player))) == NULL) return (-1); data.music_play = 0; data.ini = bunny_load_ini("ress/map/level0.ini\0"); initialisation(&data); if (data.ini == NULL) return (0); if ((get_map(&data)) == -1) return (-1); bunny_set_loop_main_function(mainloop); bunny_loop(data.win, 25, &data); bunny_stop(data.win); clean(&data); return (0); }