Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
d4745ca
restructuring for testing purposes
Melow-code Nov 14, 2026
bef6a23
testing maps
Melow-code Nov 14, 2026
f31eafa
quit if config validation outputs error
Melow-code Nov 14, 2026
fee2789
fixing segfault
Melow-code Nov 14, 2026
2c6c79a
check if path is directory
Melow-code Nov 14, 2026
ff79f74
more flexible
Melow-code Nov 14, 2026
ed216cd
fix segfaults when out of the map
Melow-code Nov 14, 2026
89185a6
add non .xpm file to test
Melow-code Nov 14, 2026
47d35ca
check if texture file is .xpm
Melow-code Nov 14, 2026
58c94ac
renaming file from est.xpm to east (french to english)
Melow-code Nov 14, 2026
d97f73a
WIP - Check order and not skip \n when checking map
Melow-code Nov 14, 2026
997ef05
check if map has newline
Melow-code Nov 14, 2026
6c0df6e
show all missing headers
Melow-code Nov 14, 2026
1292708
show all missing headers
Melow-code Nov 14, 2026
9d4b9bf
check if map is first
Melow-code Nov 14, 2026
3c3e433
remove TODO
Melow-code Nov 14, 2026
8bc67df
check only if buffer is filling map
Melow-code Nov 14, 2026
91bd21f
remove newlines
Melow-code Nov 14, 2026
2e096e5
refactor to check map before headers correctly
Melow-code Nov 14, 2026
3d3f210
finishing small details on parsing
Melow-code Nov 14, 2026
e579cc0
Merge branch 'test-parsing' of github.com:ruipedro-pinheiro/cub3d int…
Melow-code Nov 16, 2026
68f2ae4
shortning return line
Melow-code Nov 16, 2026
44977c1
Merge branch 'main' into test-parsing
Melow-code Nov 16, 2026
4eceb1b
remove double .c files
Melow-code Nov 16, 2026
0da83d7
remove double line
Melow-code Nov 16, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 14 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,23 @@ ASAN_FLAGS = -fsanitize=address,undefined -fno-omit-frame-pointer
SRC = main.c \
debug/main.c \
parsing/parse_prep.c \
parsing/check_order.c \
parsing/validation.c \
parsing/config/headers.c \
parsing/config/headers_values.c \
parsing/map/validation.c \
win.c \
render_canvas.c \
utils.c \
draw.c \
mini_map.c \
player.c \
move_player.c \
keys_actions.c \
init_graphics.c \
rotate_player.c \
mini_player.c \
utils_minimap.c
parsing/map/validation.c \
win.c \
render_canvas.c \
utils.c \
draw.c \
mini_map.c \
player.c \
move_player.c \
keys_actions.c \
init_graphics.c \
rotate_player.c \
mini_player.c \
utils_minimap.c

OBJ = $(addprefix $(OBJDIR)/, $(SRC:.c=.o))

Expand Down
1 change: 0 additions & 1 deletion Makefile.gen

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
19 changes: 11 additions & 8 deletions inc/parsing.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: chguerre <chguerre@student.42lausanne.c +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2026/11/04 17:25:24 by rpinheir #+# #+# */
/* Updated: 2026/11/12 16:13:41 by rpinheir ### ########.ch */
/* Updated: 2026/11/14 15:57:10 by rpinheir ### ########.ch */
/* */
/* ************************************************************************** */

Expand All @@ -21,11 +21,14 @@ typedef enum e_header
HEADER_C,
HEADER_F,
HEADER_INVALID
} t_header;
} t_header;

int validate_rgb(t_game *game, char *line, int fd);
int validate_texture_path(t_game *game, char *line, int id);
int validate_headers(t_game *game);
int validate_map(t_game *game);
int validate(t_game *game);
int file_check(t_game *game);
int dup_buffer(t_game *game, int fd);
int validate_rgb(t_game *game, char *line, int fd);
int validate_texture_path(t_game *game, char *line, int id);
int validate_headers(t_game *game);
int validate_map(t_game *game);
int validate(t_game *game);
int file_check(t_game *game);
char **expand_map(char **map, int count_len, int i, char *line);
int is_identifier(char *line);
2 changes: 1 addition & 1 deletion inc/player.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

