aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_draw_map.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/ft_draw_map.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/ft_draw_map.c b/src/ft_draw_map.c
index a334fc1..232891c 100644
--- a/src/ft_draw_map.c
+++ b/src/ft_draw_map.c
@@ -10,21 +10,22 @@
/* */
/* ************************************************************************** */
+#include <libft.h>
#include <cub3d.h>
#include <stdint.h>
static uint16_t
ft_y_offset(t_cub *clist)
{
- return (clist->wlist->y_size
- - (clist->mlist->map_h * clist->mlist->scale)
- + clist->mlist->scale - 1);
+ return (clist->wlist.y_size
+ - (clist->mlist.map_h * clist->mlist.scale)
+ + clist->mlist.scale - 1);
}
static void
ft_draw_player(t_player *plist, t_cub *clist)
{
- const uint16_t scale = clist->mlist->scale;
+ const uint16_t scale = clist->mlist.scale;
const float x = plist->pos_x;
const float y = plist->pos_y;
@@ -38,7 +39,7 @@ static void
void
ft_draw_map(char **map, t_cub *clist)
{
- const uint8_t scale = clist->mlist->scale;
+ const uint8_t scale = clist->mlist.scale;
size_t x;
size_t y;
@@ -48,13 +49,13 @@ void
{
while (map[y][x])
{
- if (map[y][x] == '1')
+ if (ft_ischarset("1D", map[y][x]))
ft_draw_square(scale + 9 + (x * (scale)),
ft_y_offset(clist) - 9 + (y * (scale)), 0x00ca5422, clist);
else if (map[y][x] == '2')
ft_draw_square(scale + 9 + (x * (scale)),
ft_y_offset(clist) - 9 + (y * (scale)), 0x0033ccff, clist);
- else
+ else if (ft_ischarset("0LNSEW", map[y][x]))
ft_draw_square(scale + 9 + (x * (scale)), ft_y_offset(clist)
- 9 + (y * (scale)), 0x006afa6a, clist);
x++;
@@ -62,5 +63,5 @@ void
x = 0;
y++;
}
- ft_draw_player(clist->plist, clist);
+ ft_draw_player(&clist->plist, clist);
}