aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/ft_extra_keys.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/ft_extra_keys.c b/src/ft_extra_keys.c
index 2e9ccf7..ebcaf48 100644
--- a/src/ft_extra_keys.c
+++ b/src/ft_extra_keys.c
@@ -17,13 +17,12 @@
int
ft_left_key(t_cub *clist)
{
- t_player *pl;
- float sav_dir_x;
- float sav_plane_x;
- float rot_speed;
+ t_player *pl;
+ float sav_dir_x;
+ float sav_plane_x;
+ const float rot_speed = 0.08;
pl = clist->plist;
- rot_speed = 0.1;
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);
@@ -36,13 +35,12 @@ int
int
ft_right_key(t_cub *clist)
{
- t_player *pl;
- float sav_dir_x;
- float sav_plane_x;
- float rot_speed;
+ t_player *pl;
+ float sav_dir_x;
+ float sav_plane_x;
+ const float rot_speed = 0.08;
pl = clist->plist;
- rot_speed = 0.1;
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);