aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_key_events.c
diff options
context:
space:
mode:
authorRudy Bousset <rbousset@z3r8p1.le-101.fr>2020-02-13 17:06:14 +0100
committerRudy Bousset <rbousset@z3r8p1.le-101.fr>2020-02-13 17:06:14 +0100
commita4bce145513f41f20f6c1c9e5516eb93a78a19c9 (patch)
treea7ae45e9608ab112874ba56414baec09cadfcae8 /src/ft_key_events.c
parentOn the way (diff)
download42-cub3d-a4bce145513f41f20f6c1c9e5516eb93a78a19c9.tar.gz
42-cub3d-a4bce145513f41f20f6c1c9e5516eb93a78a19c9.tar.bz2
42-cub3d-a4bce145513f41f20f6c1c9e5516eb93a78a19c9.tar.xz
42-cub3d-a4bce145513f41f20f6c1c9e5516eb93a78a19c9.tar.zst
42-cub3d-a4bce145513f41f20f6c1c9e5516eb93a78a19c9.zip
Bug fixes
Diffstat (limited to 'src/ft_key_events.c')
-rw-r--r--src/ft_key_events.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/ft_key_events.c b/src/ft_key_events.c
index fe9f287..5dbfde0 100644
--- a/src/ft_key_events.c
+++ b/src/ft_key_events.c
@@ -21,7 +21,7 @@ static int8_t
t_player *pl;
pl = clist->plist;
- pl->pos_y += 0.3 * (-1);
+ pl->pos_y += 0.3 * (-1); /* pl->mult; */
pl->pos_x += 0;
return (0);
}
@@ -61,7 +61,7 @@ int
{
t_player *pl;
int8_t (*fun_ptr[4])(t_cub*);
- const int8_t tmp_code = keycode;
+ const int16_t tmp_code = keycode;
fun_ptr[0] = ft_w_key;
fun_ptr[1] = ft_a_key;
@@ -72,14 +72,15 @@ int
(tmp_code == FT_A_KEY) ? (keycode = 1) : 0;
(tmp_code == FT_S_KEY) ? (keycode = 2) : 0;
(tmp_code == FT_D_KEY) ? (keycode = 3) : 0;
+ (tmp_code == 3) ? (keycode = INT16_MAX) : 0;
pl = clist->plist;
if (keycode <= 3)
{
(*fun_ptr[keycode])(clist);
(pl->pos_y < 0.4) ? (pl->pos_y = 0.4) : 0;
(pl->pos_x < 0.4) ? (pl->pos_x = 0.4) : 0;
- (pl->pos_y > clist->map_h - 0.4) ? (pl->pos_y = clist->map_h - 0.4) : 0;
- (pl->pos_x > clist->map_w - 0.4) ? (pl->pos_x = clist->map_w - 0.4) : 0;
+ (pl->pos_y > clist->map_h - 1.4) ? (pl->pos_y = clist->map_h - 1.4) : 0;
+ (pl->pos_x > clist->map_w - 1.4) ? (pl->pos_x = clist->map_w - 1.4) : 0;
ft_drawmap(clist);
return (0);
}