From 3dd666969d58d7608d25d240a95be84a8bf42394 Mon Sep 17 00:00:00 2001 From: Rudy Bousset Date: Thu, 13 Feb 2020 17:28:01 +0100 Subject: Divided minimap scale by 4, Makefile update --- Makefile | 2 +- inc/cub3d_structs.h | 27 ++++++++++++++++----------- src/ft_raycasting.c | 5 ++--- src/ft_set_minimap_scale.c | 1 + 4 files changed, 20 insertions(+), 15 deletions(-) diff --git a/Makefile b/Makefile index 6e8393c..4e90778 100644 --- a/Makefile +++ b/Makefile @@ -92,7 +92,7 @@ endif #==============================================================================# #--------------------------------- Rules --------------------------------------# #==============================================================================# -${OBJS_DIR}%.o: ${SRCS_DIR}%.c ${INCS_DIR}%.h +${OBJS_DIR}%.o: ${SRCS_DIR}%.c ${INCS_DIR} @${MKDIR} ${OBJS_DIR} ifeq (${OS}, Darwin) ${CC} -c ${CFLAGS} ${CDEFS} -I${LFT_DIR}${INCS_DIR} -I${MLX_DIR} -I${INCS_DIR} -o $@ $< diff --git a/inc/cub3d_structs.h b/inc/cub3d_structs.h index 1a45860..cc5d805 100644 --- a/inc/cub3d_structs.h +++ b/inc/cub3d_structs.h @@ -43,19 +43,24 @@ typedef struct s_player float view_side; } t_player; +/* typedef struct s_ray */ +/* { */ +/* double x_ray_position; */ +/* double y_ray_position; */ +/* double x_ray_direction; */ +/* double y_ray_direction; */ +/* double x_side_distance; */ +/* double y_side_distance; */ +/* double x_delta_distance; */ +/* double y_delta_distance; */ +/* int hitX; */ +/* int hitY; */ +/* int hits[150]; */ +/* } t_ray; */ + typedef struct s_ray { - double x_ray_position; - double y_ray_position; - double x_ray_direction; - double y_ray_direction; - double x_side_distance; - double y_side_distance; - double x_delta_distance; - double y_delta_distance; - int hitX; - int hitY; - int hits[150]; + uint16_t line_h; } t_ray; typedef struct s_cub diff --git a/src/ft_raycasting.c b/src/ft_raycasting.c index 1f81840..d36eacf 100644 --- a/src/ft_raycasting.c +++ b/src/ft_raycasting.c @@ -14,10 +14,9 @@ ft_castray(t_cub *clist) uint16_t i; i = 0; - while (i < clist->wlist->size_y) + while (i < clist->wlist->y_size) { - ft_initray(clist. i); - p_s->line + ft_initray(clist, i); i++; } } diff --git a/src/ft_set_minimap_scale.c b/src/ft_set_minimap_scale.c index 883e524..0f79d6e 100644 --- a/src/ft_set_minimap_scale.c +++ b/src/ft_set_minimap_scale.c @@ -20,4 +20,5 @@ void ? (clist->scale = 1) : 0; (clist->wlist->y_size < (clist->map_h * clist->scale)) ? (clist->scale = (clist->wlist->y_size / (uint16_t)clist->map_h) - 1) : 0; + (clist->scale >= 10) ? (clist->scale /= 4) : 0; } -- cgit v1.2.3