enum e_orient
{
ON,
ON = 1,
OS,
OE,
OW
Expand Down
12 changes: 0 additions & 12 deletions maps/invalid/3playepos.cub

This file was deleted.

File renamed without changes.
Empty file added maps/invalid/empty.cub
Empty file.
35 changes: 35 additions & 0 deletions maps/invalid/file_letter_end.cub
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
NO assets/test/north.xpm
SO assets/test/south.xpm
WE assets/test/west.xpm
EA assets/test/east.xpm

F 20,20,20
C 200,200,200

11111
10001
10S01
10001
10001
10001
11001
10001
10001
10001
10001
10001
11111













F
16 changes: 16 additions & 0 deletions maps/invalid/newline.cub
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
NO assets/test/north.xpm
SO assets/test/south.xpm
WE assets/test/west.xpm
EA assets/test/east.xpm

F 20,20,20
C 200,200,200


11111
1S001
11101

11001
10001
11111
8 changes: 4 additions & 4 deletions maps/invalid/open.cub
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
NO assets/textures/north.xpm
SO assets/textures/south.xpm
WE assets/textures/west.xpm
EA assets/textures/est.xpm
NO assets/test/north.xpm
SO assets/test/south.xpm
WE assets/test/west.xpm
EA assets/test/est.xpm
F 220,100,100
C 225,30,100

Expand Down
19 changes: 19 additions & 0 deletions maps/invalid/open2.cub
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
NO assets/test/north.xpm
SO assets/test/south.xpm
WE assets/test/west.xpm
EA assets/test/est.xpm
F 220,100,100
C 225,30,100

1111111111111111111111111111111111
1S000000000000000000000001110000001
10000000000000010100000000000000001
11110111111111110111111111011111111
101000000000000001
101000000000000001
101000000000000001
101000000000000001
11111111111000111111110111111
10000100000010000000001000001
10000100000000000000001000001
11111111111111111111111111111
12 changes: 12 additions & 0 deletions maps/invalid/test_3pos.cub
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
NO assets/test/north.xpm
SO assets/test/south.xpm
WE assets/test/west.xpm
EA assets/test/est.xpm
F 220,100,100
C 225,30,100

1111111
10S0001
100W001
1000N01
1111111
21 changes: 21 additions & 0 deletions maps/test/color_invalid_rgb.cub
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
NO assets/test/north.xpm
SO assets/test/south.xpm
WE assets/test/west.xpm
EA assets/test/east.xpm

F 20,20,-20
C 200,200,200

11111
10001
10S01
10001
10001
10001
11001
10001
10001
10001
10001
10001
11111
20 changes: 20 additions & 0 deletions maps/test/color_missing.cub
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
NO assets/test/north.xpm
SO assets/test/south.xpm
WE assets/test/west.xpm
EA assets/test/est.xpm

C 200,200,200

11111
10001
10S01
10001
10001
10001
11001
10001
10001
10001
10001
10001
11111
21 changes: 21 additions & 0 deletions maps/test/color_missing_ceiling_rgb.cub
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
NO assets/test/north.xpm
SO assets/test/south.xpm
WE assets/test/west.xpm
EA assets/test/east.xpm

F 20,20,20
C 200,200,

11111
10001
10S01
10001
10001
10001
11001
10001
10001
10001
10001
10001
11111
21 changes: 21 additions & 0 deletions maps/test/color_missing_floor_rgb.cub
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
NO assets/test/north.xpm
SO assets/test/south.xpm
WE assets/test/west.xpm
EA assets/test/east.xpm

F 20,20
C 200,200,200

11111
10001
10S01
10001
10001
10001
11001
10001
10001
10001
10001
10001
11111
18 changes: 18 additions & 0 deletions maps/test/color_none.cub
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
NO assets/test/north.xpm
SO assets/test/south.xpm
WE assets/test/west.xpm
EA assets/test/east.xpm

11111
10001
10S01
10001
10001
10001
11001
10001
10001
10001
10001
10001
11111
Empty file added maps/test/empty.cub
Empty file.
35 changes: 35 additions & 0 deletions maps/test/file_letter_end.cub
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
NO assets/test/north.xpm
SO assets/test/south.xpm
WE assets/test/west.xpm
EA assets/test/east.xpm

F 20,20,20
C 200,200,200

11111
10001
10S01
10001
10001
10001
11001
10001
10001
10001
10001
10001
11111













F
21 changes: 21 additions & 0 deletions maps/test/filetype_missing
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
NO textures/test/north.xpm
SO textures/test/south.xpm
WE textures/test/west.xpm
EA textures/test/east.xpm

F 20,20,20
C 200,200,200

11111
10001
10S01
10001
10001
10001
11001
10001
10001
10001
10001
10001
11111
21 changes: 21 additions & 0 deletions maps/test/filetype_wrong.buc
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
NO textures/test/north.xpm
SO textures/test/south.xpm
WE textures/test/west.xpm
EA textures/test/east.xpm

F 20,20,20
C 200,200,200

11111
10001
10S01
10001
10001
10001
11001
10001
10001
10001
10001
10001
11111
16 changes: 16 additions & 0 deletions maps/test/forbidden.cub
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
NO textures/wolfenstein/grey_stone.xpm
SO textures/wolfenstein/purple_stone.xpm
WE textures/wolfenstein/red_brick.xpm
EA textures/wolfenstein/wood.xpm

F 18,53,25
C 153,204,255

111111111111
1 11
1 1
111111111111
10S000000001
111111111111
11 1
111111111111
Loading
Loading