aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRudy Bousset <rbousset@z2r5p2.le-101.fr>2020-02-28 20:51:54 +0100
committerRudy Bousset <rbousset@z2r5p2.le-101.fr>2020-02-28 20:51:54 +0100
commit733fd55d384eef1c89e0ad2a44beaee066182b50 (patch)
tree494e767707cd2bcecae33519f8d89f4888f5dde3 /src
parentGNL fix (diff)
download42-cub3d-733fd55d384eef1c89e0ad2a44beaee066182b50.tar.gz
42-cub3d-733fd55d384eef1c89e0ad2a44beaee066182b50.tar.bz2
42-cub3d-733fd55d384eef1c89e0ad2a44beaee066182b50.tar.xz
42-cub3d-733fd55d384eef1c89e0ad2a44beaee066182b50.tar.zst
42-cub3d-733fd55d384eef1c89e0ad2a44beaee066182b50.zip
Right but not perfect
Diffstat (limited to '')
-rw-r--r--src/ft_init_lists.c3
-rw-r--r--src/ft_parse_map.c6
-rw-r--r--src/ft_warp_level.c19
3 files changed, 26 insertions, 2 deletions
diff --git a/src/ft_init_lists.c b/src/ft_init_lists.c
index 5592358..f451220 100644
--- a/src/ft_init_lists.c
+++ b/src/ft_init_lists.c
@@ -18,7 +18,7 @@
#include <limits.h>
#include <math.h>
-static t_rgb
+t_rgb
ft_init_rgb(void)
{
t_rgb rgb;
@@ -85,6 +85,7 @@ static t_cub
clist->f_rgb = ft_init_rgb();
clist->c_rgb = ft_init_rgb();
clist->rlist = ft_init_s_ray();
+ clist->currlvl = 0;
clist->key_ptr[0] = ft_w_key;
clist->key_ptr[1] = ft_a_key;
clist->key_ptr[2] = ft_s_key;
diff --git a/src/ft_parse_map.c b/src/ft_parse_map.c
index 400bdd4..afb1d88 100644
--- a/src/ft_parse_map.c
+++ b/src/ft_parse_map.c
@@ -100,6 +100,10 @@ void
ft_get_player_spawn(clist->plist, clist);
ft_get_nlvl_pos(clist->mlist);
ft_check_missing(clist);
- ft_set_minimap_scale(clist);
+ if (clist->currlvl == 0)
+ {
+ ft_set_minimap_scale(clist);
+ clist->currlvl += 1;
+ }
close(fd);
}
diff --git a/src/ft_warp_level.c b/src/ft_warp_level.c
index 03302bd..8739550 100644
--- a/src/ft_warp_level.c
+++ b/src/ft_warp_level.c
@@ -18,6 +18,24 @@ static void
ft_memdel((void**)&ml);
}
+static void
+ ft_del_some(t_cub *cl)
+{
+ cl->plist->pos_x = 0;
+ cl->plist->pos_y = 0;
+ cl->wlist->x_size = 0;
+ cl->wlist->y_size = 0;
+ cl->f_rgb = ft_init_rgb();
+ cl->c_rgb = ft_init_rgb();
+ cl->plist->start_x = 0;
+ cl->plist->start_y = 0;
+ cl->plist->cam_x = 0;
+ cl->plist->dir_x = -1;
+ cl->plist->dir_y = 0;
+ cl->plist->plane_x = 0;
+ cl->plist->plane_y = 0.66666666;
+}
+
int8_t
ft_warp_level(t_cub *cl)
{
@@ -31,6 +49,7 @@ int8_t
return (-1);
ft_sprintf(next_path, "%s", cl->mlist->nlevel_path);
ft_del_map(cl->mlist);
+ ft_del_some(cl);
if (!(cl->mlist = ft_init_map()))
return (-1);
ft_parse_map(next_path, cl);