Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void init_visible(t_map *m)
- {
- int i;
- int d;
- i = 0;
- d = 0;
- m->visible = malloc(sizeof(t_visible) * m->sector_count);
- while (i < m->sector_count)
- {
- m->visible[i].wall = malloc(sizeof(int) * m->sector[i].wall_count);
- i++;
- }
- i = 0;
- while (i < m->sector_count)
- {
- while (d < m->sector[i].wall_count)
- {
- m->visible[i].wall[d] = 0;
- d++;
- }
- d = 0;
- i++;
- }
- }
- void draw(t_env *w, t_map *m)
- {
- int x;
- t_draw d;
- t_reader read;
- int renderedsectors[m->sector_count];
- x = -1;
- init_visible(m);
- while (x++ < WIDTH)
- {
- d.ytop[x] = 0;
- d.ybot[x] = HEIGHT - 1;
- if (x < m->sector_count)
- renderedsectors[x] = 0;
- }
- w->i = init_draw(&d, &read, m);
- while (read.head != read.tail)
- {
- read.now = *read.tail;
- if (++read.tail == read.queue + m->maxrenderedsector)
- read.tail = read.queue;
- if (renderedsectors[read.now.sectorno]++ & (m->maxrenderedsector + 1))
- continue;
- wall_to_wall(&d, &read, m, w);
- ++renderedsectors[read.now.sectorno];
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement