diff options
Diffstat (limited to '')
-rw-r--r-- | inc/cub3d_defines.h | 3 | ||||
-rw-r--r-- | inc/cub3d_structs.h | 1 | ||||
-rw-r--r-- | map/map_one.cub | 8 | ||||
-rw-r--r-- | src/ft_init_lists.c | 3 | ||||
-rw-r--r-- | src/ft_time.c | 6 |
5 files changed, 16 insertions, 5 deletions
diff --git a/inc/cub3d_defines.h b/inc/cub3d_defines.h index 650f1fc..d24cc8d 100644 --- a/inc/cub3d_defines.h +++ b/inc/cub3d_defines.h @@ -316,6 +316,9 @@ enum # define FT_ENMY_STRT_LIFE 10 # define FT_ENMY_SIGHT_RANGE 8.5 # define FT_ENMY_DAMAGE_AMOUNT 14 +# define FT_WEAP_ONE_VEL 750.0 +# define FT_WEAP_TWO_VEL 400.0 +# define FT_WEAP_THREE_VEL 1500.0 # define FT_W_ONE_DANAGE_AMOUNT 5 # define FT_W_TWO_DANAGE_AMOUNT 3 # define FT_W_THREE_DANAGE_AMOUNT 4 diff --git a/inc/cub3d_structs.h b/inc/cub3d_structs.h index 8d22b86..4666cf9 100644 --- a/inc/cub3d_structs.h +++ b/inc/cub3d_structs.h @@ -133,6 +133,7 @@ typedef struct s_player uint8_t has_weapon[3]; int8_t handles_weapon; int16_t ammo[3]; + float weap_vel[3]; } t_player; typedef struct s_ray diff --git a/map/map_one.cub b/map/map_one.cub index bc3b2a1..e31d162 100644 --- a/map/map_one.cub +++ b/map/map_one.cub @@ -31,17 +31,17 @@ SH 2 100000000000000000000000000001 1001000000T0000000000000000001 10110+0+0111000001110000000111 -111111111111110011 1000N0001 +111111111111110011 100000001 1000001 190001 111111111 1001001 190001 1911001 190001 111101111111110111 10000000110101011 +1000!000000000001 10000000000000001 -1#0#0#0#000000001 -1@0@0@0@000000001 -1!0!0!0!000000001 +10@0E000000000001 10000000000000001 +1000#000000000001 11000000110100011 111101111111T1011 11111 1 1111 diff --git a/src/ft_init_lists.c b/src/ft_init_lists.c index 6ad56d1..76ac0ae 100644 --- a/src/ft_init_lists.c +++ b/src/ft_init_lists.c @@ -60,6 +60,9 @@ t_player plist.ammo[2] = 0; plist.life = FT_STRT_LIFE; plist.fire = 0; + plist.weap_vel[0] = FT_WEAP_ONE_VEL; + plist.weap_vel[1] = FT_WEAP_TWO_VEL; + plist.weap_vel[2] = FT_WEAP_THREE_VEL; return (plist); } diff --git a/src/ft_time.c b/src/ft_time.c index 88822f5..128d890 100644 --- a/src/ft_time.c +++ b/src/ft_time.c @@ -27,10 +27,14 @@ void { static clock_t dt = 0; clock_t curr; + int8_t weap_id; + weap_id = cl->plist.handles_weapon; + weap_id = (weap_id == 2) ? (1) : (weap_id); + weap_id = (weap_id == 4) ? (2) : (weap_id); curr = clock(); dt += curr - before; - if (dt > 0 && ft_clock_to_ms(dt) > 1000.0) + if (dt > 0 && ft_clock_to_ms(dt) > cl->plist.weap_vel[weap_id]) { cl->plist.fire = 0; dt = 0; |