/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_set_minimap_scale.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: rbousset +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/02/14 17:28:59 by rbousset #+# #+# */ /* Updated: 2020/02/14 17:28:59 by rbousset ### ########lyon.fr */ /* */ /* ************************************************************************** */ #include void ft_set_minimap_scale(t_cub *clist) { t_map *ml; ml = &clist->mlist; if (ml->map_w > ml->map_h) { ml->scale = (clist->wlist.x_size / (uint16_t)ml->map_w); ml->scale = (clist->wlist.x_size < (ml->map_w * ml->scale)) ? ((clist->wlist.x_size / (uint16_t)ml->map_w) - 1) : (ml->scale); } else { ml->scale = (clist->wlist.y_size / (uint16_t)ml->map_h); ml->scale = (clist->wlist.y_size < (ml->map_h * ml->scale)) ? ((clist->wlist.y_size / (uint16_t)ml->map_h) - 1) : (ml->scale); } ml->scale = ((ml->scale - 1) < 1) ? (1) : (ml->scale); ml->scale = (ml->scale >= 10) ? (ml->scale / 4) : (ml->scale); }