From 184c8a60afcb465e0a303f2ce99938a5d3a933c6 Mon Sep 17 00:00:00 2001 From: mcolonna Date: Thu, 7 Nov 2024 19:29:58 +0100 Subject: [PATCH] use ceiling and floor colors from the map file --- include/const.h | 5 +---- src/render.c | 6 +++--- testmaps/good_floor_ceiling.cub | 15 +++++++++++++++ 3 files changed, 19 insertions(+), 7 deletions(-) create mode 100644 testmaps/good_floor_ceiling.cub diff --git a/include/const.h b/include/const.h index b4e4e51..62ce444 100644 --- a/include/const.h +++ b/include/const.h @@ -6,7 +6,7 @@ /* By: mc +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/10/31 17:00:59 by mc #+# #+# */ -/* Updated: 2024/11/07 17:10:50 by mc ### ########.fr */ +/* Updated: 2024/11/07 19:26:53 by mc ### ########.fr */ /* */ /* ************************************************************************** */ @@ -22,9 +22,6 @@ # define MOUSE_ROTATION_SPEED 0.001 // rad/px # define HITBOX 0.25 // Hitbox of N cases around player. -# define COLOR_CEILING 0x29f8ff // TODO get from cub file -# define COLOR_FLOOR 0xFF985C // TODO get from cub file - # define SCREEN_WIDTH 640 // Width of the window # define SCREEN_HEIGHT 480 // Height of the window diff --git a/src/render.c b/src/render.c index 90c10b1..2a96395 100644 --- a/src/render.c +++ b/src/render.c @@ -6,7 +6,7 @@ /* By: mc +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/10/14 14:55:05 by greg #+# #+# */ -/* Updated: 2024/11/07 00:54:17 by mc ### ########.fr */ +/* Updated: 2024/11/07 19:27:54 by mc ### ########.fr */ /* */ /* ************************************************************************** */ @@ -121,13 +121,13 @@ static void draw_vertical_line(int x, u_int32_t *img_data, while (y++ < SCREEN_HEIGHT) { if (y < draw_start) - img_data[y * SCREEN_WIDTH + x] = COLOR_CEILING; + img_data[y * SCREEN_WIDTH + x] = g_map.color_ceiling; else if (y < draw_end) { draw_wall(tex, ray, line_height, x, y, img_data); } else - img_data[y * SCREEN_WIDTH + x] = COLOR_FLOOR; + img_data[y * SCREEN_WIDTH + x] = g_map.color_floor; } } diff --git a/testmaps/good_floor_ceiling.cub b/testmaps/good_floor_ceiling.cub new file mode 100644 index 0000000..bf3a6c2 --- /dev/null +++ b/testmaps/good_floor_ceiling.cub @@ -0,0 +1,15 @@ +F 255,0,127 +C 0,255,255 +EA textures/east.xpm +NO textures/north.xpm +SO textures/south.xpm +WE textures/west.xpm +111111111 +100000001 +100010001 +100000001 +1000N0001 +100000001 +100000001 +100000001 +111111111