diff options
Diffstat (limited to '')
| -rw-r--r-- | inc/cub3d_defines.h | 5 | ||||
| -rw-r--r-- | map/map_one.cub | 4 | ||||
| -rw-r--r-- | map/qst_thirteen_dungeon_two.cub | 2 | ||||
| -rw-r--r-- | map/qst_twelve_dungeon_one.cub | 6 | ||||
| -rw-r--r-- | src/ft_bad_boy_actions.c | 13 | ||||
| -rw-r--r-- | src/ft_collision.c | 18 | ||||
| -rw-r--r-- | src/ft_damage_bad_boy.c | 8 | ||||
| -rw-r--r-- | src/ft_select_bad_boy_action.c | 1 | ||||
| -rw-r--r-- | src/ft_time.c | 2 | 
9 files changed, 36 insertions, 23 deletions
| diff --git a/inc/cub3d_defines.h b/inc/cub3d_defines.h index bbc785f..da9ae93 100644 --- a/inc/cub3d_defines.h +++ b/inc/cub3d_defines.h @@ -174,8 +174,8 @@ enum  */  #	define FT_MOVE_SPEED	0.18 -#	define FT_STRAFE_SPEED	0.15 -#	define FT_ROT_SPEED		0.15 +#	define FT_STRAFE_SPEED	0.13 +#	define FT_ROT_SPEED		0.13  /*  ** ====== COLLISION ====== @@ -327,6 +327,7 @@ enum  #	define FT_ENMY_STRT_LIFE		10  #	define FT_ENMY_SIGHT_RANGE		8.5  #	define FT_ENMY_DAMAGE_AMOUNT	14 +#	define FT_ENMY_MOVE_SPEED		0.44  #	define FT_WEAP_ONE_VEL			900.0  #	define FT_WEAP_TWO_VEL			450.0  #	define FT_WEAP_THREE_VEL		1400.0 diff --git a/map/map_one.cub b/map/map_one.cub index dda0055..b9a8288 100644 --- a/map/map_one.cub +++ b/map/map_one.cub @@ -1,4 +1,4 @@ -R 1300 1040 +R 1200 940  NO ./media/img/tex/wood_wall_1_small.xpm  SO ./media/img/tex/wood_wall_1_small.xpm @@ -26,7 +26,7 @@ SH 2             1000900080000000001             1000000000000000001  111111111111000000000005000001 -10000000000000000T0T0T00000001 +100000000000000000000000000001  10000e000000000304000000T0T001  100000000000000000000000000001  1001000000T0000000000000000001 diff --git a/map/qst_thirteen_dungeon_two.cub b/map/qst_thirteen_dungeon_two.cub index e5fe3c5..febf3aa 100644 --- a/map/qst_thirteen_dungeon_two.cub +++ b/map/qst_thirteen_dungeon_two.cub @@ -28,7 +28,7 @@ SH 4                              1+++++++1                          11111111711111111                          11511511511511511 -                        11000002000500011 +                        11000002020500011                          1200000000e000021                          1+00000000000e0+1      1111111111111111    1+0000000000000+1 diff --git a/map/qst_twelve_dungeon_one.cub b/map/qst_twelve_dungeon_one.cub index 0ff2784..c466c93 100644 --- a/map/qst_twelve_dungeon_one.cub +++ b/map/qst_twelve_dungeon_one.cub @@ -45,8 +45,8 @@ SH 5         10001         10001         12021 -       10#01 -       10!01 -       12@21 +       10001 +       10001 +       12021         1+N+1         11111 diff --git a/src/ft_bad_boy_actions.c b/src/ft_bad_boy_actions.c index fb2cdb7..4e332cc 100644 --- a/src/ft_bad_boy_actions.c +++ b/src/ft_bad_boy_actions.c @@ -14,6 +14,7 @@  #include <cub3d.h>  #include <mlx.h>  #include <stdlib.h> +#include <math.h>  void  	ft_bb_wait(t_bad_boy *bl, t_sprite *sl, t_map *ml) @@ -46,16 +47,16 @@ void  		r = rand() % 4;  	sl->r = r;  	if (r == 0) -		sl->s_pos_y += (FT_MOVE_SPEED * 1.5); +		sl->s_pos_y += FT_ENMY_MOVE_SPEED;  	else if (r == 1) -		sl->s_pos_y -= (FT_MOVE_SPEED * 1.5); +		sl->s_pos_y -= FT_ENMY_MOVE_SPEED;  	else if (r == 2) -		sl->s_pos_x -= (FT_MOVE_SPEED * 1.5); +		sl->s_pos_x -= FT_ENMY_MOVE_SPEED;  	else if (r == 3) -		sl->s_pos_x += (FT_MOVE_SPEED * 1.5); +		sl->s_pos_x += FT_ENMY_MOVE_SPEED;  	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'; +	ml->map[llround(old_y)][llround(old_x)] = '0'; +	ml->map[llround(sl->s_pos_y)][llround(sl->s_pos_x)] = 'e';  	bl->does = 1;  } diff --git a/src/ft_collision.c b/src/ft_collision.c index 6468433..ba44d49 100644 --- a/src/ft_collision.c +++ b/src/ft_collision.c @@ -15,6 +15,7 @@  #include <mlx.h>  #include <stddef.h>  #include <stdint.h> +#include <math.h>  #include <time.h>  static uint64_t @@ -96,29 +97,38 @@ int  	return (0);  } +/* +** sl->r index list +** ------------------ +** 0: goes south +** 1: goes north +** 2: goes west +** 3: goes east +*/ +  int8_t  	ft_bb_collision(double old_y, double old_x, t_sprite *sl, t_map *ml)  {  	if (sl->r == 0 && !ft_ischarset("0e", -		ml->map[(uint64_t)(sl->s_pos_y + 1.5)][(uint64_t)old_x])) +		ml->map[llround(sl->s_pos_y + 0.4)][llround(old_x)]))  	{  		sl->s_pos_y = old_y;  		return (1);  	}  	else if (sl->r == 1 && !ft_ischarset("0e", -		ml->map[(uint64_t)(sl->s_pos_y - 0.5)][(uint64_t)old_x])) +		ml->map[llround(sl->s_pos_y - 0.4)][llround(old_x)]))  	{  		sl->s_pos_y = old_y;  		return (1);  	}  	else if (sl->r == 2 && !ft_ischarset("0e", -		ml->map[(uint64_t)old_y][(uint64_t)(sl->s_pos_x - 0.5)])) +		ml->map[llround(old_y)][llround(sl->s_pos_x - 0.4)]))  	{  		sl->s_pos_x = old_x;  		return (1);  	}  	else if (sl->r == 3 && !ft_ischarset("0e", -		ml->map[(uint64_t)old_y][(uint64_t)(sl->s_pos_x + 1.5)])) +		ml->map[llround(old_y)][llround(sl->s_pos_x + 0.4)]))  	{  		sl->s_pos_x = old_x;  		return (1); diff --git a/src/ft_damage_bad_boy.c b/src/ft_damage_bad_boy.c index ffbd2fe..36c082f 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 ((uint64_t)cl->sprites[13][i].s_pos_x == cl->rlist.sqx && -			(uint64_t)cl->sprites[13][i].s_pos_y == cl->rlist.sqy) +		if (llround(cl->sprites[13][i].s_pos_x) == (int64_t)cl->rlist.sqx && +			llround(cl->sprites[13][i].s_pos_y) == (int64_t)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[(uint64_t)cl->sprites[13][id].s_pos_y] -			[(uint64_t)cl->sprites[13][id].s_pos_x] = 'x'; +		cl->mlist.map[llround(cl->sprites[13][id].s_pos_y)] +			[llround(cl->sprites[13][id].s_pos_x)] = 'x';  	}  	else if (cl->bad_boy[id].does != 3)  		cl->sfx[14].sfx_play(cl->sfx); diff --git a/src/ft_select_bad_boy_action.c b/src/ft_select_bad_boy_action.c index 2be17f3..b824306 100644 --- a/src/ft_select_bad_boy_action.c +++ b/src/ft_select_bad_boy_action.c @@ -87,6 +87,7 @@ static void  		can_shoot == 1))  	{  		r = ft_set_r_ii(); +		r = ((r == 1) && (d < 2.0)) ? (2) : (r);  		ft_bb_act(r, i, cl);  	}  	else if (cl->bad_boy[i].sleep == 0 && cl->bad_boy[i].life > 0) diff --git a/src/ft_time.c b/src/ft_time.c index 128d890..73d2379 100644 --- a/src/ft_time.c +++ b/src/ft_time.c @@ -49,7 +49,7 @@ void  	curr = clock();  	dt[i] += curr - before; -	if (cl->bad_boy[i].sleep == 1 && dt[i] > 0 && ft_clock_to_ms(dt[i]) > 700.0) +	if (cl->bad_boy[i].sleep == 1 && dt[i] > 0 && ft_clock_to_ms(dt[i]) > 500.0)  	{  		cl->bad_boy[i].sleep = 0;  		dt[i] = 0; | 
