-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Valentin Simeonov
committed
Mar 21, 2022
1 parent
b9e11c5
commit baf7c47
Showing
26 changed files
with
123 additions
and
19,042 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,29 +6,25 @@ | |
/* By: vsimeono <[email protected]> +#+ +:+ +#+ */ | ||
/* +#+#+#+#+#+ +#+ */ | ||
/* Created: 2022/03/17 13:44:38 by vsimeono #+# #+# */ | ||
/* Updated: 2022/03/17 15:58:07 by vsimeono ### ########.fr */ | ||
/* Updated: 2022/03/21 15:42:19 by vsimeono ### ########.fr */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
#include "so_long.h" | ||
|
||
|
||
/* Checking if P, E, C is in Map */ | ||
int check_P_E_C_in_map(t_long *arch, t_list **lines) | ||
int check_p_e_c_in_map(t_long *arch, t_list **lines) | ||
{ | ||
t_list *temp; | ||
int i; | ||
int len_line; | ||
int flag[255]; | ||
|
||
temp = *lines; | ||
len_line = ft_strlen_line(lines); | ||
i = 0; | ||
while (i > 255) | ||
{ | ||
flag[i] = 0; | ||
i++; | ||
} | ||
flag[i++] = 0; | ||
while (temp->next != NULL) | ||
{ | ||
if (ft_strchr(temp->line, 'P')) | ||
|
@@ -45,9 +41,6 @@ int check_P_E_C_in_map(t_long *arch, t_list **lines) | |
{ | ||
flag[67] = 1; | ||
arch->collect++; | ||
printf("%d\n", arch->collect); | ||
printf("%d\n", arch->collect); | ||
printf("%d\n", arch->collected); | ||
} | ||
temp = temp->next; | ||
} | ||
|
@@ -57,20 +50,22 @@ int check_P_E_C_in_map(t_long *arch, t_list **lines) | |
} | ||
|
||
/* Check that there are not any other Characters except P,C,E, 1 and 0 */ | ||
int is_only__P_C_E_1_0_in_map(t_list **lines) | ||
int is_p_c_e_1_0(t_list **lines) | ||
{ | ||
t_list *temp; | ||
int i; | ||
int len_line; | ||
|
||
temp = (*lines); | ||
len_line = ft_strlen_line(lines); | ||
while (temp->next != NULL) | ||
{ | ||
i = 0; | ||
while (i < len_line) | ||
{ | ||
if (temp->line[i] != '0' && temp->line[i] != '1' && temp->line[i] != 'P' && temp->line[i] != 'E' && temp->line[i] != 'C' && temp->line[i] != '\n') | ||
if (temp->line[i] != '0' && temp->line[i] != '1' && \ | ||
temp->line[i] != 'P' && temp->line[i] != 'E' && \ | ||
temp->line[i] != 'C' && temp->line[i] != '\n') | ||
return (0); | ||
i++; | ||
} | ||
|
@@ -80,7 +75,7 @@ int is_only__P_C_E_1_0_in_map(t_list **lines) | |
} | ||
|
||
/* Checking the Length of the Lines are the Same */ | ||
int is_length_of_lines_the_same(t_list **lines) | ||
int is_length(t_list **lines) | ||
{ | ||
t_list *temp; | ||
int len_line; | ||
|
@@ -97,10 +92,10 @@ int is_length_of_lines_the_same(t_list **lines) | |
} | ||
|
||
/* Checking if first Line and Last Line is Made from 1s */ | ||
int is_first_and_last_line_is_one(t_list **lines) | ||
int is_first_last_line(t_list **lines) | ||
{ | ||
t_list *temp; | ||
|
||
temp = (*lines); | ||
if (!ft_strchr_first_line(temp->line, '1')) | ||
return (0); | ||
|
@@ -112,7 +107,7 @@ int is_first_and_last_line_is_one(t_list **lines) | |
} | ||
|
||
/* Check if First Char and Last Char is 1 */ | ||
int is_first_char_and_last_char_one(t_list **lines) | ||
int is_first_last_char(t_list **lines) | ||
{ | ||
t_list *temp; | ||
int len_line; | ||
|
@@ -132,15 +127,3 @@ int is_first_char_and_last_char_one(t_list **lines) | |
} | ||
return (1); | ||
} | ||
|
||
/* Checking if the Map has Extension .ber*/ | ||
int is_map(char *argv) | ||
{ | ||
int len; | ||
|
||
len = ft_strlen(argv); | ||
if (argv[len - 4] == '.' && argv[len - 3] == 'b' && \ | ||
argv[len - 2] == 'e' && argv[len - 1] == 'r') | ||
return (1); | ||
return (0); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* ************************************************************************** */ | ||
/* */ | ||
/* ::: :::::::: */ | ||
/* checkers2.c :+: :+: :+: */ | ||
/* +:+ +:+ +:+ */ | ||
/* By: vsimeono <[email protected]> +#+ +:+ +#+ */ | ||
/* +#+#+#+#+#+ +#+ */ | ||
/* Created: 2022/03/21 15:03:09 by vsimeono #+# #+# */ | ||
/* Updated: 2022/03/21 15:03:50 by vsimeono ### ########.fr */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
#include "so_long.h" | ||
|
||
/* Checking if the Map has Extension .ber*/ | ||
int is_map(char *argv) | ||
{ | ||
int len; | ||
|
||
len = ft_strlen(argv); | ||
if (argv[len - 4] == '.' && argv[len - 3] == 'b' && \ | ||
argv[len - 2] == 'e' && argv[len - 1] == 'r') | ||
return (1); | ||
return (0); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
/* By: vsimeono <[email protected]> +#+ +:+ +#+ */ | ||
/* +#+#+#+#+#+ +#+ */ | ||
/* Created: 2022/03/17 14:04:00 by vsimeono #+# #+# */ | ||
/* Updated: 2022/03/17 14:04:31 by vsimeono ### ########.fr */ | ||
/* Updated: 2022/03/21 15:30:16 by vsimeono ### ########.fr */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
|
@@ -15,7 +15,7 @@ | |
int loop(t_long *arch) | ||
{ | ||
char *moves; | ||
|
||
moves = ft_itoa(arch->moves); | ||
mlx_string_put(arch->mlx, arch->mlx_win, 30, 30, 0xffff00, moves); | ||
return (0); | ||
|
@@ -57,25 +57,33 @@ void create_visual_map(t_long *arch) | |
} | ||
} | ||
|
||
/* Loading Pictures as the Pixels for the Graphical Map according to their Corresponding Lettter or Number */ | ||
/* Loading Pictures as the Pixels for the Graphical Map | ||
according to their Corresponding Lettter or Number */ | ||
void load_assests(t_long *arch, char c, int x, int y) | ||
{ | ||
if (c == '1') | ||
arch->img.img = mlx_xpm_file_to_image(arch->mlx, "./data/red_walls.xpm", &arch->img.size_x, &arch->img.size_y); | ||
arch->img.img = mlx_xpm_file_to_image(arch->mlx, \ | ||
"./data/red_walls.xpm", &arch->img.size_x, &arch->img.size_y); | ||
else if (c == 'P') | ||
{ | ||
arch->img.img = mlx_xpm_file_to_image(arch->mlx, "./data/space.xpm", &arch->img.size_x, &arch->img.size_y); | ||
arch->img.img = mlx_xpm_file_to_image(arch->mlx, "./data/sun_resized.xpm", &arch->img.size_x, &arch->img.size_y); | ||
arch->img.img = mlx_xpm_file_to_image(arch->mlx, \ | ||
"./data/space.xpm", &arch->img.size_x, &arch->img.size_y); | ||
arch->img.img = mlx_xpm_file_to_image(arch->mlx, \ | ||
"./data/sun_resized.xpm", &arch->img.size_x, &arch->img.size_y); | ||
} | ||
else if (c == 'E') | ||
arch->img.img = mlx_xpm_file_to_image(arch->mlx, "./data/exit_x.xpm", &arch->img.size_x, &arch->img.size_y); | ||
arch->img.img = mlx_xpm_file_to_image(arch->mlx, \ | ||
"./data/exit_x.xpm", &arch->img.size_x, &arch->img.size_y); | ||
else if (c == 'C') | ||
{ | ||
arch->img.img = mlx_xpm_file_to_image(arch->mlx, "./data/space.xpm", &arch->img.size_x, &arch->img.size_y); | ||
arch->img.img = mlx_xpm_file_to_image(arch->mlx, "./data/heart.xpm", &arch->img.size_x, &arch->img.size_y); | ||
arch->img.img = mlx_xpm_file_to_image(arch->mlx, \ | ||
"./data/space.xpm", &arch->img.size_x, &arch->img.size_y); | ||
arch->img.img = mlx_xpm_file_to_image(arch->mlx, \ | ||
"./data/heart.xpm", &arch->img.size_x, &arch->img.size_y); | ||
} | ||
else | ||
arch->img.img = mlx_xpm_file_to_image(arch->mlx, "./data/space.xpm", &arch->img.size_x, &arch->img.size_y); | ||
arch->img.img = mlx_xpm_file_to_image(arch->mlx, \ | ||
"./data/space.xpm", &arch->img.size_x, &arch->img.size_y); | ||
mlx_put_image_to_window(arch->mlx, arch->mlx_win, arch->img.img, x, y); | ||
mlx_destroy_image(arch->mlx, arch->img.img); | ||
} |
Binary file not shown.
Oops, something went wrong.