aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_floor_threads.c
blob: 14b3eda064104428fa5c4f409941d20de875db34 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
/* ************************************************************************** */
/*                                                                            */
/*                                                        :::      ::::::::   */
/*   ft_wall_threads.c                                  :+:      :+:    :+:   */
/*                                                    +:+ +:+         +:+     */
/*   By: joelecle <marvin@42.fr>                    +#+  +:+       +#+        */
/*                                                +#+#+#+#+#+   +#+           */
/*   Created: 2020/02/14 17:22:23 by joelecle          #+#    #+#             */
/*   Updated: 2020/02/14 17:23:42 by joelecle         ###   ########lyon.fr   */
/*                                                                            */
/* ************************************************************************** */

#include <cub3d.h>
#include <stdint.h>
#include <pthread.h>

void
	*ft_floor_one(void *vargp)
{
	uint16_t	x;
	uint16_t	y;
	t_cub		*cl;

	cl = (t_cub *)vargp;
	y = (cl->wlist.y_size / 2);
	while (y < (cl->wlist.y_size))
	{
		x = 0;
		while (x < cl->wlist.x_size / 5)
		{
			if (cl->rlist.wall_b_tab[x] <= y)
				ft_floor_cast_loop(y, x, cl);
			x++;
		}
		y++;
	}
	pthread_exit(0x0);
	return (0x0);
}

void
	*ft_floor_two(void *vargp)
{
	uint16_t	x;
	uint16_t	y;
	t_cub		*cl;

	cl = (t_cub *)vargp;
	y = (cl->wlist.y_size / 2);
	while (y < (cl->wlist.y_size))
	{
		x = cl->wlist.x_size / 5;
		while (x < 2 * (cl->wlist.x_size / 5))
		{
			if (cl->rlist.wall_b_tab[x] <= y)
				ft_floor_cast_loop(y, x, cl);
			x++;
		}
		y++;
	}
	pthread_exit(0x0);
	return (0x0);
}

void
	*ft_floor_three(void *vargp)
{
	uint16_t	x;
	uint16_t	y;
	t_cub		*cl;

	cl = (t_cub *)vargp;
	y = (cl->wlist.y_size / 2);
	while (y < (cl->wlist.y_size))
	{
		x = 2 * (cl->wlist.x_size / 5);
		while (x < 3 * (cl->wlist.x_size / 5))
		{
			if (cl->rlist.wall_b_tab[x] <= y)
				ft_floor_cast_loop(y, x, cl);
			x++;
		}
		y++;
	}
	pthread_exit(0x0);
	return (0x0);
}

void
	*ft_floor_four(void *vargp)
{
	uint16_t	x;
	uint16_t	y;
	t_cub		*cl;

	cl = (t_cub *)vargp;
	y = (cl->wlist.y_size / 2);
	while (y < (cl->wlist.y_size))
	{
		x = 3 * (cl->wlist.x_size / 5);
		while (x < 4 * (cl->wlist.x_size / 5))
		{
			if (cl->rlist.wall_b_tab[x] <= y)
				ft_floor_cast_loop(y, x, cl);
			x++;
		}
		y++;
	}
	pthread_exit(0x0);
	return (0x0);
}

void
	*ft_floor_five(void *vargp)
{
	uint16_t	x;
	uint16_t	y;
	t_cub		*cl;

	cl = (t_cub *)vargp;
	y = (cl->wlist.y_size / 2);
	while (y < (cl->wlist.y_size))
	{
		x = 4 * (cl->wlist.x_size / 5);
		while (x < 5 * (cl->wlist.x_size / 5))
		{
			if (cl->rlist.wall_b_tab[x] <= y)
				ft_floor_cast_loop(y, x, cl);
			x++;
		}
		y++;
	}
	pthread_exit(0x0);
	return (0x0);
}