diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2020-02-13 23:35:05 +0100 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2020-02-13 23:35:05 +0100 |
commit | b4825e7b78daf4953adfeba37fc48dba801f7d57 (patch) | |
tree | 27beb6c6349bb5b25bcd299e70780891acb174e3 | |
parent | Colors (diff) | |
download | 42-cub3d-b4825e7b78daf4953adfeba37fc48dba801f7d57.tar.gz 42-cub3d-b4825e7b78daf4953adfeba37fc48dba801f7d57.tar.bz2 42-cub3d-b4825e7b78daf4953adfeba37fc48dba801f7d57.tar.xz 42-cub3d-b4825e7b78daf4953adfeba37fc48dba801f7d57.tar.zst 42-cub3d-b4825e7b78daf4953adfeba37fc48dba801f7d57.zip |
Nice changes, secured segvs
-rw-r--r-- | map/map_one.cub | 2 | ||||
-rw-r--r-- | src/ft_detect.c | 7 | ||||
-rw-r--r-- | src/ft_draw_map.c | 2 |
3 files changed, 9 insertions, 2 deletions
diff --git a/map/map_one.cub b/map/map_one.cub index b6a98e0..fb74051 100644 --- a/map/map_one.cub +++ b/map/map_one.cub @@ -1,4 +1,4 @@ -R 1600 1000 +R 800 600 NO ./path_to_the_north_texture SO ./path_to_the_south_texture diff --git a/src/ft_detect.c b/src/ft_detect.c index 3dafd67..e91ca50 100644 --- a/src/ft_detect.c +++ b/src/ft_detect.c @@ -1,3 +1,4 @@ +#include <libft.h> #include <cub3d.h> #include <math.h> @@ -61,6 +62,12 @@ ft_detect(t_cub *cl) cl->rlist.sqy += cl->mlist->y_step; cl->rlist.side = 1; } + /* ft_printf("sqx [%zu]\t", cl->rlist.sqx); */ + /* ft_printf("sqy [%zu]\n", cl->rlist.sqy); */ + /* (cl->rlist.sqx == 0) ? (cl->rlist.sqx = 1) : 0; */ + /* (cl->rlist.sqy == 0) ? (cl->rlist.sqy = 1) : 0; */ + (cl->rlist.sqx >= cl->mlist->map_h) ? (cl->rlist.sqx = 1) : 0; + (cl->rlist.sqy >= cl->mlist->map_w) ? (cl->rlist.sqy = 1) : 0; if (cl->mlist->map[cl->rlist.sqx][cl->rlist.sqy] == '1') cl->rlist.hit = 1; } diff --git a/src/ft_draw_map.c b/src/ft_draw_map.c index 86865fa..da7ece2 100644 --- a/src/ft_draw_map.c +++ b/src/ft_draw_map.c @@ -5,7 +5,7 @@ static void ft_draw_player(t_player *plist, t_cub *clist) { const float x = plist->pos_x; - const float y = plist->pos_y - 1; + const float y = plist->pos_y; const uint16_t scale = clist->mlist->scale; ft_draw_square( |