From 488aeeaeacfe178a4e6908472864d7964d559b0a Mon Sep 17 00:00:00 2001 From: aortigos Date: Mon, 1 Dec 2025 10:03:50 +0100 Subject: [PATCH] Textures file added --- includes/cub3d.h | 10 ++++-- src/parsing/textures.c | 75 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 82 insertions(+), 3 deletions(-) create mode 100644 src/parsing/textures.c diff --git a/includes/cub3d.h b/includes/cub3d.h index 23e25d7..c906a3d 100644 --- a/includes/cub3d.h +++ b/includes/cub3d.h @@ -6,7 +6,7 @@ /* By: aortigos name = ft_substr(line, 0, 2); + list->value = ft_substr(line, get_index(line, 2), ft_strlen(line)); + } + else if ((!ft_strncmp(line, "F", 1) || !ft_strncmp(line, "C", 1))) + { + list->name = ft_substr(line, 0, 1); + list->value = ft_substr(line, get_index(line, 1), ft_strlen(line)); + } + list->next = NULL; + return (list); +} + +void lst_back_ture(t_turelist **l_ture, t_turelist *new) +{ + t_turelist *tmp; + + if (!*l_ture) + { + (*l_ture) = new; + return ; + } + tmp = *l_ture; + while (tmp->next) + tmp = tmp->next; + tmp->next = new; +} + +int lst_ture(t_data *m, t_turelist **l_ture) +{ + int i; + t_turelist *tmp; + + i = 0; + while (m->ture2d[i]) + { + tmp = new_texture(m->ture2d[i++]); + if (!tmp) + return (0); + lst_back_ture(l_ture, tmp); + } + return (1); +}