diff options
author | Rudy Bousset <rbousset@z2r5p6.le-101.fr> | 2020-02-14 18:47:19 +0100 |
---|---|---|
committer | Rudy Bousset <rbousset@z2r5p6.le-101.fr> | 2020-02-14 18:47:19 +0100 |
commit | 8e6080e73661cc8747b21b1153e4336796575cf7 (patch) | |
tree | 2eaec487a73f9df1a69627cff23c42746f1b296e /src | |
parent | Added turn around keys (diff) | |
download | 42-cub3d-8e6080e73661cc8747b21b1153e4336796575cf7.tar.gz 42-cub3d-8e6080e73661cc8747b21b1153e4336796575cf7.tar.bz2 42-cub3d-8e6080e73661cc8747b21b1153e4336796575cf7.tar.xz 42-cub3d-8e6080e73661cc8747b21b1153e4336796575cf7.tar.zst 42-cub3d-8e6080e73661cc8747b21b1153e4336796575cf7.zip |
Norme is bav
Diffstat (limited to '')
33 files changed, 406 insertions, 320 deletions
diff --git a/src/ft_basic_keys.c b/src/ft_basic_keys.c new file mode 100644 index 0000000..48fc009 --- /dev/null +++ b/src/ft_basic_keys.c @@ -0,0 +1,55 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_basic_keys.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rbousset <marvin@42.fr> +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/02/14 17:43:55 by rbousset #+# #+# */ +/* Updated: 2020/02/14 17:43:56 by rbousset ### ########lyon.fr */ +/* */ +/* ************************************************************************** */ + +#include <cub3d.h> +#include <stdint.h> + +int + ft_w_key(t_cub *clist) +{ + t_player *pl; + + pl = clist->plist; + pl->pos_y += 0.2 * (-1); + pl->pos_x += 0; + return (0); +} + +int + ft_a_key(t_cub *clist) +{ + t_player *pl; + + pl = clist->plist; + pl->pos_x -= 0.2; + return (0); +} + +int + ft_s_key(t_cub *clist) +{ + t_player *pl; + + pl = clist->plist; + pl->pos_y += 0.2; + return (0); +} + +int + ft_d_key(t_cub *clist) +{ + t_player *pl; + + pl = clist->plist; + pl->pos_x += 0.2; + return (0); +} diff --git a/src/ft_check_map_line.c b/src/ft_check_map_line.c index a53c9c8..9e4e484 100644 --- a/src/ft_check_map_line.c +++ b/src/ft_check_map_line.c @@ -1,14 +1,13 @@ /* ************************************************************************** */ -/* LE - / */ -/* / */ -/* ft_check_map_line.c .:: .:/ . .:: */ -/* +:+:+ +: +: +:+:+ */ -/* By: rbousset <marvin@le-101.fr> +:+ +: +: +:+ */ -/* #+# #+ #+ #+# */ -/* Created: 2020/02/02 17:19:10 by rbousset #+# ## ## #+# */ -/* Updated: 2020/02/02 17:19:11 by rbousset ### #+. /#+ ###.fr */ -/* / */ -/* / */ +/* */ +/* ::: :::::::: */ +/* ft_check_map_line.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rbousset <marvin@42.fr> +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/02/14 17:28:34 by rbousset #+# #+# */ +/* Updated: 2020/02/14 17:28:37 by rbousset ### ########lyon.fr */ +/* */ /* ************************************************************************** */ #include <libft.h> diff --git a/src/ft_check_missing.c b/src/ft_check_missing.c index 58ef223..12da7ad 100644 --- a/src/ft_check_missing.c +++ b/src/ft_check_missing.c @@ -1,14 +1,13 @@ /* ************************************************************************** */ -/* LE - / */ -/* / */ -/* ft_check_missing.c .:: .:/ . .:: */ -/* +:+:+ +: +: +:+:+ */ -/* By: rbousset <marvin@le-101.fr> +:+ +: +: +:+ */ -/* #+# #+ #+ #+# */ -/* Created: 2020/02/02 17:19:12 by rbousset #+# ## ## #+# */ -/* Updated: 2020/02/02 17:19:13 by rbousset ### #+. /#+ ###.fr */ -/* / */ -/* / */ +/* */ +/* ::: :::::::: */ +/* ft_check_missing.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rbousset <marvin@42.fr> +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/02/14 17:28:42 by rbousset #+# #+# */ +/* Updated: 2020/02/14 17:28:42 by rbousset ### ########lyon.fr */ +/* */ /* ************************************************************************** */ #include <libft.h> diff --git a/src/ft_click_close.c b/src/ft_click_close.c index db3b2e2..6c876ea 100644 --- a/src/ft_click_close.c +++ b/src/ft_click_close.c @@ -1,14 +1,13 @@ /* ************************************************************************** */ -/* LE - / */ -/* / */ -/* ft_click_close.c .:: .:/ . .:: */ -/* +:+:+ +: +: +:+:+ */ -/* By: rbousset <marvin@le-101.fr> +:+ +: +: +:+ */ -/* #+# #+ #+ #+# */ -/* Created: 2020/02/09 15:12:16 by rbousset #+# ## ## #+# */ -/* Updated: 2020/02/09 15:12:17 by rbousset ### #+. /#+ ###.fr */ -/* / */ -/* / */ +/* */ +/* ::: :::::::: */ +/* ft_click_close.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rbousset <marvin@42.fr> +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/02/14 17:28:46 by rbousset #+# #+# */ +/* Updated: 2020/02/14 17:28:46 by rbousset ### ########lyon.fr */ +/* */ /* ************************************************************************** */ #include <libft.h> diff --git a/src/ft_detect.c b/src/ft_detect.c index 7153123..bfc4449 100644 --- a/src/ft_detect.c +++ b/src/ft_detect.c @@ -1,9 +1,21 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_detect.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rbousset <marvin@42.fr> +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/02/14 17:22:11 by rbousset #+# #+# */ +/* Updated: 2020/02/14 17:23:42 by rbousset ### ########lyon.fr */ +/* */ +/* ************************************************************************** */ + #include <libft.h> #include <cub3d.h> #include <math.h> static void -ft_detection_init_y(t_cub *cl) + ft_detection_init_y(t_cub *cl) { cl->rlist.y_delta_dist = sqrt(1 + (cl->rlist.x_ray_dir * cl->rlist.x_ray_dir) / (cl->rlist.y_ray_dir * @@ -23,7 +35,7 @@ ft_detection_init_y(t_cub *cl) } static void -ft_detection_init_x(t_cub *cl) + ft_detection_init_x(t_cub *cl) { cl->rlist.x_delta_dist = sqrt(1 + (cl->rlist.y_ray_dir * cl->rlist.y_ray_dir) / (cl->rlist.x_ray_dir * @@ -44,10 +56,10 @@ ft_detection_init_x(t_cub *cl) } void -ft_detect(t_cub *cl) + ft_detect(t_cub *cl) { ft_detection_init_x(cl); - cl->rlist.hit = 0; + cl->rlist.hit = 0; while (cl->rlist.hit == 0) { if (cl->rlist.x_side_dist < cl->rlist.y_side_dist) diff --git a/src/ft_draw_map.c b/src/ft_draw_map.c index da7ece2..202439b 100644 --- a/src/ft_draw_map.c +++ b/src/ft_draw_map.c @@ -1,3 +1,15 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_draw_map.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rbousset <marvin@42.fr> +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/02/14 17:22:18 by rbousset #+# #+# */ +/* Updated: 2020/02/14 17:23:42 by rbousset ### ########lyon.fr */ +/* */ +/* ************************************************************************** */ + #include <cub3d.h> #include <stdint.h> @@ -30,7 +42,7 @@ void { if (map[y][x] == '1') ft_draw_square(scale + (x * (scale)), - scale + (y * (scale)), 0x00aa99aa, clist); + scale + (y * (scale)), 0x0000ffaa, clist); else if (map[y][x] == '2') ft_draw_square(scale + (x * (scale)), scale + (y * (scale)), 0x0033ccff, clist); diff --git a/src/ft_draw_scene.c b/src/ft_draw_scene.c index 6043a55..ec2cc89 100644 --- a/src/ft_draw_scene.c +++ b/src/ft_draw_scene.c @@ -1,14 +1,13 @@ /* ************************************************************************** */ -/* LE - / */ -/* / */ -/* ft_drawmap.c .:: .:/ . .:: */ -/* +:+:+ +: +: +:+:+ */ -/* By: rbousset <marvin@le-101.fr> +:+ +: +: +:+ */ -/* #+# #+ #+ #+# */ -/* Created: 2020/02/02 17:19:18 by rbousset #+# ## ## #+# */ -/* Updated: 2020/02/02 17:19:19 by rbousset ### #+. /#+ ###.fr */ -/* / */ -/* / */ +/* */ +/* ::: :::::::: */ +/* ft_draw_scene.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rbousset <marvin@42.fr> +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/02/14 17:28:46 by rbousset #+# #+# */ +/* Updated: 2020/02/14 17:28:46 by rbousset ### ########lyon.fr */ +/* */ /* ************************************************************************** */ #include <libft.h> @@ -21,9 +20,9 @@ void { mlx_clear_window(clist->wlist->wlx, clist->wlist->winptr); clist->img.img = mlx_new_image(clist->wlist->wlx, - clist->wlist->x_size, clist->wlist->y_size); + 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); + &clist->img.sizeline, &clist->img.endian); ft_castray(clist); if (clist->minimap) ft_draw_map(clist->mlist->map, clist); diff --git a/src/ft_draw_square.c b/src/ft_draw_square.c index 9f9af56..8bbce36 100644 --- a/src/ft_draw_square.c +++ b/src/ft_draw_square.c @@ -1,14 +1,13 @@ /* ************************************************************************** */ -/* LE - / */ -/* / */ -/* ft_drawsquare.c .:: .:/ . .:: */ -/* +:+:+ +: +: +:+:+ */ -/* By: rbousset <marvin@le-101.fr> +:+ +: +: +:+ */ -/* #+# #+ #+ #+# */ -/* Created: 2020/02/02 17:19:22 by rbousset #+# ## ## #+# */ -/* Updated: 2020/02/02 17:19:22 by rbousset ### #+. /#+ ###.fr */ -/* / */ -/* / */ +/* */ +/* ::: :::::::: */ +/* ft_draw_square.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rbousset <marvin@42.fr> +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/02/14 17:28:46 by rbousset #+# #+# */ +/* Updated: 2020/02/14 17:28:46 by rbousset ### ########lyon.fr */ +/* */ /* ************************************************************************** */ #include <cub3d.h> diff --git a/src/ft_draw_verline.c b/src/ft_draw_verline.c index f7e5a1c..6584bcb 100644 --- a/src/ft_draw_verline.c +++ b/src/ft_draw_verline.c @@ -1,7 +1,19 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_draw_verline.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rbousset <marvin@42.fr> +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/02/14 17:22:23 by rbousset #+# #+# */ +/* Updated: 2020/02/14 17:23:42 by rbousset ### ########lyon.fr */ +/* */ +/* ************************************************************************** */ + #include <cub3d.h> static void -ft_draw_floor(t_cub *cl, int32_t y, int32_t x) + ft_draw_floor(t_cub *cl, int32_t y, int32_t x) { while (y <= cl->wlist->y_size) { @@ -12,7 +24,7 @@ ft_draw_floor(t_cub *cl, int32_t y, int32_t x) } static void -ft_draw_ceil(t_cub *cl, int32_t y, int32_t x) + ft_draw_ceil(t_cub *cl, int32_t y, int32_t x) { int16_t i; @@ -26,7 +38,7 @@ ft_draw_ceil(t_cub *cl, int32_t y, int32_t x) } int8_t -ft_draw_verline(t_cub *cl, int32_t x, int32_t y1, int32_t y2, int32_t color) + ft_draw_verline(t_cub *cl, int32_t x, int32_t y1, int32_t y2) { int32_t y; int32_t t; @@ -47,7 +59,7 @@ ft_draw_verline(t_cub *cl, int32_t x, int32_t y1, int32_t y2, int32_t color) ft_draw_ceil(cl, y, x); while (y <= y2) { - *(int*)(cl->img.ptr + (x * 4 + (y * cl->img.sizeline))) = color; + *(int*)(cl->img.ptr + (x * 4 + (y * cl->img.sizeline))) = 0x0000ffaa; y++; } ft_draw_floor(cl, y, x); diff --git a/src/ft_exit.c b/src/ft_exit.c index 8ada2e4..d4b69ba 100644 --- a/src/ft_exit.c +++ b/src/ft_exit.c @@ -1,14 +1,13 @@ /* ************************************************************************** */ -/* LE - / */ -/* / */ -/* ft_exit.c .:: .:/ . .:: */ -/* +:+:+ +: +: +:+:+ */ -/* By: rbousset <marvin@le-101.fr> +:+ +: +: +:+ */ -/* #+# #+ #+ #+# */ -/* Created: 2020/02/02 17:19:23 by rbousset #+# ## ## #+# */ -/* Updated: 2020/02/02 17:19:23 by rbousset ### #+. /#+ ###.fr */ -/* / */ -/* / */ +/* */ +/* ::: :::::::: */ +/* ft_exit.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rbousset <marvin@42.fr> +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/02/14 17:28:46 by rbousset #+# #+# */ +/* Updated: 2020/02/14 17:28:46 by rbousset ### ########lyon.fr */ +/* */ /* ************************************************************************** */ #include <libft.h> diff --git a/src/ft_extra_keys.c b/src/ft_extra_keys.c index c920b48..3ca8fd8 100644 --- a/src/ft_extra_keys.c +++ b/src/ft_extra_keys.c @@ -1,8 +1,20 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_extra_keys.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rbousset <marvin@42.fr> +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/02/14 17:22:32 by rbousset #+# #+# */ +/* Updated: 2020/02/14 17:23:42 by rbousset ### ########lyon.fr */ +/* */ +/* ************************************************************************** */ + #include <cub3d.h> #include <stdint.h> #include <math.h> -int8_t +int ft_left_key(t_cub *clist) { t_player *pl; @@ -21,7 +33,7 @@ int8_t return (0); } -int8_t +int ft_right_key(t_cub *clist) { t_player *pl; @@ -40,7 +52,7 @@ int8_t return (0); } -int8_t +int ft_f1_key(t_cub *clist) { if (clist->minimap == 0) diff --git a/src/ft_free_words.c b/src/ft_free_words.c index de52244..598a7ac 100644 --- a/src/ft_free_words.c +++ b/src/ft_free_words.c @@ -1,14 +1,13 @@ /* ************************************************************************** */ -/* LE - / */ -/* / */ -/* ft_free_words.c .:: .:/ . .:: */ -/* +:+:+ +: +: +:+:+ */ -/* By: rbousset <marvin@le-101.fr> +:+ +: +: +:+ */ -/* #+# #+ #+ #+# */ -/* Created: 2020/02/02 17:19:24 by rbousset #+# ## ## #+# */ -/* Updated: 2020/02/02 17:19:24 by rbousset ### #+. /#+ ###.fr */ -/* / */ -/* / */ +/* */ +/* ::: :::::::: */ +/* ft_free_words.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rbousset <marvin@42.fr> +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/02/14 17:28:47 by rbousset #+# #+# */ +/* Updated: 2020/02/14 17:28:47 by rbousset ### ########lyon.fr */ +/* */ /* ************************************************************************** */ #include <libft.h> diff --git a/src/ft_get_colors.c b/src/ft_get_colors.c index 52461ea..869dd71 100644 --- a/src/ft_get_colors.c +++ b/src/ft_get_colors.c @@ -1,14 +1,13 @@ /* ************************************************************************** */ -/* LE - / */ -/* / */ -/* ft_get_colors.c .:: .:/ . .:: */ -/* +:+:+ +: +: +:+:+ */ -/* By: rbousset <marvin@le-101.fr> +:+ +: +: +:+ */ -/* #+# #+ #+ #+# */ -/* Created: 2020/02/02 17:19:25 by rbousset #+# ## ## #+# */ -/* Updated: 2020/02/02 17:19:25 by rbousset ### #+. /#+ ###.fr */ -/* / */ -/* / */ +/* */ +/* ::: :::::::: */ +/* ft_get_colors.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rbousset <marvin@42.fr> +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/02/14 17:28:47 by rbousset #+# #+# */ +/* Updated: 2020/02/14 17:28:47 by rbousset ### ########lyon.fr */ +/* */ /* ************************************************************************** */ #include <libft.h> diff --git a/src/ft_get_map.c b/src/ft_get_map.c index 9148964..ee23c7a 100644 --- a/src/ft_get_map.c +++ b/src/ft_get_map.c @@ -1,14 +1,13 @@ /* ************************************************************************** */ -/* LE - / */ -/* / */ -/* ft_get_map.c .:: .:/ . .:: */ -/* +:+:+ +: +: +:+:+ */ -/* By: rbousset <marvin@le-101.fr> +:+ +: +: +:+ */ -/* #+# #+ #+ #+# */ -/* Created: 2020/02/02 17:19:26 by rbousset #+# ## ## #+# */ -/* Updated: 2020/02/02 17:19:26 by rbousset ### #+. /#+ ###.fr */ -/* / */ -/* / */ +/* */ +/* ::: :::::::: */ +/* ft_get_map.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rbousset <marvin@42.fr> +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/02/14 17:28:47 by rbousset #+# #+# */ +/* Updated: 2020/02/14 17:28:47 by rbousset ### ########lyon.fr */ +/* */ /* ************************************************************************** */ #include <libft.h> diff --git a/src/ft_get_player_spawn.c b/src/ft_get_player_spawn.c index b803f25..74e2231 100644 --- a/src/ft_get_player_spawn.c +++ b/src/ft_get_player_spawn.c @@ -1,14 +1,13 @@ /* ************************************************************************** */ -/* LE - / */ -/* / */ -/* ft_get_player_spawn.c .:: .:/ . .:: */ -/* +:+:+ +: +: +:+:+ */ -/* By: rbousset <marvin@le-101.fr> +:+ +: +: +:+ */ -/* #+# #+ #+ #+# */ -/* Created: 2020/02/02 19:07:18 by rbousset #+# ## ## #+# */ -/* Updated: 2020/02/02 19:07:19 by rbousset ### #+. /#+ ###.fr */ -/* / */ -/* / */ +/* */ +/* ::: :::::::: */ +/* ft_get_player_spawn.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rbousset <marvin@42.fr> +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/02/14 17:28:47 by rbousset #+# #+# */ +/* Updated: 2020/02/14 17:28:47 by rbousset ### ########lyon.fr */ +/* */ /* ************************************************************************** */ #include <libft.h> diff --git a/src/ft_get_res.c b/src/ft_get_res.c index 5e3dc06..86a3186 100644 --- a/src/ft_get_res.c +++ b/src/ft_get_res.c @@ -1,14 +1,13 @@ /* ************************************************************************** */ -/* LE - / */ -/* / */ -/* ft_get_res.c .:: .:/ . .:: */ -/* +:+:+ +: +: +:+:+ */ -/* By: rbousset <marvin@le-101.fr> +:+ +: +: +:+ */ -/* #+# #+ #+ #+# */ -/* Created: 2020/02/02 17:19:27 by rbousset #+# ## ## #+# */ -/* Updated: 2020/02/02 17:19:27 by rbousset ### #+. /#+ ###.fr */ -/* / */ -/* / */ +/* */ +/* ::: :::::::: */ +/* ft_get_res.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rbousset <marvin@42.fr> +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/02/14 17:28:47 by rbousset #+# #+# */ +/* Updated: 2020/02/14 17:28:47 by rbousset ### ########lyon.fr */ +/* */ /* ************************************************************************** */ #include <libft.h> diff --git a/src/ft_get_screen_size.c b/src/ft_get_screen_size.c index a580a77..fe368c4 100644 --- a/src/ft_get_screen_size.c +++ b/src/ft_get_screen_size.c @@ -1,14 +1,13 @@ /* ************************************************************************** */ -/* LE - / */ -/* / */ -/* ft_get_screen_size.c .:: .:/ . .:: */ -/* +:+:+ +: +: +:+:+ */ -/* By: rbousset <marvin@le-101.fr> +:+ +: +: +:+ */ -/* #+# #+ #+ #+# */ -/* Created: 2020/02/05 16:06:58 by rbousset #+# ## ## #+# */ -/* Updated: 2020/02/05 16:06:59 by rbousset ### #+. /#+ ###.fr */ -/* / */ -/* / */ +/* */ +/* ::: :::::::: */ +/* ft_get_screen_size.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rbousset <marvin@42.fr> +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/02/14 17:28:47 by rbousset #+# #+# */ +/* Updated: 2020/02/14 17:28:47 by rbousset ### ########lyon.fr */ +/* */ /* ************************************************************************** */ #include <libft.h> diff --git a/src/ft_get_sprite.c b/src/ft_get_sprite.c index c63c357..cdea85c 100644 --- a/src/ft_get_sprite.c +++ b/src/ft_get_sprite.c @@ -1,14 +1,13 @@ /* ************************************************************************** */ -/* LE - / */ -/* / */ -/* ft_get_sprite.c .:: .:/ . .:: */ -/* +:+:+ +: +: +:+:+ */ -/* By: rbousset <marvin@le-101.fr> +:+ +: +: +:+ */ -/* #+# #+ #+ #+# */ -/* Created: 2020/02/02 17:19:27 by rbousset #+# ## ## #+# */ -/* Updated: 2020/02/02 17:19:27 by rbousset ### #+. /#+ ###.fr */ -/* / */ -/* / */ +/* */ +/* ::: :::::::: */ +/* ft_get_sprite.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rbousset <marvin@42.fr> +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/02/14 17:28:51 by rbousset #+# #+# */ +/* Updated: 2020/02/14 17:28:51 by rbousset ### ########lyon.fr */ +/* */ /* ************************************************************************** */ #include <libft.h> diff --git a/src/ft_get_tex.c b/src/ft_get_tex.c index 30b360a..1965e72 100644 --- a/src/ft_get_tex.c +++ b/src/ft_get_tex.c @@ -1,14 +1,13 @@ /* ************************************************************************** */ -/* LE - / */ -/* / */ -/* ft_get_tex.c .:: .:/ . .:: */ -/* +:+:+ +: +: +:+:+ */ -/* By: rbousset <marvin@le-101.fr> +:+ +: +: +:+ */ -/* #+# #+ #+ #+# */ -/* Created: 2020/02/02 17:19:28 by rbousset #+# ## ## #+# */ -/* Updated: 2020/02/02 17:19:28 by rbousset ### #+. /#+ ###.fr */ -/* / */ -/* / */ +/* */ +/* ::: :::::::: */ +/* ft_get_tex.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rbousset <marvin@42.fr> +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/02/14 17:28:52 by rbousset #+# #+# */ +/* Updated: 2020/02/14 17:28:52 by rbousset ### ########lyon.fr */ +/* */ /* ************************************************************************** */ #include <libft.h> diff --git a/src/ft_hooks_and_loops.c b/src/ft_hooks_and_loops.c index fdddc10..a494597 100644 --- a/src/ft_hooks_and_loops.c +++ b/src/ft_hooks_and_loops.c @@ -1,14 +1,13 @@ /* ************************************************************************** */ -/* LE - / */ -/* / */ -/* ft_hooks_and_loops.c .:: .:/ . .:: */ -/* +:+:+ +: +: +:+:+ */ -/* By: rbousset <marvin@le-101.fr> +:+ +: +: +:+ */ -/* #+# #+ #+ #+# */ -/* Created: 2020/02/09 20:16:25 by rbousset #+# ## ## #+# */ -/* Updated: 2020/02/09 20:16:27 by rbousset ### #+. /#+ ###.fr */ -/* / */ -/* / */ +/* */ +/* ::: :::::::: */ +/* ft_hooks_and_loops.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rbousset <marvin@42.fr> +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/02/14 17:28:52 by rbousset #+# #+# */ +/* Updated: 2020/02/14 17:28:52 by rbousset ### ########lyon.fr */ +/* */ /* ************************************************************************** */ #include <libft.h> diff --git a/src/ft_init_lists.c b/src/ft_init_lists.c index 6754923..a66634a 100644 --- a/src/ft_init_lists.c +++ b/src/ft_init_lists.c @@ -1,14 +1,13 @@ /* ************************************************************************** */ -/* LE - / */ -/* / */ -/* ft_init_lists.c .:: .:/ . .:: */ -/* +:+:+ +: +: +:+:+ */ -/* By: rbousset <marvin@le-101.fr> +:+ +: +: +:+ */ -/* #+# #+ #+ #+# */ -/* Created: 2020/02/02 17:19:29 by rbousset #+# ## ## #+# */ -/* Updated: 2020/02/02 17:19:29 by rbousset ### #+. /#+ ###.fr */ -/* / */ -/* / */ +/* */ +/* ::: :::::::: */ +/* ft_init_lists.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rbousset <marvin@42.fr> +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/02/14 17:28:53 by rbousset #+# #+# */ +/* Updated: 2020/02/14 17:28:53 by rbousset ### ########lyon.fr */ +/* */ /* ************************************************************************** */ #include <libft.h> diff --git a/src/ft_init_map.c b/src/ft_init_map.c index 0bbae5e..cc767f6 100644 --- a/src/ft_init_map.c +++ b/src/ft_init_map.c @@ -1,3 +1,15 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_init_map.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rbousset <marvin@42.fr> +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/02/14 17:22:42 by rbousset #+# #+# */ +/* Updated: 2020/02/14 17:23:42 by rbousset ### ########lyon.fr */ +/* */ +/* ************************************************************************** */ + #include <libft.h> #include <cub3d.h> #include <stdlib.h> diff --git a/src/ft_init_s_ray.c b/src/ft_init_s_ray.c index 5dd0a01..e890d68 100644 --- a/src/ft_init_s_ray.c +++ b/src/ft_init_s_ray.c @@ -1,7 +1,19 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_init_s_ray.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rbousset <marvin@42.fr> +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/02/14 17:22:48 by rbousset #+# #+# */ +/* Updated: 2020/02/14 17:23:42 by rbousset ### ########lyon.fr */ +/* */ +/* ************************************************************************** */ + #include <cub3d.h> t_ray -ft_init_s_ray(void) + ft_init_s_ray(void) { t_ray rl; diff --git a/src/ft_init_winlx.c b/src/ft_init_winlx.c index b9c714e..1b60477 100644 --- a/src/ft_init_winlx.c +++ b/src/ft_init_winlx.c @@ -1,14 +1,13 @@ /* ************************************************************************** */ -/* LE - / */ -/* / */ -/* ft_init_winlx.c .:: .:/ . .:: */ -/* +:+:+ +: +: +:+:+ */ -/* By: rbousset <marvin@le-101.fr> +:+ +: +: +:+ */ -/* #+# #+ #+ #+# */ -/* Created: 2020/02/02 17:19:29 by rbousset #+# ## ## #+# */ -/* Updated: 2020/02/02 17:19:29 by rbousset ### #+. /#+ ###.fr */ -/* / */ -/* / */ +/* */ +/* ::: :::::::: */ +/* ft_init_winlx.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rbousset <marvin@42.fr> +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/02/14 17:28:54 by rbousset #+# #+# */ +/* Updated: 2020/02/14 17:28:54 by rbousset ### ########lyon.fr */ +/* */ /* ************************************************************************** */ #include <libft.h> diff --git a/src/ft_key_events.c b/src/ft_key_events.c index 2c189ad..e08e3d0 100644 --- a/src/ft_key_events.c +++ b/src/ft_key_events.c @@ -1,67 +1,51 @@ /* ************************************************************************** */ -/* LE - / */ -/* / */ -/* ft_key_events.c .:: .:/ . .:: */ -/* +:+:+ +: +: +:+:+ */ -/* By: rbousset <marvin@le-101.fr> +:+ +: +: +:+ */ -/* #+# #+ #+ #+# */ -/* Created: 2020/02/02 17:19:30 by rbousset #+# ## ## #+# */ -/* Updated: 2020/02/02 17:19:30 by rbousset ### #+. /#+ ###.fr */ -/* / */ -/* / */ +/* */ +/* ::: :::::::: */ +/* ft_key_events.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rbousset <marvin@42.fr> +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/02/14 17:28:55 by rbousset #+# #+# */ +/* Updated: 2020/02/14 17:28:55 by rbousset ### ########lyon.fr */ +/* */ /* ************************************************************************** */ #include <libft.h> #include <cub3d.h> #include <stdlib.h> +#include <stdint.h> -static int8_t - ft_w_key(t_cub *clist) +static uint16_t + ft_set_keycode(const uint16_t tmp_code) { - t_player *pl; + uint16_t keycode; - pl = clist->plist; - pl->pos_y += 0.2 * (-1); /* pl->mult; */ - pl->pos_x += 0; - return (0); -} - -static int8_t - ft_a_key(t_cub *clist) -{ - t_player *pl; - - pl = clist->plist; - pl->pos_x -= 0.2; - return (0); -} - -static int8_t - ft_s_key(t_cub *clist) -{ - t_player *pl; - - pl = clist->plist; - pl->pos_y += 0.2; - return (0); + keycode = UINT16_MAX; + (tmp_code == FT_W_KEY) ? (keycode = 0) : 0; + (tmp_code == FT_A_KEY) ? (keycode = 1) : 0; + (tmp_code == FT_S_KEY) ? (keycode = 2) : 0; + (tmp_code == FT_D_KEY) ? (keycode = 3) : 0; + (tmp_code == FT_L_ARR_KEY) ? (keycode = 4) : 0; + (tmp_code == FT_R_ARR_KEY) ? (keycode = 5) : 0; + (tmp_code == 3) ? (keycode = UINT16_MAX) : 0; + (tmp_code == 4) ? (keycode = UINT16_MAX) : 0; + (tmp_code == 5) ? (keycode = UINT16_MAX) : 0; + return (keycode); } -static int8_t - ft_d_key(t_cub *clist) +static void + ft_secure_player_pos(t_player *pl, t_map *ml) { - t_player *pl; - - pl = clist->plist; - pl->pos_x += 0.2; - return (0); + (pl->pos_y < 1) ? (pl->pos_y = 1.1) : 0; + (pl->pos_x < 1) ? (pl->pos_x = 1.1) : 0; + (pl->pos_y > ml->map_h - 1.4) ? (pl->pos_y = ml->map_h - 1.4) : 0; + (pl->pos_x > ml->map_w - 1.4) ? (pl->pos_x = ml->map_w - 1.4) : 0; } int ft_key_event(int keycode, t_cub *clist) { - t_player *pl; - t_map *ml; - int8_t (*fun_ptr[6])(t_cub*); + int (*fun_ptr[6])(t_cub*); const uint16_t tmp_code = keycode; fun_ptr[0] = ft_w_key; @@ -70,25 +54,12 @@ int fun_ptr[3] = ft_d_key; fun_ptr[4] = ft_left_key; fun_ptr[5] = ft_right_key; + keycode = ft_set_keycode(tmp_code); ft_printf("Key [%d] pressed\n", tmp_code); - (tmp_code == FT_W_KEY) ? (keycode = 0) : 0; - (tmp_code == FT_A_KEY) ? (keycode = 1) : 0; - (tmp_code == FT_S_KEY) ? (keycode = 2) : 0; - (tmp_code == FT_D_KEY) ? (keycode = 3) : 0; - (tmp_code == FT_L_ARR_KEY) ? (keycode = 4) : 0; - (tmp_code == FT_R_ARR_KEY) ? (keycode = 5) : 0; - (tmp_code == 3) ? (keycode = UINT16_MAX) : 0; - (tmp_code == 4) ? (keycode = UINT16_MAX) : 0; - (tmp_code == 5) ? (keycode = UINT16_MAX) : 0; - pl = clist->plist; - ml = clist->mlist; if (keycode <= 5) { (*fun_ptr[keycode])(clist); - (pl->pos_y < 1) ? (pl->pos_y = 1.1) : 0; - (pl->pos_x < 1) ? (pl->pos_x = 1.1) : 0; - (pl->pos_y > ml->map_h - 1.4) ? (pl->pos_y = ml->map_h - 1.4) : 0; - (pl->pos_x > ml->map_w - 1.4) ? (pl->pos_x = ml->map_w - 1.4) : 0; + ft_secure_player_pos(clist->plist, clist->mlist); ft_draw_scene(clist); return (0); } diff --git a/src/ft_map_error.c b/src/ft_map_error.c index 0fc073a..263eee8 100644 --- a/src/ft_map_error.c +++ b/src/ft_map_error.c @@ -1,14 +1,13 @@ /* ************************************************************************** */ -/* LE - / */ -/* / */ -/* ft_map_error.c .:: .:/ . .:: */ -/* +:+:+ +: +: +:+:+ */ -/* By: rbousset <marvin@le-101.fr> +:+ +: +: +:+ */ -/* #+# #+ #+ #+# */ -/* Created: 2020/02/02 17:19:30 by rbousset #+# ## ## #+# */ -/* Updated: 2020/02/02 17:19:30 by rbousset ### #+. /#+ ###.fr */ -/* / */ -/* / */ +/* */ +/* ::: :::::::: */ +/* ft_map_error.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rbousset <marvin@42.fr> +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/02/14 17:28:55 by rbousset #+# #+# */ +/* Updated: 2020/02/14 17:28:55 by rbousset ### ########lyon.fr */ +/* */ /* ************************************************************************** */ #include <libft.h> diff --git a/src/ft_parse_map.c b/src/ft_parse_map.c index 4b66d0c..0e1a1e7 100644 --- a/src/ft_parse_map.c +++ b/src/ft_parse_map.c @@ -1,14 +1,13 @@ /* ************************************************************************** */ -/* LE - / */ -/* / */ -/* ft_parse_map.c .:: .:/ . .:: */ -/* +:+:+ +: +: +:+:+ */ -/* By: rbousset <marvin@le-101.fr> +:+ +: +: +:+ */ -/* #+# #+ #+ #+# */ -/* Created: 2020/02/02 17:19:31 by rbousset #+# ## ## #+# */ -/* Updated: 2020/02/02 17:19:31 by rbousset ### #+. /#+ ###.fr */ -/* / */ -/* / */ +/* */ +/* ::: :::::::: */ +/* ft_parse_map.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rbousset <marvin@42.fr> +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/02/14 17:28:56 by rbousset #+# #+# */ +/* Updated: 2020/02/14 17:28:56 by rbousset ### ########lyon.fr */ +/* */ /* ************************************************************************** */ #include <libft.h> diff --git a/src/ft_print_list.c b/src/ft_print_list.c index 314a4ec..3b44115 100644 --- a/src/ft_print_list.c +++ b/src/ft_print_list.c @@ -1,14 +1,13 @@ /* ************************************************************************** */ -/* LE - / */ -/* / */ -/* ft_print_list.c .:: .:/ . .:: */ -/* +:+:+ +: +: +:+:+ */ -/* By: rbousset <marvin@le-101.fr> +:+ +: +: +:+ */ -/* #+# #+ #+ #+# */ -/* Created: 2020/02/02 17:19:32 by rbousset #+# ## ## #+# */ -/* Updated: 2020/02/02 17:19:32 by rbousset ### #+. /#+ ###.fr */ -/* / */ -/* / */ +/* */ +/* ::: :::::::: */ +/* ft_print_list.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rbousset <marvin@42.fr> +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/02/14 17:28:57 by rbousset #+# #+# */ +/* Updated: 2020/02/14 17:28:57 by rbousset ### ########lyon.fr */ +/* */ /* ************************************************************************** */ #include <libft.h> diff --git a/src/ft_raycasting.c b/src/ft_raycasting.c index c0b55c4..fadb9db 100644 --- a/src/ft_raycasting.c +++ b/src/ft_raycasting.c @@ -1,8 +1,20 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_raycasting.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rbousset <marvin@42.fr> +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/02/14 17:22:57 by rbousset #+# #+# */ +/* Updated: 2020/02/14 17:23:42 by rbousset ### ########lyon.fr */ +/* */ +/* ************************************************************************** */ + #include <cub3d.h> #include <stdint.h> static void -ft_initray(t_cub *cl, uint16_t i) + ft_initray(t_cub *cl, uint16_t i) { t_win *wl; t_player *pl; @@ -28,7 +40,7 @@ ft_initray(t_cub *cl, uint16_t i) } void -ft_castray(t_cub *cl) + ft_castray(t_cub *cl) { uint16_t i; t_win *wl; @@ -45,7 +57,7 @@ ft_castray(t_cub *cl) cl->rlist.wall_b = cl->rlist.line_h / 2 + wl->y_size / 2; if (cl->rlist.wall_b >= wl->y_size)\ cl->rlist.wall_b = wl->y_size - 1; - ft_draw_verline(cl, i, cl->rlist.wall_t - 1, cl->rlist.wall_b, 0x0000ffaa); + ft_draw_verline(cl, i, cl->rlist.wall_t - 1, cl->rlist.wall_b); i++; } } diff --git a/src/ft_rgb_to_hex.c b/src/ft_rgb_to_hex.c index 4a7ad8e..a25d3e0 100644 --- a/src/ft_rgb_to_hex.c +++ b/src/ft_rgb_to_hex.c @@ -1,14 +1,13 @@ /* ************************************************************************** */ -/* LE - / */ -/* / */ -/* ft_rgb_to_hex.c .:: .:/ . .:: */ -/* +:+:+ +: +: +:+:+ */ -/* By: rbousset <marvin@le-101.fr> +:+ +: +: +:+ */ -/* #+# #+ #+ #+# */ -/* Created: 2020/02/05 16:07:13 by rbousset #+# ## ## #+# */ -/* Updated: 2020/02/05 16:07:14 by rbousset ### #+. /#+ ###.fr */ -/* / */ -/* / */ +/* */ +/* ::: :::::::: */ +/* ft_rgb_to_hex.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rbousset <marvin@42.fr> +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/02/14 17:28:58 by rbousset #+# #+# */ +/* Updated: 2020/02/14 17:28:58 by rbousset ### ########lyon.fr */ +/* */ /* ************************************************************************** */ #include <cub3d.h> diff --git a/src/ft_select_get.c b/src/ft_select_get.c index 9c2bcbf..f550d98 100644 --- a/src/ft_select_get.c +++ b/src/ft_select_get.c @@ -1,14 +1,13 @@ /* ************************************************************************** */ -/* LE - / */ -/* / */ -/* ft_select_get.c .:: .:/ . .:: */ -/* +:+:+ +: +: +:+:+ */ -/* By: rbousset <marvin@le-101.fr> +:+ +: +: +:+ */ -/* #+# #+ #+ #+# */ -/* Created: 2020/02/02 17:19:33 by rbousset #+# ## ## #+# */ -/* Updated: 2020/02/02 17:19:33 by rbousset ### #+. /#+ ###.fr */ -/* / */ -/* / */ +/* */ +/* ::: :::::::: */ +/* ft_select_get.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rbousset <marvin@42.fr> +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/02/14 17:28:59 by rbousset #+# #+# */ +/* Updated: 2020/02/14 17:28:59 by rbousset ### ########lyon.fr */ +/* */ /* ************************************************************************** */ #include <libft.h> diff --git a/src/ft_set_minimap_scale.c b/src/ft_set_minimap_scale.c index cd3424c..dc4bd12 100644 --- a/src/ft_set_minimap_scale.c +++ b/src/ft_set_minimap_scale.c @@ -1,14 +1,13 @@ /* ************************************************************************** */ -/* LE - / */ -/* / */ -/* ft_set_minimap_scale.c .:: .:/ . .:: */ -/* +:+:+ +: +: +:+:+ */ -/* By: rbousset <marvin@le-101.fr> +:+ +: +: +:+ */ -/* #+# #+ #+ #+# */ -/* Created: 2020/02/09 14:33:30 by rbousset #+# ## ## #+# */ -/* Updated: 2020/02/09 14:33:31 by rbousset ### #+. /#+ ###.fr */ -/* / */ -/* / */ +/* */ +/* ::: :::::::: */ +/* ft_set_minimap_scale.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rbousset <marvin@42.fr> +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/02/14 17:28:59 by rbousset #+# #+# */ +/* Updated: 2020/02/14 17:28:59 by rbousset ### ########lyon.fr */ +/* */ /* ************************************************************************** */ #include <cub3d.h> @@ -1,14 +1,13 @@ /* ************************************************************************** */ -/* LE - / */ -/* / */ -/* main.c .:: .:/ . .:: */ -/* +:+:+ +: +: +:+:+ */ -/* By: rbousset <marvin@le-101.fr> +:+ +: +: +:+ */ -/* #+# #+ #+ #+# */ -/* Created: 2020/02/02 17:19:34 by rbousset #+# ## ## #+# */ -/* Updated: 2020/02/02 17:19:34 by rbousset ### #+. /#+ ###.fr */ -/* / */ -/* / */ +/* */ +/* ::: :::::::: */ +/* main.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rbousset <marvin@42.fr> +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/02/14 17:29:00 by rbousset #+# #+# */ +/* Updated: 2020/02/14 17:29:08 by rbousset ### ########lyon.fr */ +/* */ /* ************************************************************************** */ #include <libft.h> |