diff options
author | salaaad2 <arthudurant263@gmail.com> | 2020-02-25 18:09:57 +0100 |
---|---|---|
committer | salaaad2 <arthudurant263@gmail.com> | 2020-02-25 18:09:57 +0100 |
commit | 3f8b598e0a1b60475fdf8aa98c601b4513a24efa (patch) | |
tree | cdaee1e850e0b3a5d790ee4ccf07f33a5778d637 | |
parent | ??? (diff) | |
download | 42-cub3d-3f8b598e0a1b60475fdf8aa98c601b4513a24efa.tar.gz 42-cub3d-3f8b598e0a1b60475fdf8aa98c601b4513a24efa.tar.bz2 42-cub3d-3f8b598e0a1b60475fdf8aa98c601b4513a24efa.tar.xz 42-cub3d-3f8b598e0a1b60475fdf8aa98c601b4513a24efa.tar.zst 42-cub3d-3f8b598e0a1b60475fdf8aa98c601b4513a24efa.zip |
gee
-rw-r--r-- | map/map_one.cub | 4 | ||||
-rw-r--r-- | src/ft_draw_scene.c | 2 | ||||
-rw-r--r-- | src/ft_draw_sprite.c | 8 | ||||
-rw-r--r-- | src/ft_raycasting.c | 1 |
4 files changed, 8 insertions, 7 deletions
diff --git a/map/map_one.cub b/map/map_one.cub index 5a322c2..3f5eb59 100644 --- a/map/map_one.cub +++ b/map/map_one.cub @@ -1,4 +1,4 @@ -R 1400 900 +R 1000 700 NO ./media/img/BRIQUASSES.xpm SO ./media/img/BRIQUASSE_3.xpm @@ -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 2 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 1 +1 0 0 0 0 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 0df3596..3f43495 100644 --- a/src/ft_draw_scene.c +++ b/src/ft_draw_scene.c @@ -22,8 +22,8 @@ void clist->wlist->x_size, clist->wlist->y_size); clist->img.ptr = mlx_get_data_addr(clist->img.img, &clist->img.bpp, &clist->img.sizeline, &clist->img.endian); - ft_calc_sprite(clist); ft_castray(clist); + ft_calc_sprite(clist); if (clist->ishud) ft_draw_hud(clist); mlx_put_image_to_window(clist->wlist->wlx, diff --git a/src/ft_draw_sprite.c b/src/ft_draw_sprite.c index 03d3ca7..701587f 100644 --- a/src/ft_draw_sprite.c +++ b/src/ft_draw_sprite.c @@ -21,6 +21,7 @@ void ft_draw_sprite(t_cub *cl, t_sprite *sprite) { int32_t d; + sprite->x = sprite->drawstartx; while (sprite->x < sprite->drawendx) { @@ -31,14 +32,15 @@ void sprite->x < (int32_t)cl->wlist->x_size) while (sprite->y < sprite->drawendy) { + puts("qwe"); d = (sprite->y) * 256 - cl->wlist->y_size * 128 + sprite->spriteheight * 128; sprite->tex_y = ((d * cl->tlist[4].img_h) / - sprite->spriteheight) / 256; + sprite->spriteheight) / 128; if (*(cl->tlist[4].ptr + sprite->tex_x + sprite->tex_y * cl->tlist[4].sizeline / 4)) - *(cl->img.ptr + sprite->x + sprite->y * - cl->img.sizeline / 4) = + cl->img.ptr[sprite->x + sprite->y * + cl->img.sizeline / 4] = *(cl->tlist[4].ptr + sprite->tex_x + sprite->tex_y * cl->tlist[4].sizeline / 4); sprite->y++; } diff --git a/src/ft_raycasting.c b/src/ft_raycasting.c index d97c231..59021d3 100644 --- a/src/ft_raycasting.c +++ b/src/ft_raycasting.c @@ -130,7 +130,6 @@ ft_castray(t_cub *cl) cl->rlist.wall_b = wl->y_size - 1; ft_choose_tex(cl); ft_calc_tex(cl); - ft_calc_sprite(cl); ft_draw_verline(cl, i, cl->rlist.wall_t, cl->rlist.wall_b); i++; } |