// function for maze Maze *construct_maze(int shape[MAZE_HEIGHT][MAZE_WIDTH], int px, int py, int ex, int ey) { Maze *maze = (Maze *) malloc(sizeof(Maze)); init_player(&maze->player1, px, py); init_exit(&maze->exit1, ex, ey); for (int i = 0; i < MAZE_HEIGHT; i++) { for (int j = 0; j < MAZE_WIDTH; j++) { maze->wall1.shape[i][j] = shape[i][j]; } } maze->xsize = MAZE_WIDTH; maze->ysize = MAZE_HEIGHT; return maze; }
void ft_init(t_env *env, char *file) { t_lex *lex; t_lex *tmp; //t_scene *s = NULL; //t_light *l = NULL; lex = get_file(file); tmp = lex; env->scene = NULL; env->light = NULL; env->back_color = COLOR_BLUE; while (lex) { if (!ft_strcmp(lex->str, "<GEN>")) lex = get_gen(env, lex->next); else if (!ft_strcmp(lex->str, "<OBJ>")) lex = get_obj(env, lex->next); else { ft_putendl(lex->str); init_exit(); } if (lex == tmp) break ; } /*l = env->light; while (l) { sleep(1); s = new_scene(); s->type = SPHERE; s->pos = l->pos; s->color = new(1, 1, 1); s->size = 5; s->next = env->scene; env->scene = s; l = l->next; }*/ }