aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-04-06 14:19:19 +0200
committerJozanLeClerc <bousset.rudy@gmail.com>2020-04-06 14:19:19 +0200
commit2cff17cc2159f87009d2d4e41e4931155361dd11 (patch)
treeb876f837c8b602e342acbadbd1fc73f81e3af91f /src
parentConsitent heals (diff)
download42-cub3d-2cff17cc2159f87009d2d4e41e4931155361dd11.tar.gz
42-cub3d-2cff17cc2159f87009d2d4e41e4931155361dd11.tar.bz2
42-cub3d-2cff17cc2159f87009d2d4e41e4931155361dd11.tar.xz
42-cub3d-2cff17cc2159f87009d2d4e41e4931155361dd11.tar.zst
42-cub3d-2cff17cc2159f87009d2d4e41e4931155361dd11.zip
I think it's fixed
Diffstat (limited to 'src')
-rw-r--r--src/ft_draw_sprite_extra.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/ft_draw_sprite_extra.c b/src/ft_draw_sprite_extra.c
index 00e295e..81b299d 100644
--- a/src/ft_draw_sprite_extra.c
+++ b/src/ft_draw_sprite_extra.c
@@ -13,6 +13,7 @@
#include <cub3d.h>
#include <stdint.h>
#include <stdlib.h>
+#include <math.h>
void
ft_sprite_h_w(t_cub *cl, t_sprite *sprite)
@@ -49,6 +50,7 @@ static void
(1 + sprite->transformx / sprite->transformy);
}
+#include <stdio.h>
void
ft_calc_sprite(t_cub *cl)
{
@@ -60,6 +62,9 @@ void
while (++i < cl->big_t_val)
{
sprite = cl->sprites[(int8_t)cl->big_t[i][2]][(int32_t)cl->big_t[i][3]];
+ if (((cl->plist.pos_x > sprite.s_pos_x - 0.01 && cl->plist.pos_x < sprite.s_pos_x + 0.99) &&
+ (cl->plist.pos_y > sprite.s_pos_y - 0.01 && cl->plist.pos_y < sprite.s_pos_y + 0.99)))
+ return ;
if (sprite.s_pos_x != 0)
{
sprite.current_sprite = (int8_t)cl->big_t[i][1];