diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2020-04-06 14:29:47 +0200 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2020-04-06 14:29:47 +0200 |
commit | db0e4bcfe0bcf99d5d21e74e0a1ccc0fc6977a26 (patch) | |
tree | 23419411132e5ee23cf247716de11baed5954a1f /src | |
parent | I think it's fixed (diff) | |
download | 42-cub3d-db0e4bcfe0bcf99d5d21e74e0a1ccc0fc6977a26.tar.gz 42-cub3d-db0e4bcfe0bcf99d5d21e74e0a1ccc0fc6977a26.tar.bz2 42-cub3d-db0e4bcfe0bcf99d5d21e74e0a1ccc0fc6977a26.tar.xz 42-cub3d-db0e4bcfe0bcf99d5d21e74e0a1ccc0fc6977a26.tar.zst 42-cub3d-db0e4bcfe0bcf99d5d21e74e0a1ccc0fc6977a26.zip |
Weapons have different velocities
Diffstat (limited to 'src')
-rw-r--r-- | src/ft_init_lists.c | 3 | ||||
-rw-r--r-- | src/ft_time.c | 6 |
2 files changed, 8 insertions, 1 deletions
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; |