aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--map/lvl_four.cub6
-rw-r--r--map/lvl_three.cub10
-rw-r--r--map/map_one.cub6
-rw-r--r--src/ft_get_map.c11
-rw-r--r--src/ft_get_player_spawn.c3
-rw-r--r--src/ft_parse_map.c13
-rw-r--r--src/ft_warp_level.c3
7 files changed, 34 insertions, 18 deletions
diff --git a/map/lvl_four.cub b/map/lvl_four.cub
index 4e5de39..3930581 100644
--- a/map/lvl_four.cub
+++ b/map/lvl_four.cub
@@ -24,9 +24,9 @@ L ./map/lvl_five.cub
11011 101
101 1L1
101 11T11
- 101 1110111
- 101 11000TT11
- 101 11101111111
+ 101111111111111110111
+ 100000000000@11000TT11
+ 10111111111111101111111
101 1+000000000+1
101 11111T111111011
101 11111111111T10111
diff --git a/map/lvl_three.cub b/map/lvl_three.cub
index 726bb84..affb87c 100644
--- a/map/lvl_three.cub
+++ b/map/lvl_three.cub
@@ -24,8 +24,8 @@ MU ./media/sound/BITURE-ET-MELANCOLIE.wav
1001 101
10011111111111111111101
1E0000000001L0000000001
-10011111011111111111111
-1001 101
-10011111011111111111
-1200000000000T000001
-11111111111111111111
+10011111011111111111101
+1001 101 101
+10011111011111111111101
+1200000000000T000!00001
+11111111111111111111111
diff --git a/map/map_one.cub b/map/map_one.cub
index 1690c81..3328834 100644
--- a/map/map_one.cub
+++ b/map/map_one.cub
@@ -22,7 +22,7 @@ SH 2
10000E000T00333301
100000000000444401
100100000+00000001
-101100000111000001
+101100@!0111000001
111111111111110011
1000001 100001
1001001 100001
@@ -30,8 +30,8 @@ SH 2
111101111111110111
100000001101010111
120202020200000011
-1@0000000000000011
-1!0000000000000011
+100000000000000011
+100000000000000011
120202020200000011
110000001101000111
111101111111010111
diff --git a/src/ft_get_map.c b/src/ft_get_map.c
index 8602ce3..bbe9a7f 100644
--- a/src/ft_get_map.c
+++ b/src/ft_get_map.c
@@ -17,7 +17,7 @@
#include <stdint.h>
static void
- ft_linecpy(char *line, char *mapl, size_t start)
+ ft_linecpy(char *line, char *mapl, size_t start, t_cub *clist)
{
size_t i;
size_t j;
@@ -28,7 +28,12 @@ static void
slen = ft_strlen(line);
while (i < slen && line[i])
{
- mapl[j] = line[i];
+ if (line[i] == '!' && clist->plist.has_weapon[0])
+ mapl[j] = '0';
+ else if (line[i] == '@' && clist->plist.has_weapon[1])
+ mapl[j] = '0';
+ else
+ mapl[j] = line[i];
i++;
j++;
}
@@ -47,7 +52,7 @@ static int8_t
return (-1);
}
ft_linecpy(line, clist->mlist.mapl,
- clist->mlist.mapl_len);
+ clist->mlist.mapl_len, clist);
clist->mlist.mapl_len += ft_strlen(line) + 1;
return (0);
}
diff --git a/src/ft_get_player_spawn.c b/src/ft_get_player_spawn.c
index 2f8fa0e..0d9018a 100644
--- a/src/ft_get_player_spawn.c
+++ b/src/ft_get_player_spawn.c
@@ -85,7 +85,8 @@ void
ft_get_sprite_spawn(clist);
ft_get_trap_spawn(clist);
ft_get_heal_spawn(clist);
- ft_get_weapon_spawn(clist);
+ if (clist->isdead == 0)
+ ft_get_weapon_spawn(clist);
return ;
}
x++;
diff --git a/src/ft_parse_map.c b/src/ft_parse_map.c
index 79c00d2..785a816 100644
--- a/src/ft_parse_map.c
+++ b/src/ft_parse_map.c
@@ -109,6 +109,17 @@ void
ft_get_nlvl_pos(&clist->mlist);
ft_check_missing(clist);
ft_set_minimap_scale(clist);
- clist->currlvl += 1;
+ clist->currlvl += (clist->isdead == 0) ? (1) : (0);
close(fd);
+
+
+ /* ====== MAP PRINT ====== */
+ fd = 0;
+ ft_printf("=====================\n");
+ while (clist->mlist.map[fd])
+ {
+ ft_printf("[%s]\n", clist->mlist.map[fd]);
+ fd++;
+ }
+ ft_printf("\n\n");
}
diff --git a/src/ft_warp_level.c b/src/ft_warp_level.c
index 4618766..ca7801b 100644
--- a/src/ft_warp_level.c
+++ b/src/ft_warp_level.c
@@ -55,8 +55,6 @@ static void
cl->plist = ft_init_player();
if (!cl->isdead)
cl->plist.life = tmp_life;
- else
- cl->isdead = 0;
cl->plist.has_weapon[0] = tmp_has[0];
cl->plist.has_weapon[1] = tmp_has[1];
cl->plist.handles_weapon = tmp_handles;
@@ -146,6 +144,7 @@ int8_t
return (-1);
ft_parse_map(next_path, cl);
ft_treat_music(isoldmus, tmp_mup, cl);
+ cl->isdead = (cl->isdead == 1) ? (0) : (cl->isdead);
if (isoldmus)
ft_memdel((void*)&tmp_mup);
ft_wall_tex_init(cl);