aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--Makefile2
-rw-r--r--inc/cub3d.h4
-rw-r--r--inc/cub3d_structs.h2
-rw-r--r--map/map_one.cub4
-rw-r--r--src/ft_del_map.c1
-rw-r--r--src/ft_draw_scene.c2
-rw-r--r--src/ft_draw_skybox.c38
-rw-r--r--src/ft_floor_cast.c25
-rw-r--r--src/ft_floor_cast_inits.c9
-rw-r--r--src/ft_floor_threads.c38
-rw-r--r--src/ft_get_skybox.c43
-rw-r--r--src/ft_init_funptr.c4
-rw-r--r--src/ft_init_map.c2
-rw-r--r--src/ft_select_get.c7
-rw-r--r--src/ft_tex_init.c31
-rw-r--r--src/ft_wall_cast.c10
-rw-r--r--src/ft_wall_threads.c44
17 files changed, 112 insertions, 154 deletions
diff --git a/Makefile b/Makefile
index cb7f485..b5ae41d 100644
--- a/Makefile
+++ b/Makefile
@@ -39,7 +39,6 @@ SRCS_NAME += ft_get_tex_nl.c
SRCS_NAME += ft_get_tex_extra.c
SRCS_NAME += ft_get_path_nl.c
SRCS_NAME += ft_get_nlvl_pos.c
-SRCS_NAME += ft_get_skybox.c
SRCS_NAME += ft_get_player_spawn.c
SRCS_NAME += ft_get_music.c
SRCS_NAME += ft_get_darkness.c
@@ -57,7 +56,6 @@ SRCS_NAME += ft_draw_square.c
SRCS_NAME += ft_draw_circle.c
SRCS_NAME += ft_draw_map.c
SRCS_NAME += ft_draw_scene.c
-SRCS_NAME += ft_draw_skybox.c
SRCS_NAME += ft_basic_keys.c
SRCS_NAME += ft_extra_keys.c
SRCS_NAME += ft_wall_cast.c
diff --git a/inc/cub3d.h b/inc/cub3d.h
index aa81b4c..84d9ea1 100644
--- a/inc/cub3d.h
+++ b/inc/cub3d.h
@@ -98,7 +98,6 @@ void ft_calc_heal(t_cub *cl);
void ft_draw_heals(t_cub *cl, t_sprite *sprite);
void ft_calc_weaps(t_cub *cl);
void ft_draw_weapon(t_cub *cl, t_sprite *sprite);
-void ft_draw_skybox(t_cub *cl);
void ft_draw_handweap(t_cub *cl);
void ft_macos_suffer_animation(t_cub *cl);
void ft_linux_suffer_animation(t_cub *cl);
@@ -113,10 +112,12 @@ void *ft_wall_one(void *vargp);
void *ft_wall_two(void *vargp);
void *ft_wall_three(void *vargp);
void *ft_wall_four(void *vargp);
+void *ft_wall_five(void *vargp);
void *ft_floor_one(void *vargp);
void *ft_floor_two(void *vargp);
void *ft_floor_three(void *vargp);
void *ft_floor_four(void *vargp);
+void *ft_floor_five(void *vargp);
/*
** ====== PARSING ======
@@ -139,7 +140,6 @@ int8_t ft_get_c_color(char **words, t_cub *clist);
int8_t ft_get_c_tex(char **words, t_cub *clist);
int8_t ft_get_darkness(char **words, t_cub *clist);
int8_t ft_get_path_nl(char **words, t_cub *clist);
-int8_t ft_get_skybox(char **words, t_cub *clist);
int8_t ft_get_traps(char **words, t_cub *clist);
int8_t ft_get_tex_nl(char **words, t_cub *clist);
int8_t ft_get_music(char **words, t_cub *clist);
diff --git a/inc/cub3d_structs.h b/inc/cub3d_structs.h
index 5497ae9..e2905f2 100644
--- a/inc/cub3d_structs.h
+++ b/inc/cub3d_structs.h
@@ -191,7 +191,6 @@ typedef struct s_map
char *fl_tex_path;
char *ce_tex_path;
char *nlevel_path;
- char *skybox_path;
char *traps_path;
char *music_path;
char *music_cmd;
@@ -214,7 +213,6 @@ typedef struct s_map
uint8_t ismusic;
uint8_t isftex;
uint8_t isctex;
- uint8_t isskybox;
uint8_t istraps;
uint8_t isheals;
uint8_t darklvl;
diff --git a/map/map_one.cub b/map/map_one.cub
index 43b9268..16c0ec0 100644
--- a/map/map_one.cub
+++ b/map/map_one.cub
@@ -31,7 +31,7 @@ SH 2
100000000000000000000000000001
1001000000T0000000000000000001
10110+0+0111000001110000000111
-111111111111110011 100000001
+111111111111110011 1000N0001
1000001 190001 111111111
1001001 190001
1911001 190001
@@ -39,7 +39,7 @@ SH 2
10000000110101011
10000000000000001
1#0#0#0#000000001
-1@0@0@0@000W00001
+1@0@0@0@000000001
1!0!0!0!000000001
10000000000000001
11000000110100011
diff --git a/src/ft_del_map.c b/src/ft_del_map.c
index 0c03007..49b9db9 100644
--- a/src/ft_del_map.c
+++ b/src/ft_del_map.c
@@ -26,7 +26,6 @@ void
ft_memdel((void*)&ml->fl_tex_path);
ft_memdel((void*)&ml->ce_tex_path);
ft_memdel((void*)&ml->nlevel_path);
- ft_memdel((void*)&ml->skybox_path);
ft_memdel((void*)&ml->traps_path);
ft_memdel((void*)&ml->music_path);
ft_memdel((void*)&ml->music_cmd);
diff --git a/src/ft_draw_scene.c b/src/ft_draw_scene.c
index 74b8315..4c7879b 100644
--- a/src/ft_draw_scene.c
+++ b/src/ft_draw_scene.c
@@ -65,8 +65,6 @@ void
clist->doicast = 1;
if (clist->ishud)
ft_draw_hud(clist);
- if (clist->mlist.isskybox)
- ft_draw_skybox(clist);
mlx_put_image_to_window(clist->wlist.wlx,
clist->wlist.winptr, clist->img.img, 0, 0);
if (FT_OS == 2)
diff --git a/src/ft_draw_skybox.c b/src/ft_draw_skybox.c
deleted file mode 100644
index a446485..0000000
--- a/src/ft_draw_skybox.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/* ************************************************************************** */
-/* */
-/* ::: :::::::: */
-/* ft_draw_skybox.c :+: :+: :+: */
-/* +:+ +:+ +:+ */
-/* By: rbousset <marvin@42.fr> +#+ +:+ +#+ */
-/* +#+#+#+#+#+ +#+ */
-/* Created: 2020/02/14 17:22:57 by rbousset #+# #+# */
-/* Updated: 2020/02/14 17:23:42 by rbousset ### ########lyon.fr */
-/* */
-/* ************************************************************************** */
-
-#include <cub3d.h>
-#include <mlx.h>
-
-void
- ft_draw_skybox(t_cub *cl)
-{
- int offset;
-
- offset = 640;
- if (cl->plist.dir_x > 0)
- offset = -offset;
- mlx_put_image_to_window(cl->wlist.wlx, cl->wlist.winptr,
- cl->tlist[7].img, offset * cl->plist.dir_y, -125);
- mlx_put_image_to_window(cl->wlist.wlx, cl->wlist.winptr,
- cl->tlist[7].img, offset * cl->plist.dir_y, -125);
- mlx_put_image_to_window(cl->wlist.wlx, cl->wlist.winptr,
- cl->tlist[7].img, offset * cl->plist.dir_y, -125);
- mlx_put_image_to_window(cl->wlist.wlx, cl->wlist.winptr,
- cl->tlist[7].img, offset * cl->plist.dir_y, -125);
- mlx_put_image_to_window(cl->wlist.wlx, cl->wlist.winptr,
- cl->tlist[7].img, offset * cl->plist.dir_y, -125);
- mlx_put_image_to_window(cl->wlist.wlx, cl->wlist.winptr,
- cl->tlist[7].img, offset * cl->plist.dir_y, -125);
- mlx_put_image_to_window(cl->wlist.wlx, cl->wlist.winptr,
- cl->tlist[7].img, offset * cl->plist.dir_y, -125);
-}
diff --git a/src/ft_floor_cast.c b/src/ft_floor_cast.c
index 3962431..13a0b54 100644
--- a/src/ft_floor_cast.c
+++ b/src/ft_floor_cast.c
@@ -34,11 +34,14 @@ static void
if ((dist = cl->rlist.row_dist_tab[y]) <= 0)
dist = 0.0001;
rgb.b = (uint8_t)cl->tlist[tid].ptr[cl->rlist.fc_tex_x_tab[tid - 6][y][x]
- * 4 + 4 * cl->tlist[tid].img_h * cl->rlist.fc_tex_y_tab[tid - 6][y][x]];
+ * 4 + 4 * cl->tlist[tid].img_h *
+ cl->rlist.fc_tex_y_tab[tid - 6][y][x]];
rgb.g = (uint8_t)cl->tlist[tid].ptr[cl->rlist.fc_tex_x_tab[tid - 6][y][x]
- * 4 + 4 * cl->tlist[tid].img_h * cl->rlist.fc_tex_y_tab[tid - 6][y][x] + 1];
+ * 4 + 4 * cl->tlist[tid].img_h *
+ cl->rlist.fc_tex_y_tab[tid - 6][y][x] + 1];
rgb.r = (uint8_t)cl->tlist[tid].ptr[cl->rlist.fc_tex_x_tab[tid - 6][y][x]
- * 4 + 4 * cl->tlist[tid].img_h * cl->rlist.fc_tex_y_tab[tid - 6][y][x] + 2];
+ * 4 + 4 * cl->tlist[tid].img_h *
+ cl->rlist.fc_tex_y_tab[tid - 6][y][x] + 2];
*(int*)(cl->img.ptr + ((uint16_t)x * 4 +
(y * cl->img.sizeline))) = ft_rgb_to_hex(dist, rgb, cl);
}
@@ -50,20 +53,20 @@ void
{
ft_draw_extra_tex(6, y, x, cl);
}
- else
+ else if (!cl->mlist.isftex)
ft_draw_plain_horizontal(cl->f_rgb, cl, y, x);
- if (cl->mlist.isctex && !cl->mlist.isskybox)
+ if (cl->mlist.isctex)
{
ft_draw_extra_tex(7, cl->wlist.y_size - y - 1, x, cl);
}
- else if (!cl->mlist.isctex && !cl->mlist.isskybox)
+ else if (!cl->mlist.isctex)
ft_draw_plain_horizontal(cl->c_rgb, cl, cl->wlist.y_size - y - 1, x);
}
void
*ft_floor_cast(void *vargp)
{
- pthread_t tid[4];
+ pthread_t tid[5];
t_cub *cl;
cl = (t_cub *)vargp;
@@ -71,10 +74,12 @@ void
pthread_create(&tid[1], 0x0, ft_floor_two, (void*)cl);
pthread_create(&tid[2], 0x0, ft_floor_three, (void*)cl);
pthread_create(&tid[3], 0x0, ft_floor_four, (void*)cl);
- pthread_join(tid[0], 0x0);
- pthread_join(tid[1], 0x0);
- pthread_join(tid[2], 0x0);
+ pthread_create(&tid[4], 0x0, ft_floor_five, (void*)cl);
+ pthread_join(tid[4], 0x0);
pthread_join(tid[3], 0x0);
+ pthread_join(tid[2], 0x0);
+ pthread_join(tid[1], 0x0);
+ pthread_join(tid[0], 0x0);
pthread_exit(0x0);
return (0x0);
}
diff --git a/src/ft_floor_cast_inits.c b/src/ft_floor_cast_inits.c
index d1f2811..92b660b 100644
--- a/src/ft_floor_cast_inits.c
+++ b/src/ft_floor_cast_inits.c
@@ -13,6 +13,7 @@
#include <cub3d.h>
#include <stdint.h>
+#include <libft.h>
void
ft_set_fc_tex_xy(uint8_t tid, uint16_t x, uint16_t y, t_cub *cl)
{
@@ -23,8 +24,10 @@ void
* (cl->rlist.y_floor - y_cell));
cl->tlist[tid].tex_y = (int32_t)(cl->tlist[tid].img_w
* (cl->rlist.x_floor - x_cell));
- cl->rlist.fc_tex_x_tab[tid - 6][y][x] = cl->tlist[tid].tex_x;
- cl->rlist.fc_tex_y_tab[tid - 6][y][x] = cl->tlist[tid].tex_y;
+ cl->rlist.fc_tex_x_tab[tid - 6][y][x] = (cl->tlist[tid].tex_x >= 0) ?
+ (cl->tlist[tid].tex_x) : (-cl->tlist[tid].tex_x);
+ cl->rlist.fc_tex_y_tab[tid - 6][y][x] = (cl->tlist[tid].tex_y >= 0) ?
+ (cl->tlist[tid].tex_y) : (-cl->tlist[tid].tex_y);
}
void
@@ -58,7 +61,7 @@ void
{
if (cl->mlist.isftex)
ft_set_fc_tex_xy(6, x, y, cl);
- if (cl->mlist.isctex && !cl->mlist.isskybox)
+ if (cl->mlist.isctex)
ft_set_fc_tex_xy(7, x, cl->wlist.y_size - y - 1, cl);
}
cl->rlist.x_floor += cl->mlist.x_floor_step;
diff --git a/src/ft_floor_threads.c b/src/ft_floor_threads.c
index 476bd8e..05f75aa 100644
--- a/src/ft_floor_threads.c
+++ b/src/ft_floor_threads.c
@@ -26,7 +26,7 @@ void
while (y < (cl->wlist.y_size))
{
x = 0;
- while (x < cl->wlist.x_size / 4)
+ while (x < cl->wlist.x_size / 5)
{
if (cl->rlist.wall_b_tab[x] <= y)
ft_floor_cast_loop(y, x, cl);
@@ -49,8 +49,8 @@ void
y = (cl->wlist.y_size / 2);
while (y < (cl->wlist.y_size))
{
- x = cl->wlist.x_size / 4;
- while (x < 2 * (cl->wlist.x_size / 4))
+ 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);
@@ -73,8 +73,8 @@ void
y = (cl->wlist.y_size / 2);
while (y < (cl->wlist.y_size))
{
- x = 2 * (cl->wlist.x_size / 4);
- while (x < 3 * (cl->wlist.x_size / 4))
+ 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);
@@ -97,8 +97,32 @@ void
y = (cl->wlist.y_size / 2);
while (y < (cl->wlist.y_size))
{
- x = 3 * (cl->wlist.x_size / 4);
- while (x < 4 * (cl->wlist.x_size / 4))
+ 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);
diff --git a/src/ft_get_skybox.c b/src/ft_get_skybox.c
deleted file mode 100644
index 1e55b85..0000000
--- a/src/ft_get_skybox.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/* ************************************************************************** */
-/* */
-/* ::: :::::::: */
-/* ft_get_skybox.c :+: :+: :+: */
-/* +:+ +:+ +:+ */
-/* By: rbousset <marvin@42.fr> +#+ +:+ +#+ */
-/* +#+#+#+#+#+ +#+ */
-/* Created: 2020/02/24 20:22:45 by rbousset #+# #+# */
-/* Updated: 2020/03/09 18:56:01 by rbousset ### ########lyon.fr */
-/* */
-/* ************************************************************************** */
-
-#include <libft.h>
-#include <cub3d.h>
-#include <stdint.h>
-
-int8_t
- ft_get_skybox(char **words, t_cub *clist)
-{
- if (!(*words) || !(*(words + 1)) || (*(words + 2)))
- {
- ft_sprintf(clist->errmsg, FT_ERR_ARGS);
- return (-1);
- }
- if (ft_check_ext(*(words + 1), ".xpm") < 0)
- {
- ft_sprintf(clist->errmsg, FT_ERR_NOT_A_XPM);
- return (-1);
- }
- ft_memdel((void*)&clist->mlist.skybox_path);
- if (!(clist->mlist.skybox_path = ft_strdup(*(words + 1))))
- {
- ft_sprintf(clist->errmsg, FT_ERR_ALLOCATE);
- return (-1);
- }
- if (ft_check_not_found(clist->mlist.skybox_path) < 0)
- {
- ft_sprintf(clist->errmsg, FT_ERR_RD_SB);
- return (-1);
- }
- clist->mlist.isskybox = 1;
- return (0);
-}
diff --git a/src/ft_init_funptr.c b/src/ft_init_funptr.c
index d944778..99983c6 100644
--- a/src/ft_init_funptr.c
+++ b/src/ft_init_funptr.c
@@ -28,7 +28,7 @@ void
ft_sprintf(clist->ref[9], "LT");
ft_sprintf(clist->ref[10], "MU");
ft_sprintf(clist->ref[11], "SH");
- ft_sprintf(clist->ref[12], "SB");
+ ft_sprintf(clist->ref[12], "C");
ft_sprintf(clist->ref[13], "T");
ft_sprintf(clist->ref[14], "S3");
ft_sprintf(clist->ref[15], "S4");
@@ -61,6 +61,6 @@ void
clist->get_ptr[9] = ft_get_tex_nl;
clist->get_ptr[10] = ft_get_music;
clist->get_ptr[11] = ft_get_darkness;
- clist->get_ptr[12] = ft_get_skybox;
+ clist->get_ptr[12] = ft_get_c_color;
clist->get_ptr[13] = ft_get_traps;
}
diff --git a/src/ft_init_map.c b/src/ft_init_map.c
index 0abfcb1..4d3cc08 100644
--- a/src/ft_init_map.c
+++ b/src/ft_init_map.c
@@ -28,7 +28,6 @@ static int8_t
!(mlist->fl_tex_path = (char*)ft_calloc(1, sizeof(char))) ||
!(mlist->ce_tex_path = (char*)ft_calloc(1, sizeof(char))) ||
!(mlist->nlevel_path = (char*)ft_calloc(1, sizeof(char))) ||
- !(mlist->skybox_path = (char*)ft_calloc(1, sizeof(char))) ||
!(mlist->traps_path = (char*)ft_calloc(1, sizeof(char))) ||
!(mlist->music_path = (char*)ft_calloc(1, sizeof(char))) ||
!(mlist->music_cmd = (char*)ft_calloc(1, sizeof(char))) ||
@@ -93,7 +92,6 @@ int8_t
mlist->isctex = 0;
mlist->isnlvl = 0;
mlist->ismusic = 0;
- mlist->isskybox = 0;
mlist->istraps = 0;
mlist->isheals = 0;
return (ft_init_map_norme(mlist));
diff --git a/src/ft_select_get.c b/src/ft_select_get.c
index a2bd257..0edc4f2 100644
--- a/src/ft_select_get.c
+++ b/src/ft_select_get.c
@@ -36,8 +36,9 @@ static int8_t
if (ret == 6 && (((clist->f_rgb.r != -1) || (clist->f_rgb.g != -1)
|| (clist->f_rgb.b != -1)) || clist->mlist.fl_tex_path[0]))
return (-1);
- if (ret == 7 && (((clist->c_rgb.r != -1) || (clist->c_rgb.g != -1)
- || (clist->c_rgb.b != -1)) || clist->mlist.ce_tex_path[0]))
+ if ((ret == 7 || ret == 12) && (((clist->c_rgb.r != -1) ||
+ (clist->c_rgb.g != -1) || (clist->c_rgb.b != -1)) ||
+ clist->mlist.ce_tex_path[0]))
return (-1);
return (ret);
}
@@ -53,8 +54,6 @@ static int8_t
return (-1);
if (ret == 10 && (clist->mlist.music_path[0]))
return (-1);
- if (ret == 12 && (clist->mlist.skybox_path[0]))
- return (-1);
if (ret == 13 && (clist->mlist.traps_path[0]))
return (-1);
if (ret > 13 && ret < 21 && (clist->mlist.sprite_path[ret - 13][0]))
diff --git a/src/ft_tex_init.c b/src/ft_tex_init.c
index a6eec43..1a58421 100644
--- a/src/ft_tex_init.c
+++ b/src/ft_tex_init.c
@@ -84,6 +84,13 @@ static void
static void
ft_wall_tex_init_next_bonus(t_cub *cl)
{
+ if (cl->mlist.istraps)
+ {
+ cl->tlist[15].img = mlx_xpm_file_to_image(cl->wlist.wlx,
+ cl->mlist.traps_path, &cl->tlist[15].img_w, &cl->tlist[15].img_h);
+ cl->tlist[15].ptr = mlx_get_data_addr(cl->tlist[15].img,
+ &cl->tlist[15].bpp, &cl->tlist[15].sizeline, &cl->tlist[15].endian);
+ }
if (cl->mlist.isheals)
{
cl->tlist[17].img = mlx_xpm_file_to_image(cl->wlist.wlx,
@@ -91,20 +98,6 @@ static void
cl->tlist[17].ptr = mlx_get_data_addr(cl->tlist[17].img,
&cl->tlist[17].bpp, &cl->tlist[17].sizeline, &cl->tlist[17].endian);
}
- if (cl->mlist.isskybox)
- {
- cl->tlist[7].img = mlx_xpm_file_to_image(cl->wlist.wlx,
- cl->mlist.skybox_path, &cl->tlist[7].img_w, &cl->tlist[7].img_h);
- cl->tlist[7].ptr = mlx_get_data_addr(cl->tlist[7].img,
- &cl->tlist[7].bpp, &cl->tlist[7].sizeline, &cl->tlist[7].endian);
- }
- else if (cl->mlist.isctex)
- {
- cl->tlist[7].img = mlx_xpm_file_to_image(cl->wlist.wlx,
- cl->mlist.ce_tex_path, &cl->tlist[7].img_w, &cl->tlist[7].img_h);
- cl->tlist[7].ptr = mlx_get_data_addr(cl->tlist[7].img,
- &cl->tlist[7].bpp, &cl->tlist[7].sizeline, &cl->tlist[7].endian);
- }
ft_wall_tex_init_more_bonus(cl);
}
@@ -125,12 +118,12 @@ static void
cl->tlist[6].ptr = mlx_get_data_addr(cl->tlist[6].img,
&cl->tlist[6].bpp, &cl->tlist[6].sizeline, &cl->tlist[6].endian);
}
- if (cl->mlist.istraps)
+ if (cl->mlist.isctex)
{
- cl->tlist[15].img = mlx_xpm_file_to_image(cl->wlist.wlx,
- cl->mlist.traps_path, &cl->tlist[15].img_w, &cl->tlist[15].img_h);
- cl->tlist[15].ptr = mlx_get_data_addr(cl->tlist[15].img,
- &cl->tlist[15].bpp, &cl->tlist[15].sizeline, &cl->tlist[15].endian);
+ cl->tlist[7].img = mlx_xpm_file_to_image(cl->wlist.wlx,
+ cl->mlist.ce_tex_path, &cl->tlist[7].img_w, &cl->tlist[7].img_h);
+ cl->tlist[7].ptr = mlx_get_data_addr(cl->tlist[7].img,
+ &cl->tlist[7].bpp, &cl->tlist[7].sizeline, &cl->tlist[7].endian);
}
ft_wall_tex_init_next_bonus(cl);
}
diff --git a/src/ft_wall_cast.c b/src/ft_wall_cast.c
index 7610df6..0585f94 100644
--- a/src/ft_wall_cast.c
+++ b/src/ft_wall_cast.c
@@ -38,7 +38,7 @@ void
void
*ft_wall_cast(void *vargp)
{
- pthread_t tid[8];
+ pthread_t tid[5];
t_cub *cl;
cl = (t_cub *)vargp;
@@ -46,10 +46,12 @@ void
pthread_create(&tid[1], 0x0, ft_wall_two, (void*)cl);
pthread_create(&tid[2], 0x0, ft_wall_three, (void*)cl);
pthread_create(&tid[3], 0x0, ft_wall_four, (void*)cl);
- pthread_join(tid[0], 0x0);
- pthread_join(tid[1], 0x0);
- pthread_join(tid[2], 0x0);
+ pthread_create(&tid[4], 0x0, ft_wall_five, (void*)cl);
+ pthread_join(tid[4], 0x0);
pthread_join(tid[3], 0x0);
+ pthread_join(tid[2], 0x0);
+ pthread_join(tid[1], 0x0);
+ pthread_join(tid[0], 0x0);
pthread_exit(0x0);
return (0x0);
}
diff --git a/src/ft_wall_threads.c b/src/ft_wall_threads.c
index 30aa3b9..4855da6 100644
--- a/src/ft_wall_threads.c
+++ b/src/ft_wall_threads.c
@@ -22,9 +22,10 @@ void
cl = (t_cub *)vargp;
i = 0;
- while (i < cl->wlist.x_size / 4)
+ while (i < cl->wlist.x_size / 5)
{
- ft_draw_verline(cl, i, cl->rlist.wall_t_tab[i], cl->rlist.wall_b_tab[i]);
+ ft_draw_verline(cl, i,
+ cl->rlist.wall_t_tab[i], cl->rlist.wall_b_tab[i]);
i++;
}
pthread_exit(0x0);
@@ -38,10 +39,11 @@ void
uint16_t i;
cl = (t_cub *)vargp;
- i = cl->wlist.x_size / 4;
- while (i < 2 * (cl->wlist.x_size / 4))
+ i = cl->wlist.x_size / 5;
+ while (i < 2 * (cl->wlist.x_size / 5))
{
- ft_draw_verline(cl, i, cl->rlist.wall_t_tab[i], cl->rlist.wall_b_tab[i]);
+ ft_draw_verline(cl, i,
+ cl->rlist.wall_t_tab[i], cl->rlist.wall_b_tab[i]);
i++;
}
pthread_exit(0x0);
@@ -55,10 +57,11 @@ void
uint16_t i;
cl = (t_cub *)vargp;
- i = 2 * (cl->wlist.x_size / 4);
- while (i < 3 * (cl->wlist.x_size / 4))
+ i = 2 * (cl->wlist.x_size / 5);
+ while (i < 3 * (cl->wlist.x_size / 5))
{
- ft_draw_verline(cl, i, cl->rlist.wall_t_tab[i], cl->rlist.wall_b_tab[i]);
+ ft_draw_verline(cl, i,
+ cl->rlist.wall_t_tab[i], cl->rlist.wall_b_tab[i]);
i++;
}
pthread_exit(0x0);
@@ -72,10 +75,29 @@ void
uint16_t i;
cl = (t_cub *)vargp;
- i = 3 * (cl->wlist.x_size / 4);
- while (i < 4 * (cl->wlist.x_size / 4))
+ i = 3 * (cl->wlist.x_size / 5);
+ while (i < 4 * (cl->wlist.x_size / 5))
{
- ft_draw_verline(cl, i, cl->rlist.wall_t_tab[i], cl->rlist.wall_b_tab[i]);
+ ft_draw_verline(cl, i,
+ cl->rlist.wall_t_tab[i], cl->rlist.wall_b_tab[i]);
+ i++;
+ }
+ pthread_exit(0x0);
+ return (0x0);
+}
+
+void
+ *ft_wall_five(void *vargp)
+{
+ t_cub *cl;
+ uint16_t i;
+
+ cl = (t_cub *)vargp;
+ i = 4 * (cl->wlist.x_size / 5);
+ while (i < 5 * (cl->wlist.x_size / 5))
+ {
+ ft_draw_verline(cl, i,
+ cl->rlist.wall_t_tab[i],cl->rlist.wall_b_tab[i]);
i++;
}
pthread_exit(0x0);