aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-03-30 16:50:13 +0200
committerJozanLeClerc <bousset.rudy@gmail.com>2020-03-30 16:50:13 +0200
commitc8e12617e07762d65bc7c74ecc55e279c3267b84 (patch)
tree2114b7906acdef1d5d5f2c580c62d612bf4819ca /src
parentFixed conditionnal jump btw (diff)
download42-cub3d-c8e12617e07762d65bc7c74ecc55e279c3267b84.tar.gz
42-cub3d-c8e12617e07762d65bc7c74ecc55e279c3267b84.tar.bz2
42-cub3d-c8e12617e07762d65bc7c74ecc55e279c3267b84.tar.xz
42-cub3d-c8e12617e07762d65bc7c74ecc55e279c3267b84.tar.zst
42-cub3d-c8e12617e07762d65bc7c74ecc55e279c3267b84.zip
Commit
Diffstat (limited to 'src')
-rw-r--r--src/ft_big_t.c4
-rw-r--r--src/ft_del_sprites_lists.c1
-rw-r--r--src/ft_draw_sprite_extra.c1
-rw-r--r--src/ft_get_sprite_spawns.c10
-rw-r--r--src/ft_init_bad_boys.c37
5 files changed, 51 insertions, 2 deletions
diff --git a/src/ft_big_t.c b/src/ft_big_t.c
index e01bed7..b4d7e52 100644
--- a/src/ft_big_t.c
+++ b/src/ft_big_t.c
@@ -27,8 +27,10 @@ static int8_t
return (15);
else if (st_o == 9)
return (17);
- else if (st_o >= 10)
+ else if (st_o >= 10 && st_o <= 12)
return (st_o + 8);
+ else if (st_o == 13)
+ return (23);
return (0);
}
diff --git a/src/ft_del_sprites_lists.c b/src/ft_del_sprites_lists.c
index 6a1a662..b7a854d 100644
--- a/src/ft_del_sprites_lists.c
+++ b/src/ft_del_sprites_lists.c
@@ -19,6 +19,7 @@ void
{
int8_t i;
+ ft_memdel((void*)&clist->bad_boy);
i = 0;
while (i < FT_TOTAL_SPRT)
{
diff --git a/src/ft_draw_sprite_extra.c b/src/ft_draw_sprite_extra.c
index 43e69e3..c9b8b16 100644
--- a/src/ft_draw_sprite_extra.c
+++ b/src/ft_draw_sprite_extra.c
@@ -48,7 +48,6 @@ static void
(1 + sprite->transformx / sprite->transformy);
}
-#include <libft.h>
void
ft_calc_sprite(t_cub *cl)
{
diff --git a/src/ft_get_sprite_spawns.c b/src/ft_get_sprite_spawns.c
index 21c4cb8..a573593 100644
--- a/src/ft_get_sprite_spawns.c
+++ b/src/ft_get_sprite_spawns.c
@@ -30,6 +30,10 @@
** 10: weapon one - tlist[18] - 4
** 11: weapon two - tlist[19] - 4
** 12: weapon three - tlist[20] - 4
+** 13: enemy - tlist[23] |
+** '- - - - - - - tlist[24] |
+** '- - - - - - - tlist[25] |
+** '- - - - - - - tlist[26] - 32
*/
static void
@@ -47,6 +51,8 @@ static void
ft_map_error(FT_ERR_TOO_MUCH_W_TWO, cl);
else if (s_n == 12 && cl->mlist.sprite_nbr[s_n] > 4)
ft_map_error(FT_ERR_TOO_MUCH_W_THREE, cl);
+ else if (s_n == 13 && cl->mlist.sprite_nbr[s_n] > 32)
+ ft_map_error(FT_ERR_TOO_MUCH_ENMY, cl);
}
static int8_t
@@ -62,6 +68,10 @@ static int8_t
return (ft_get_next_sprite(cl, 11, '@', 0));
if (s_n + 1 == 12)
return (ft_get_next_sprite(cl, 12, '#', 0));
+ if (s_n + 1 == 13)
+ return (ft_get_next_sprite(cl, 13, 'e', 0));
+ if (cl->mlist.sprite_nbr[13] > 0)
+ return (ft_init_bad_boys(cl));
return (0);
}
diff --git a/src/ft_init_bad_boys.c b/src/ft_init_bad_boys.c
new file mode 100644
index 0000000..8ddc9a5
--- /dev/null
+++ b/src/ft_init_bad_boys.c
@@ -0,0 +1,37 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* ft_init_bad_boys.c :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: rbousset <marvin@42.fr> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2020/02/14 17:28:51 by rbousset #+# #+# */
+/* Updated: 2020/02/14 17:28:51 by rbousset ### ########lyon.fr */
+/* */
+/* ************************************************************************** */
+
+#include <libft.h>
+#include <cub3d.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+int8_t
+ ft_init_bad_boys(t_cub *cl)
+{
+ int8_t i;
+
+ if (!(cl->bad_boy = (t_bad_boy*)malloc(cl->mlist.sprite_nbr[13]
+ * sizeof(t_bad_boy))))
+ return (ft_alloc_error(cl));
+ i = 0;
+ while (i < cl->mlist.sprite_nbr[13])
+ {
+ cl->bad_boy[i].life = 5;
+ cl->bad_boy[i].does = 0;
+ cl->bad_boy[i].act[0] = ft_bb_wait;
+ cl->bad_boy[i].act[1] = ft_bb_walk;
+ cl->bad_boy[i].act[2] = ft_bb_fire;
+ i++;
+ }
+ return (0);
+}