diff --git a/maps/postestne.cub b/maps/postestne.cub new file mode 100644 index 0000000..21643bb --- /dev/null +++ b/maps/postestne.cub @@ -0,0 +1,15 @@ +C 0,100,255 +F 100,100,100 + +NO ./assets/bluestone.png +EA ./assets/colorstone.png +SO ./assets/redbrick.png +WE ./assets/wood.png + +1111111 +1 N1 +1 1 +1 1 +1 1 +1 1 +1111111 diff --git a/maps/postestnw.cub b/maps/postestnw.cub new file mode 100644 index 0000000..f8fdf8e --- /dev/null +++ b/maps/postestnw.cub @@ -0,0 +1,15 @@ +C 0,100,255 +F 100,100,100 + +NO ./assets/bluestone.png +EA ./assets/colorstone.png +SO ./assets/redbrick.png +WE ./assets/wood.png + +1111111 +1N 1 +1 1 +1 1 +1 1 +1 1 +1111111 diff --git a/maps/postestse.cub b/maps/postestse.cub new file mode 100644 index 0000000..b958d86 --- /dev/null +++ b/maps/postestse.cub @@ -0,0 +1,15 @@ +C 0,100,255 +F 100,100,100 + +NO ./assets/bluestone.png +EA ./assets/colorstone.png +SO ./assets/redbrick.png +WE ./assets/wood.png + +1111111 +1 1 +1 1 +1 1 +1 1 +1 N1 +1111111 diff --git a/maps/postestsw.cub b/maps/postestsw.cub new file mode 100644 index 0000000..7fcb121 --- /dev/null +++ b/maps/postestsw.cub @@ -0,0 +1,15 @@ +C 0,100,255 +F 100,100,100 + +NO ./assets/bluestone.png +EA ./assets/colorstone.png +SO ./assets/redbrick.png +WE ./assets/wood.png + +1111111 +1 1 +1 1 +1 1 +1 1 +1N 1 +1111111 diff --git a/maps/spritetest.cub b/maps/spritetest.cub new file mode 100644 index 0000000..5109b9b --- /dev/null +++ b/maps/spritetest.cub @@ -0,0 +1,15 @@ +C 0,100,255 +F 100,100,100 + +NO ./assets/bluestone.png +EA ./assets/colorstone.png +SO ./assets/redbrick.png +WE ./assets/wood.png + +1111111 +1B1B1B1 +1 G G 1 +1 1 +1 N 1 +1 1 +1111111 diff --git a/src/draw.c b/src/draw.c index 6f57140..3e32e76 100644 --- a/src/draw.c +++ b/src/draw.c @@ -6,7 +6,7 @@ /* By: houtworm +#+ */ /* +#+ */ /* Created: 2023/10/26 16:54:20 by houtworm #+# #+# */ -/* Updated: 2023/11/03 22:45:06 by houtworm ######## odam.nl */ +/* Updated: 2023/11/03 23:17:11 by houtworm ######## odam.nl */ /* */ /* ************************************************************************** */ @@ -19,11 +19,9 @@ mlx_texture_t *ft_selectsprite(t_varlist *vl, int type) if (type == 1) sprite = vl->barreltext; else if (type == 2) - sprite = vl->hlamptext; + sprite = vl->slamptext; else if (type == 3) sprite = vl->hlamptext; - else if (type == 4) - sprite = vl->slamptext; else ft_errorexit("what?", "what?", 1); return (sprite); diff --git a/src/map.c b/src/map.c index 6eef990..0291644 100644 --- a/src/map.c +++ b/src/map.c @@ -6,17 +6,18 @@ /* By: houtworm +#+ */ /* +#+ */ /* Created: 2023/10/26 17:33:50 by houtworm #+# #+# */ -/* Updated: 2023/11/03 21:54:07 by houtworm ######## odam.nl */ +/* Updated: 2023/11/03 23:25:15 by houtworm ######## odam.nl */ /* */ /* ************************************************************************** */ #include "../cub3d.h" #include -char ft_setplayerpos(t_varlist *vl, char dir, int y, int x) +char ft_setplayerpos(t_varlist *vl, char dir, int x, int y) { - vl->posx = x; - vl->posy = y; + printf("x: %d, y: %d\n", x, y); + vl->posx = x + 0.5; + vl->posy = y + 0.5; if (dir == 'N') { vl->dirx = -1; @@ -99,14 +100,18 @@ char **ft_getmap(t_varlist *vl, int fd) map[y][x] = ft_setplayerpos(vl, line[x], y, x); else if (line[x] == 'D') map[y][x] = 'D'; - else if (line[x] == 'C') - map[y][x] = ft_addsprite(vl, x, y, 2); else if (line[x] == 'B') map[y][x] = ft_addsprite(vl, x, y, 1); - else if (line[x] == 'X') + else if (line[x] == 'G') + map[y][x] = ft_addsprite(vl, x, y, 2); + else if (line[x] == 'H') map[y][x] = ft_addsprite(vl, x, y, 3); + else if (line[x] == 'C') + map[y][x] = ft_addsprite(vl, x, y, 1); + else if (line[x] == 'X') + map[y][x] = ft_addsprite(vl, x, y, 1); else if (line[x] == 'K') - map[y][x] = ft_addsprite(vl, x, y, 4); + map[y][x] = ft_addsprite(vl, x, y, 1); else { ft_putstr("Invalid character on the map\n Valid options are\n");