aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ft_parse_map.c3
-rw-r--r--src/ft_set_minimap_scale.c10
2 files changed, 11 insertions, 2 deletions
diff --git a/src/ft_parse_map.c b/src/ft_parse_map.c
index 85337f0..3014900 100644
--- a/src/ft_parse_map.c
+++ b/src/ft_parse_map.c
@@ -118,8 +118,7 @@ void
ft_check_map_last_line(clist);
ft_get_player_spawn(clist->plist, clist);
ft_check_missing(clist);
+ ft_set_minimap_scale(clist);
ft_print_list(clist);
- ((clist->scale = ((uint16_t)clist->wlist->x_size /
- (uint16_t)clist->map_w) - 1) < 1) ? (clist->scale = 1) : 0;
close(fd);
}
diff --git a/src/ft_set_minimap_scale.c b/src/ft_set_minimap_scale.c
new file mode 100644
index 0000000..5a69c18
--- /dev/null
+++ b/src/ft_set_minimap_scale.c
@@ -0,0 +1,10 @@
+#include <cub3d.h>
+
+void
+ ft_set_minimap_scale(t_cub *clist)
+{
+ ((clist->scale = (clist->wlist->x_size / (uint16_t)clist->map_w) - 1) < 1)
+ ? (clist->scale = 1) : 0;
+ (clist->wlist->y_size < (clist->map_h * clist->scale)) ? (clist->scale =
+ (clist->wlist->y_size / (uint16_t)clist->map_h) - 1) : 0;
+}