From 8f852afcfa170070b6f0ac2e321546990d87e401 Mon Sep 17 00:00:00 2001 From: salaaad2 Date: Fri, 28 Feb 2020 15:30:53 +0100 Subject: gang --- map/map_one.cub | 2 +- src/ft_draw_scene.c | 2 +- src/ft_draw_sprite.c | 4 ++-- src/ft_key_loop.c | 5 ++++- src/ft_raycasting.c | 1 + 5 files changed, 9 insertions(+), 5 deletions(-) diff --git a/map/map_one.cub b/map/map_one.cub index 3f5eb59..a2d9329 100644 --- a/map/map_one.cub +++ b/map/map_one.cub @@ -10,7 +10,7 @@ C 50,100,200 F 50,190,124 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -1 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 1 +1 2 2 2 2 0 0 0 0 0 1 1 0 0 0 0 0 1 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 N 1 1 0 0 0 0 0 1 1 1 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 1 1 diff --git a/src/ft_draw_scene.c b/src/ft_draw_scene.c index 3f43495..f974d42 100644 --- a/src/ft_draw_scene.c +++ b/src/ft_draw_scene.c @@ -23,9 +23,9 @@ void clist->img.ptr = mlx_get_data_addr(clist->img.img, &clist->img.bpp, &clist->img.sizeline, &clist->img.endian); ft_castray(clist); - ft_calc_sprite(clist); if (clist->ishud) ft_draw_hud(clist); + ft_calc_sprite(clist); mlx_put_image_to_window(clist->wlist->wlx, clist->wlist->winptr, clist->img.img, 0, 0); mlx_destroy_image(clist->wlist->wlx, clist->img.img); diff --git a/src/ft_draw_sprite.c b/src/ft_draw_sprite.c index 875e527..0430e2f 100644 --- a/src/ft_draw_sprite.c +++ b/src/ft_draw_sprite.c @@ -22,7 +22,7 @@ void { int32_t d; - printf("start x : %d\nstart y : %d\nend x : %d\nend y : %d\n", sprite->drawstartx, sprite->drawstarty, sprite->drawendy, sprite->drawendy); + /* printf("start x : %d\nstart y : %d\nend x : %d\nend y : %d\n", sprite->drawstartx, sprite->drawstarty, sprite->drawendy, sprite->drawendy); */ sprite->x = sprite->drawstartx; while (sprite->x < sprite->drawendx) { @@ -37,7 +37,7 @@ void sprite->spriteheight * 128; sprite->tex_y = ((d * cl->tlist[4].img_h / 2) / sprite->spriteheight) / 128; - if (cl->tlist[4].ptr[sprite->tex_x * 4 + 4 * cl->tlist[4].img_h * sprite->tex_y] != (char)0) + if (cl->tlist[4].ptr[sprite->tex_x * 4 + 4 * cl->tlist[4].img_h * sprite->tex_y]) { cl->img.ptr[sprite->x * 4 + (sprite->y * cl->img.sizeline)] = diff --git a/src/ft_key_loop.c b/src/ft_key_loop.c index d92b37e..d913c49 100644 --- a/src/ft_key_loop.c +++ b/src/ft_key_loop.c @@ -42,6 +42,9 @@ int ft_collision(old_y, old_x, cl->plist, cl->mlist); i++; } - ft_draw_scene(cl); + if (cl->key_input[0] != -1) + { + ft_draw_scene(cl); + } return (0); } diff --git a/src/ft_raycasting.c b/src/ft_raycasting.c index e7cc4ef..0173fe6 100644 --- a/src/ft_raycasting.c +++ b/src/ft_raycasting.c @@ -49,6 +49,7 @@ void sprite = cl->sprites; sprite.spritex = (sprite.spritex + 1) - cl->plist->pos_x; sprite.spritey = (sprite.spritey + 1) - cl->plist->pos_y; + printf("%f%f\n", sprite.spritex, sprite.spritey); sprite.invdet = 1.0 / (cl->plist->plane_x * cl->plist->dir_y - cl->plist->dir_x * cl->plist->plane_y); sprite.transformx = sprite.invdet * (cl->plist->dir_y * -- cgit v1.2.3