diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ft_draw_hud.c | 77 | ||||
-rw-r--r-- | src/ft_floor_cast.c | 10 | ||||
-rw-r--r-- | src/ft_hud_threads.c | 70 | ||||
-rw-r--r-- | src/ft_hud_threads_next.c | 38 | ||||
-rw-r--r-- | src/ft_wall_cast.c | 164 |
5 files changed, 194 insertions, 165 deletions
diff --git a/src/ft_draw_hud.c b/src/ft_draw_hud.c index 6e4f86f..ca553f0 100644 --- a/src/ft_draw_hud.c +++ b/src/ft_draw_hud.c @@ -42,83 +42,6 @@ static void } } -void -*ft_ammo_back_thread(void *vargp) -{ - t_cub *clist; - - clist = (t_cub *)vargp; - ft_draw_ammo_back(clist); - pthread_exit(0x0); - return (0x0); -} - -void -*ft_minimap_back_thread(void *vargp) -{ - t_cub *clist; - - clist = (t_cub *)vargp; - ft_draw_minimap_back(clist); - pthread_exit(0x0); - return (0x0); -} - -void -*ft_map_thread(void *vargp) -{ - t_cub *clist; - - clist = (t_cub *)vargp; - ft_draw_map(clist->mlist.map, clist); - pthread_exit(0x0); - return (0x0); -} - -void -*ft_life_bar_thread(void *vargp) -{ - t_cub *clist; - - clist = (t_cub *)vargp; - ft_draw_life_bar(clist); - pthread_exit(0x0); - return (0x0); -} - -void -*ft_ammo_bar_thread(void *vargp) -{ - t_cub *clist; - - clist = (t_cub *)vargp; - ft_draw_ammo_bar(clist); - pthread_exit(0x0); - return (0x0); -} - -void -*ft_health_cap_thread(void *vargp) -{ - t_cub *clist; - - clist = (t_cub *)vargp; - ft_draw_health_caption(clist); - pthread_exit(0x0); - return (0x0); -} - -void -*ft_ammo_cap_thread(void *vargp) -{ - t_cub *clist; - - clist = (t_cub *)vargp; - ft_draw_ammo_caption(clist); - pthread_exit(0x0); - return (0x0); -} - int8_t ft_draw_hud(t_cub *clist) { diff --git a/src/ft_floor_cast.c b/src/ft_floor_cast.c index 09e0493..180f401 100644 --- a/src/ft_floor_cast.c +++ b/src/ft_floor_cast.c @@ -61,17 +61,15 @@ static void if (cl->mlist.isftex) { ft_set_tex_xy(6, rl, cl); - } - if (cl->mlist.isctex) - { - ft_set_tex_xy(7, rl, cl); - } - if (cl->mlist.isftex) ft_draw_extra_tex(6, y, x, cl); + } else ft_draw_plain_horizontal(cl->f_rgb, cl, y, x); if (cl->mlist.isctex && !cl->mlist.isskybox) + { + ft_set_tex_xy(7, rl, cl); ft_draw_extra_tex(7, cl->wlist.y_size - y - 1, x, cl); + } else if (!cl->mlist.isctex && !cl->mlist.isskybox) ft_draw_plain_horizontal(cl->c_rgb, cl, cl->wlist.y_size - y - 1, x); } diff --git a/src/ft_hud_threads.c b/src/ft_hud_threads.c new file mode 100644 index 0000000..c120dc9 --- /dev/null +++ b/src/ft_hud_threads.c @@ -0,0 +1,70 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_hud_threads.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rbousset <marvin@42.fr> +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/02/22 20:02:47 by rbousset #+# #+# */ +/* Updated: 2020/02/22 20:02:48 by rbousset ### ########lyon.fr */ +/* */ +/* ************************************************************************** */ + +#include <cub3d.h> +#include <stdint.h> +#include <pthread.h> + +void + *ft_ammo_back_thread(void *vargp) +{ + t_cub *clist; + + clist = (t_cub *)vargp; + ft_draw_ammo_back(clist); + pthread_exit(0x0); + return (0x0); +} + +void + *ft_minimap_back_thread(void *vargp) +{ + t_cub *clist; + + clist = (t_cub *)vargp; + ft_draw_minimap_back(clist); + pthread_exit(0x0); + return (0x0); +} + +void + *ft_map_thread(void *vargp) +{ + t_cub *clist; + + clist = (t_cub *)vargp; + ft_draw_map(clist->mlist.map, clist); + pthread_exit(0x0); + return (0x0); +} + +void + *ft_life_bar_thread(void *vargp) +{ + t_cub *clist; + + clist = (t_cub *)vargp; + ft_draw_life_bar(clist); + pthread_exit(0x0); + return (0x0); +} + +void + *ft_ammo_bar_thread(void *vargp) +{ + t_cub *clist; + + clist = (t_cub *)vargp; + ft_draw_ammo_bar(clist); + pthread_exit(0x0); + return (0x0); +} diff --git a/src/ft_hud_threads_next.c b/src/ft_hud_threads_next.c new file mode 100644 index 0000000..e390050 --- /dev/null +++ b/src/ft_hud_threads_next.c @@ -0,0 +1,38 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_hud_threads.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rbousset <marvin@42.fr> +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/02/22 20:02:47 by rbousset #+# #+# */ +/* Updated: 2020/02/22 20:02:48 by rbousset ### ########lyon.fr */ +/* */ +/* ************************************************************************** */ + +#include <cub3d.h> +#include <stdint.h> +#include <pthread.h> + +void + *ft_health_cap_thread(void *vargp) +{ + t_cub *clist; + + clist = (t_cub *)vargp; + ft_draw_health_caption(clist); + pthread_exit(0x0); + return (0x0); +} + +void + *ft_ammo_cap_thread(void *vargp) +{ + t_cub *clist; + + clist = (t_cub *)vargp; + ft_draw_ammo_caption(clist); + pthread_exit(0x0); + return (0x0); +} + diff --git a/src/ft_wall_cast.c b/src/ft_wall_cast.c index b10d2a6..0a1a8ef 100644 --- a/src/ft_wall_cast.c +++ b/src/ft_wall_cast.c @@ -43,7 +43,7 @@ static void cl = (t_cub *)vargp; i = 0; - while (i < cl->wlist.x_size / 8) + while (i < cl->wlist.x_size / 4) { ft_draw_verline(cl, i, cl->rlist.wall_t_tab[i], cl->rlist.wall_bz[i]); i++; @@ -59,8 +59,8 @@ static void uint16_t i; cl = (t_cub *)vargp; - i = cl->wlist.x_size / 8; - while (i < 2 * (cl->wlist.x_size / 8)) + i = cl->wlist.x_size / 4; + while (i < 2 * (cl->wlist.x_size / 4)) { ft_draw_verline(cl, i, cl->rlist.wall_t_tab[i], cl->rlist.wall_bz[i]); i++; @@ -76,8 +76,8 @@ static void uint16_t i; cl = (t_cub *)vargp; - i = 2 * (cl->wlist.x_size / 8); - while (i < 3 * (cl->wlist.x_size / 8)) + i = 2 * (cl->wlist.x_size / 4); + while (i < 3 * (cl->wlist.x_size / 4)) { ft_draw_verline(cl, i, cl->rlist.wall_t_tab[i], cl->rlist.wall_bz[i]); i++; @@ -93,8 +93,8 @@ static void uint16_t i; cl = (t_cub *)vargp; - i = 3 * (cl->wlist.x_size / 8); - while (i < 4 * (cl->wlist.x_size / 8)) + i = 3 * (cl->wlist.x_size / 4); + while (i < 4 * (cl->wlist.x_size / 4)) { ft_draw_verline(cl, i, cl->rlist.wall_t_tab[i], cl->rlist.wall_bz[i]); i++; @@ -103,73 +103,73 @@ static void return (0x0); } -static void -*ft_wall_five(void *vargp) -{ - t_cub *cl; - uint16_t i; - - cl = (t_cub *)vargp; - i = 4 * (cl->wlist.x_size / 8); - while (i < 5 * (cl->wlist.x_size / 8)) - { - ft_draw_verline(cl, i, cl->rlist.wall_t_tab[i], cl->rlist.wall_bz[i]); - i++; - } - pthread_exit(0x0); - return (0x0); -} - -static void -*ft_wall_six(void *vargp) -{ - t_cub *cl; - uint16_t i; - - cl = (t_cub *)vargp; - i = 5 * (cl->wlist.x_size / 8); - while (i < 6 * (cl->wlist.x_size / 8)) - { - ft_draw_verline(cl, i, cl->rlist.wall_t_tab[i], cl->rlist.wall_bz[i]); - i++; - } - pthread_exit(0x0); - return (0x0); -} - -static void -*ft_wall_seven(void *vargp) -{ - t_cub *cl; - uint16_t i; - - cl = (t_cub *)vargp; - i = 6 * (cl->wlist.x_size / 8); - while (i < 7 * (cl->wlist.x_size / 8)) - { - ft_draw_verline(cl, i, cl->rlist.wall_t_tab[i], cl->rlist.wall_bz[i]); - i++; - } - pthread_exit(0x0); - return (0x0); -} - -static void -*ft_wall_eight(void *vargp) -{ - t_cub *cl; - uint16_t i; - - cl = (t_cub *)vargp; - i = 7 * (cl->wlist.x_size / 8); - while (i < cl->wlist.x_size) - { - ft_draw_verline(cl, i, cl->rlist.wall_t_tab[i], cl->rlist.wall_bz[i]); - i++; - } - pthread_exit(0x0); - return (0x0); -} +/* static void */ +/* *ft_wall_five(void *vargp) */ +/* { */ +/* t_cub *cl; */ +/* uint16_t i; */ + +/* cl = (t_cub *)vargp; */ +/* i = 4 * (cl->wlist.x_size / 8); */ +/* while (i < 5 * (cl->wlist.x_size / 8)) */ +/* { */ +/* ft_draw_verline(cl, i, cl->rlist.wall_t_tab[i], cl->rlist.wall_bz[i]); */ +/* i++; */ +/* } */ +/* pthread_exit(0x0); */ +/* return (0x0); */ +/* } */ + +/* static void */ +/* *ft_wall_six(void *vargp) */ +/* { */ +/* t_cub *cl; */ +/* uint16_t i; */ + +/* cl = (t_cub *)vargp; */ +/* i = 5 * (cl->wlist.x_size / 8); */ +/* while (i < 6 * (cl->wlist.x_size / 8)) */ +/* { */ +/* ft_draw_verline(cl, i, cl->rlist.wall_t_tab[i], cl->rlist.wall_bz[i]); */ +/* i++; */ +/* } */ +/* pthread_exit(0x0); */ +/* return (0x0); */ +/* } */ + +/* static void */ +/* *ft_wall_seven(void *vargp) */ +/* { */ +/* t_cub *cl; */ +/* uint16_t i; */ + +/* cl = (t_cub *)vargp; */ +/* i = 6 * (cl->wlist.x_size / 8); */ +/* while (i < 7 * (cl->wlist.x_size / 8)) */ +/* { */ +/* ft_draw_verline(cl, i, cl->rlist.wall_t_tab[i], cl->rlist.wall_bz[i]); */ +/* i++; */ +/* } */ +/* pthread_exit(0x0); */ +/* return (0x0); */ +/* } */ + +/* static void */ +/* *ft_wall_eight(void *vargp) */ +/* { */ +/* t_cub *cl; */ +/* uint16_t i; */ + +/* cl = (t_cub *)vargp; */ +/* i = 7 * (cl->wlist.x_size / 8); */ +/* while (i < cl->wlist.x_size) */ +/* { */ +/* ft_draw_verline(cl, i, cl->rlist.wall_t_tab[i], cl->rlist.wall_bz[i]); */ +/* i++; */ +/* } */ +/* pthread_exit(0x0); */ +/* return (0x0); */ +/* } */ void *ft_wall_cast(void *vargp) @@ -182,18 +182,18 @@ 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_create(&tid[4], 0x0, ft_wall_five, (void*)cl); - pthread_create(&tid[5], 0x0, ft_wall_six, (void*)cl); - pthread_create(&tid[6], 0x0, ft_wall_seven, (void*)cl); - pthread_create(&tid[7], 0x0, ft_wall_eight, (void*)cl); + /* pthread_create(&tid[4], 0x0, ft_wall_five, (void*)cl); */ + /* pthread_create(&tid[5], 0x0, ft_wall_six, (void*)cl); */ + /* pthread_create(&tid[6], 0x0, ft_wall_seven, (void*)cl); */ + /* pthread_create(&tid[7], 0x0, ft_wall_eight, (void*)cl); */ pthread_join(tid[0], 0x0); pthread_join(tid[1], 0x0); pthread_join(tid[2], 0x0); pthread_join(tid[3], 0x0); - pthread_join(tid[4], 0x0); - pthread_join(tid[5], 0x0); - pthread_join(tid[6], 0x0); - pthread_join(tid[7], 0x0); + /* pthread_join(tid[4], 0x0); */ + /* pthread_join(tid[5], 0x0); */ + /* pthread_join(tid[6], 0x0); */ + /* pthread_join(tid[7], 0x0); */ pthread_exit(0x0); return (0x0); } |