From 4984514d2bab3b04790cba631dc7ef8bd8399eff Mon Sep 17 00:00:00 2001 From: salaaad2 Date: Wed, 19 Feb 2020 20:22:27 +0100 Subject: asdasdasd :^) --- src/ft_draw_verline.c | 2 ++ src/ft_get_player_spawn.c | 2 ++ src/ft_init_lists.c | 2 ++ 3 files changed, 6 insertions(+) (limited to 'src') diff --git a/src/ft_draw_verline.c b/src/ft_draw_verline.c index 6cbdc00..d144d87 100644 --- a/src/ft_draw_verline.c +++ b/src/ft_draw_verline.c @@ -53,9 +53,11 @@ int8_t d = (d <= 0) ? (-d) : (d); tex_y = ((d * cl->tlist[cl->w_side].img_h) / cl->rlist.line_h) / 256; (tex_y < 0) ? (tex_y = 0) : 0; + /*if (!(tex_x % 2))*/ ft_draw_texture(cl, x, y, tex_y); y++; } + /*printf("%d\n", cl->tlist[cl->w_side].tex_x);*/ ft_draw_floor(cl, y, x); return (0); } diff --git a/src/ft_get_player_spawn.c b/src/ft_get_player_spawn.c index f5d2c87..e1f313e 100644 --- a/src/ft_get_player_spawn.c +++ b/src/ft_get_player_spawn.c @@ -84,6 +84,8 @@ void { plist->pos_x = x + 0.5; plist->pos_y = y + 0.5; + plist->start_x = plist->pos_x; + plist->start_y = plist->pos_y; ft_get_start_side(clist->mlist->map[y][x], clist->plist); return ; } diff --git a/src/ft_init_lists.c b/src/ft_init_lists.c index b8d7c7c..6917db2 100644 --- a/src/ft_init_lists.c +++ b/src/ft_init_lists.c @@ -38,6 +38,8 @@ static t_player return (NULL); plist->pos_x = 0; plist->pos_y = 0; + plist->start_x = 0; + plist->start_y = 0; plist->cam_x = 0; plist->dir_x = -1; plist->dir_y = 0; -- cgit v1.2.3 From 31b823d11a48c7d425b0432a1a53a378bb5239f3 Mon Sep 17 00:00:00 2001 From: salaaad2 Date: Thu, 20 Feb 2020 03:37:05 +0100 Subject: :^)))))))))))))))))))))))))))) --- src/ft_raycasting.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/ft_raycasting.c b/src/ft_raycasting.c index 394d6dc..1ad16e1 100644 --- a/src/ft_raycasting.c +++ b/src/ft_raycasting.c @@ -13,6 +13,7 @@ #include #include #include +#include #include void @@ -33,6 +34,7 @@ void if (clist->rlist.side == 1 && clist->rlist.y_ray_dir < 0) clist->tlist[clist->w_side].tex_x = clist->tlist[clist->w_side].img_w - clist->tlist[clist->w_side].tex_x - 1; + printf("dir :%f\ntex_x : %d\n", clist->rlist.y_ray_dir, clist->tlist[clist->w_side].tex_x); } static void -- cgit v1.2.3 From 2082e311ed02aac56a0eeb0b8b610b3ab2dc2518 Mon Sep 17 00:00:00 2001 From: salaaad2 Date: Thu, 20 Feb 2020 04:23:50 +0100 Subject: asd works cool --- src/ft_draw_textures.c | 1 - src/ft_draw_verline.c | 3 --- src/ft_raycasting.c | 8 +++----- 3 files changed, 3 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/ft_draw_textures.c b/src/ft_draw_textures.c index 25a6863..0c86043 100644 --- a/src/ft_draw_textures.c +++ b/src/ft_draw_textures.c @@ -13,7 +13,6 @@ #include #include #include -#include /* ** 0 : no diff --git a/src/ft_draw_verline.c b/src/ft_draw_verline.c index d144d87..d526b6a 100644 --- a/src/ft_draw_verline.c +++ b/src/ft_draw_verline.c @@ -11,7 +11,6 @@ /* ************************************************************************** */ #include -#include static void ft_draw_floor(t_cub *cl, int32_t y, int32_t x) @@ -53,11 +52,9 @@ int8_t d = (d <= 0) ? (-d) : (d); tex_y = ((d * cl->tlist[cl->w_side].img_h) / cl->rlist.line_h) / 256; (tex_y < 0) ? (tex_y = 0) : 0; - /*if (!(tex_x % 2))*/ ft_draw_texture(cl, x, y, tex_y); y++; } - /*printf("%d\n", cl->tlist[cl->w_side].tex_x);*/ ft_draw_floor(cl, y, x); return (0); } diff --git a/src/ft_raycasting.c b/src/ft_raycasting.c index 1ad16e1..0c00a87 100644 --- a/src/ft_raycasting.c +++ b/src/ft_raycasting.c @@ -13,17 +13,16 @@ #include #include #include -#include #include void ft_calc_tex(t_cub *clist) { if (clist->rlist.side == 0) - clist->rlist.wall_hit_x = clist->plist->pos_y + + clist->rlist.wall_hit_x = (clist->plist->pos_x - clist->plist->start_x) + clist->rlist.wall_dist * clist->rlist.y_ray_dir; else - clist->rlist.wall_hit_x = clist->plist->pos_x + + clist->rlist.wall_hit_x = (clist->plist->pos_y - clist->plist->start_y) + clist->rlist.wall_dist * clist->rlist.x_ray_dir; clist->rlist.wall_hit_x -= floor(clist->rlist.wall_hit_x); clist->tlist[clist->w_side].tex_x = (int)(clist->rlist.wall_hit_x * @@ -31,10 +30,9 @@ void if (clist->rlist.side == 0 && clist->rlist.x_ray_dir > 0) clist->tlist[clist->w_side].tex_x = clist->tlist[clist->w_side].img_w - clist->tlist[clist->w_side].tex_x - 1; - if (clist->rlist.side == 1 && clist->rlist.y_ray_dir < 0) + else if (clist->rlist.side == 1 && clist->rlist.y_ray_dir < 0) clist->tlist[clist->w_side].tex_x = clist->tlist[clist->w_side].img_w - clist->tlist[clist->w_side].tex_x - 1; - printf("dir :%f\ntex_x : %d\n", clist->rlist.y_ray_dir, clist->tlist[clist->w_side].tex_x); } static void -- cgit v1.2.3