diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ft_draw_scene.c | 2 | ||||
-rw-r--r-- | src/ft_draw_sprite.c | 4 | ||||
-rw-r--r-- | src/ft_key_loop.c | 5 | ||||
-rw-r--r-- | src/ft_raycasting.c | 1 |
4 files changed, 8 insertions, 4 deletions
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 * |