diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2020-04-14 17:22:51 +0200 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2020-04-14 17:22:51 +0200 |
commit | 28f42e3db40ea792a2ee146ff0601a18f9e29395 (patch) | |
tree | ae64c244e84cbe75daeed08aec3afd4e924826cf | |
parent | Fixed bad boys collision, reroll if hit a wall (diff) | |
download | 42-cub3d-28f42e3db40ea792a2ee146ff0601a18f9e29395.tar.gz 42-cub3d-28f42e3db40ea792a2ee146ff0601a18f9e29395.tar.bz2 42-cub3d-28f42e3db40ea792a2ee146ff0601a18f9e29395.tar.xz 42-cub3d-28f42e3db40ea792a2ee146ff0601a18f9e29395.tar.zst 42-cub3d-28f42e3db40ea792a2ee146ff0601a18f9e29395.zip |
Fixed a whole lot of issues
-rw-r--r-- | map/map_seven.cub | 6 | ||||
-rw-r--r-- | map/qst_eleven_cave.cub | 4 | ||||
-rw-r--r-- | src/ft_bad_boy_actions.c | 14 | ||||
-rw-r--r-- | src/ft_damage_bad_boy.c | 8 |
4 files changed, 12 insertions, 20 deletions
diff --git a/map/map_seven.cub b/map/map_seven.cub index 25a7998..355b441 100644 --- a/map/map_seven.cub +++ b/map/map_seven.cub @@ -12,9 +12,9 @@ C 150,150,150 1111111111111111111 -1000000000000111111 -100000000000000e001 -1000000000000111111 +1000000000000000001 +1000000000000000e01 +1000000000000000001 1000000000000000001 1000000000000000001 1000000000000000001 diff --git a/map/qst_eleven_cave.cub b/map/qst_eleven_cave.cub index ad4a9d2..4729392 100644 --- a/map/qst_eleven_cave.cub +++ b/map/qst_eleven_cave.cub @@ -1,4 +1,4 @@ -R 10 10 +R 1000 900 NO media/img/tex/cave.xpm SO media/img/tex/cave.xpm @@ -35,7 +35,7 @@ SH 6 1001 1001 111111111111110111110011 10000060400000030006000111111 -1E000000000000000000000000001 +1E##0000000000000000000000001 10030000004000000200000111111 111111111111111111111101 111 diff --git a/src/ft_bad_boy_actions.c b/src/ft_bad_boy_actions.c index 220e5ee..ea2822c 100644 --- a/src/ft_bad_boy_actions.c +++ b/src/ft_bad_boy_actions.c @@ -34,8 +34,8 @@ void ** 3: goes east */ -static int8_t - ft_bb_actual_walk(t_bad_boy *bl, t_sprite *sl, t_map *ml) +void + ft_bb_walk(t_bad_boy *bl, t_sprite *sl, t_map *ml) { int8_t r; const double old_x = sl->s_pos_x; @@ -54,18 +54,10 @@ static int8_t sl->s_pos_x -= (FT_MOVE_SPEED * 1.5); else if (r == 3) sl->s_pos_x += (FT_MOVE_SPEED * 1.5); - if (ft_bb_collision(old_y, old_x, sl, ml)) - return (ft_bb_actual_walk(bl, sl, ml)); + ft_bb_collision(old_y, old_x, sl, ml); ml->map[(uint64_t)old_y][(uint64_t)old_x] = '0'; ml->map[(uint64_t)sl->s_pos_y][(uint64_t)sl->s_pos_x] = 'e'; bl->does = 1; - return (0); -} - -void - ft_bb_walk(t_bad_boy *bl, t_sprite *sl, t_map *ml) -{ - ft_bb_actual_walk(bl, sl, ml); } /* diff --git a/src/ft_damage_bad_boy.c b/src/ft_damage_bad_boy.c index 8f896b0..ffbd2fe 100644 --- a/src/ft_damage_bad_boy.c +++ b/src/ft_damage_bad_boy.c @@ -22,8 +22,8 @@ static uint8_t i = 0; while (i < cl->mlist.sprite_nbr[13]) { - if (lround(cl->sprites[13][i].s_pos_x) == (long)cl->rlist.sqx && - lround(cl->sprites[13][i].s_pos_y) == (long)cl->rlist.sqy) + if ((uint64_t)cl->sprites[13][i].s_pos_x == cl->rlist.sqx && + (uint64_t)cl->sprites[13][i].s_pos_y == cl->rlist.sqy) break ; i++; } @@ -47,8 +47,8 @@ void { cl->sfx[13].sfx_play(cl->sfx); cl->bad_boy[id].isdead = 1; - cl->mlist.map[lround(cl->sprites[13][id].s_pos_y)] - [lround(cl->sprites[13][id].s_pos_x)] = 'x'; + cl->mlist.map[(uint64_t)cl->sprites[13][id].s_pos_y] + [(uint64_t)cl->sprites[13][id].s_pos_x] = 'x'; } else if (cl->bad_boy[id].does != 3) cl->sfx[14].sfx_play(cl->sfx); |