Fixes
This commit is contained in:
@@ -1,12 +1,10 @@
|
|||||||
|
EA assets/textures/wallTlou.png
|
||||||
|
F 30,55,55
|
||||||
|
C 255,255,255
|
||||||
|
|
||||||
NO assets/textures/wallTlou.png
|
NO assets/textures/wallTlou.png
|
||||||
SO assets/textures/wallTlou.png
|
SO assets/textures/wallTlou.png
|
||||||
WE assets/textures/wallTlou.png
|
WE assets/textures/wallTlou.png
|
||||||
EA assets/textures/wallTlou.png
|
|
||||||
|
|
||||||
F 30,55,55
|
|
||||||
C 255,255,255
|
|
||||||
|
|
||||||
1111111111111111111
|
1111111111111111111
|
||||||
1000100001000100001
|
1000100001000100001
|
||||||
@@ -17,5 +15,5 @@ C 255,255,255
|
|||||||
1000000000000000001
|
1000000000000000001
|
||||||
1000001000100000101
|
1000001000100000101
|
||||||
1000000000000000001
|
1000000000000000001
|
||||||
10000000N0000000001
|
100000N000000000011
|
||||||
1111111111111111111
|
1111111111111111111
|
||||||
|
|||||||
17
assets/maps/maptmp.cub
Normal file
17
assets/maps/maptmp.cub
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
EA assets/textures/wallTlou.png
|
||||||
|
F 30,55,55
|
||||||
|
C 255,255,255
|
||||||
|
|
||||||
|
NO assets/textures/wallTlou.png
|
||||||
|
SO assets/textures/wallTlou.png
|
||||||
|
WE assets/textures/wallTlou.png
|
||||||
|
|
||||||
|
1111111111111111111111111111
|
||||||
|
1000000000000000000000000001
|
||||||
|
1000000000000000000000000001
|
||||||
|
1000000000000000000000000001
|
||||||
|
1000000000000E00000000000001
|
||||||
|
1000000000000000000000000001
|
||||||
|
1000000000000000000000000001
|
||||||
|
1000000000000000000000000001
|
||||||
|
1111111111111111111111111111
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
/* By: aortigos <aortigos@student.42malaga.com +#+ +:+ +#+ */
|
/* By: aortigos <aortigos@student.42malaga.com +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/11/25 19:47:02 by aortigos #+# #+# */
|
/* Created: 2025/11/25 19:47:02 by aortigos #+# #+# */
|
||||||
/* Updated: 2026/02/10 15:31:25 by aortigos ### ########.fr */
|
/* Updated: 2026/02/10 16:56:59 by aortigos ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@@ -30,15 +30,17 @@
|
|||||||
# define WALL_SIZE 64
|
# define WALL_SIZE 64
|
||||||
# define FOV 60
|
# define FOV 60
|
||||||
# define ROTATION_SPEED 0.045
|
# define ROTATION_SPEED 0.045
|
||||||
# define PLAYER_SPEED 6
|
# define PLAYER_SPEED 2.0
|
||||||
# define COLLISION_MARGIN 1
|
# define COLLISION_MARGIN 1
|
||||||
|
|
||||||
# define ERR_INV_COP "Error: invalid argument\n"
|
# define ERR_INV_COP "Error: invalid argument\n"
|
||||||
# define ERR_INV_FILE "Error: invalid file\n"
|
# define ERR_INV_FILE "Error: invalid file\n"
|
||||||
# define ERR_EMPTY_FILE "Error: empty file\n"
|
# define ERR_EMPTY_FILE "Error: empty file\n"
|
||||||
|
|
||||||
# define ERR_MAP_INV "Error: invalid map element\n"
|
# define ERR_MAP_INV "Error: missing map element\n"
|
||||||
# define ERR_MAP_EMPTY "Error: empty line in the map\n"
|
# define ERR_MAP_EMPTY "Error: empty line in the map\n"
|
||||||
|
# define ERR_MAP_ONE "Error: missing wall\n"
|
||||||
|
# define ERR_MAP_SPAWN "Error: No player spawn\n"
|
||||||
# define ERR_MAP_DUP "Error: duplicate map element\n"
|
# define ERR_MAP_DUP "Error: duplicate map element\n"
|
||||||
# define ERR_MAP_RGB "Error: invalid color map [RGB]\n"
|
# define ERR_MAP_RGB "Error: invalid color map [RGB]\n"
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
/* By: aortigos <aortigos@student.42malaga.com +#+ +:+ +#+ */
|
/* By: aortigos <aortigos@student.42malaga.com +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/12/09 18:46:27 by aortigos #+# #+# */
|
/* Created: 2025/12/09 18:46:27 by aortigos #+# #+# */
|
||||||
/* Updated: 2026/02/10 11:38:48 by aortigos ### ########.fr */
|
/* Updated: 2026/02/10 16:42:55 by aortigos ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@@ -79,20 +79,24 @@ int load_texture(t_tex *tex, t_texture_list *l_ture)
|
|||||||
void get_angle(t_mlx *mlx)
|
void get_angle(t_mlx *mlx)
|
||||||
{
|
{
|
||||||
char c;
|
char c;
|
||||||
|
|
||||||
c = mlx->dt->sq_map[mlx->dt->p_y][mlx->dt->p_x];
|
c = mlx->dt->sq_map[mlx->dt->p_y][mlx->dt->p_x];
|
||||||
if (c == 'N') // North - faceing up
|
|
||||||
mlx->ply->angle = M_PI / 2;
|
if (c == 'N') // Norte - mira hacia ARRIBA (Y negativo)
|
||||||
if (c == 'S') // South - facing down
|
mlx->ply->angle = 3 * M_PI / 2; // 270° (no 90°)
|
||||||
mlx->ply->angle = 3 * M_PI / 2;
|
|
||||||
if (c == 'E') // East - facing right
|
if (c == 'S') // Sur - mira hacia ABAJO (Y positivo)
|
||||||
|
mlx->ply->angle = M_PI / 2; // 90° (no 270°)
|
||||||
|
|
||||||
|
if (c == 'E') // Este - mira hacia DERECHA (X positivo)
|
||||||
mlx->ply->angle = 0;
|
mlx->ply->angle = 0;
|
||||||
if (c == 'W') // West - facing left
|
|
||||||
mlx->ply->angle = M_PI;
|
if (c == 'W') // Oeste - mira hacia IZQUIERDA (X negativo)
|
||||||
//Center player in starting cell
|
mlx->ply->angle = M_PI; // 180°
|
||||||
|
|
||||||
mlx->ply->plyr_x = (mlx->dt->p_x * WALL_SIZE) + WALL_SIZE / 2;
|
mlx->ply->plyr_x = (mlx->dt->p_x * WALL_SIZE) + WALL_SIZE / 2;
|
||||||
mlx->ply->plyr_y = (mlx->dt->p_y * WALL_SIZE) + WALL_SIZE / 2;
|
mlx->ply->plyr_y = (mlx->dt->p_y * WALL_SIZE) + WALL_SIZE / 2;
|
||||||
mlx->ply->fov_rd = (FOV * M_PI / 180); // Fov from degrees to radians
|
mlx->ply->fov_rd = (FOV * M_PI / 180);
|
||||||
}
|
}
|
||||||
|
|
||||||
int execution(t_data *dt)
|
int execution(t_data *dt)
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
/* By: aortigos <aortigos@student.42malaga.com +#+ +:+ +#+ */
|
/* By: aortigos <aortigos@student.42malaga.com +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/12/05 17:11:09 by aortigos #+# #+# */
|
/* Created: 2025/12/05 17:11:09 by aortigos #+# #+# */
|
||||||
/* Updated: 2026/02/10 11:58:11 by aortigos ### ########.fr */
|
/* Updated: 2026/02/10 16:59:03 by aortigos ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
/* By: aortigos <aortigos@student.42malaga.com +#+ +:+ +#+ */
|
/* By: aortigos <aortigos@student.42malaga.com +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/12/04 10:07:52 by aortigos #+# #+# */
|
/* Created: 2025/12/04 10:07:52 by aortigos #+# #+# */
|
||||||
/* Updated: 2026/02/10 12:27:18 by aortigos ### ########.fr */
|
/* Updated: 2026/02/10 16:31:48 by aortigos ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@@ -71,8 +71,10 @@ int check_first_last_line(char **map)
|
|||||||
{
|
{
|
||||||
if (!map[0])
|
if (!map[0])
|
||||||
return (ft_putstr_fd(ERR_MAP_INV, 2), 0);
|
return (ft_putstr_fd(ERR_MAP_INV, 2), 0);
|
||||||
|
if ((int)ft_strlen(map[0]) != (int)ft_strlen(map[ft_arraylen(map) - 1]))
|
||||||
|
return (ft_putstr_fd(ERR_MAP_ONE, 2), 0);
|
||||||
if (!line_around_one(map[0]) || !line_around_one(map[ft_arraylen(map) - 1]))
|
if (!line_around_one(map[0]) || !line_around_one(map[ft_arraylen(map) - 1]))
|
||||||
return (ft_putstr_fd("one Y\n", 2), 0);
|
return (ft_putstr_fd(ERR_MAP_ONE, 2), 0);
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -86,9 +88,15 @@ int surrounded_by_one(char **map)
|
|||||||
// Check each map line
|
// Check each map line
|
||||||
while (map[++i])
|
while (map[++i])
|
||||||
if (!is_surrounded(map[i]) || !is_validmap(map[i], &flag) || flag > 1)
|
if (!is_surrounded(map[i]) || !is_validmap(map[i], &flag) || flag > 1)
|
||||||
return (ft_putstr_fd("Invalid map\n", 2), 0);
|
{
|
||||||
|
ft_putstr_fd(ERR_MAP_ONE, 2);
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
// Must have one player spawn
|
// Must have one player spawn
|
||||||
if (flag == 0)
|
if (flag == 0)
|
||||||
return (ft_putstr_fd("no position map\n", 2), 0);
|
{
|
||||||
|
ft_putstr_fd(ERR_MAP_SPAWN, 2);
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
/* By: aortigos <aortigos@student.42malaga.com +#+ +:+ +#+ */
|
/* By: aortigos <aortigos@student.42malaga.com +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/12/05 16:30:33 by aortigos #+# #+# */
|
/* Created: 2025/12/05 16:30:33 by aortigos #+# #+# */
|
||||||
/* Updated: 2025/12/15 10:27:21 by aortigos ### ########.fr */
|
/* Updated: 2026/02/10 16:30:46 by aortigos ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@@ -46,7 +46,7 @@ int v_map(char **map)
|
|||||||
{
|
{
|
||||||
if (map[i][j] != '1' && map[i][j] != ' ')
|
if (map[i][j] != '1' && map[i][j] != ' ')
|
||||||
if (map[i - 1][j] == ' ' || map[i + 1][j] == ' ')
|
if (map[i - 1][j] == ' ' || map[i + 1][j] == ' ')
|
||||||
return (ft_putstr_fd(ERR_MAP_INV, 2), 0);
|
return (ft_putstr_fd(ERR_MAP_ONE, 2), 0);
|
||||||
j++;
|
j++;
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
|
|||||||
Reference in New Issue
Block a user