diff options
Diffstat (limited to 'src/ft_extra_keys.c')
-rw-r--r-- | src/ft_extra_keys.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/ft_extra_keys.c b/src/ft_extra_keys.c index 1a71402..c1ea721 100644 --- a/src/ft_extra_keys.c +++ b/src/ft_extra_keys.c @@ -21,14 +21,14 @@ int ft_left_key(t_cub *clist) { t_player *pl; - float sav_dir_x; + float sav_dir_y; float sav_plane_x; const float rot_speed = FT_ROT_SPEED; pl = &clist->plist; - sav_dir_x = pl->dir_x; - pl->dir_x = pl->dir_x * cos(rot_speed) - pl->dir_y * sin(rot_speed); - pl->dir_y = sav_dir_x * sin(rot_speed) + pl->dir_y * cos(rot_speed); + sav_dir_y = pl->dir_y; + pl->dir_y = pl->dir_y * cos(-rot_speed) - pl->dir_x * sin(-rot_speed); + pl->dir_x = sav_dir_y * sin(-rot_speed) + pl->dir_x * cos(-rot_speed); sav_plane_x = pl->plane_x; pl->plane_x = pl->plane_x * cos(rot_speed) - pl->plane_y * sin(rot_speed); pl->plane_y = sav_plane_x * sin(rot_speed) + pl->plane_y * cos(rot_speed); @@ -39,14 +39,14 @@ int ft_right_key(t_cub *clist) { t_player *pl; - float sav_dir_x; + float sav_dir_y; float sav_plane_x; const float rot_speed = FT_ROT_SPEED; pl = &clist->plist; - sav_dir_x = pl->dir_x; - pl->dir_x = pl->dir_x * cos(-rot_speed) - pl->dir_y * sin(-rot_speed); - pl->dir_y = sav_dir_x * sin(-rot_speed) + pl->dir_y * cos(-rot_speed); + sav_dir_y = pl->dir_y; + pl->dir_y = pl->dir_y * cos(rot_speed) - pl->dir_x * sin(rot_speed); + pl->dir_x = sav_dir_y * sin(rot_speed) + pl->dir_x * cos(rot_speed); sav_plane_x = pl->plane_x; pl->plane_x = pl->plane_x * cos(-rot_speed) - pl->plane_y * sin(-rot_speed); pl->plane_y = sav_plane_x * sin(-rot_speed) + pl->plane_y * cos(-rot_speed); @@ -83,7 +83,7 @@ int clist->plist.ammo[w_id] -= w_id; clist->sfx[clist->plist.handles_weapon + 7].sfx_play(clist->sfx); clist->plist.fire = 1; - ft_shoot(clist, clist->wlist.x_size / 2); + ft_shoot(clist); return (0); } else if (clist->plist.fire == 0 && clist->plist.ammo[w_id] <= 0) |