aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-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
4 files changed, 23 insertions, 7 deletions
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);