diff options
author | Rudy Bousset <rbousset@z3r8p1.le-101.fr> | 2020-02-13 19:42:05 +0100 |
---|---|---|
committer | Rudy Bousset <rbousset@z3r8p1.le-101.fr> | 2020-02-13 19:42:05 +0100 |
commit | e29dd2fa3688e1e96a25af3b651da574af08aa90 (patch) | |
tree | cb6486fc91f1b93e61e4dcda25d359095e6aa108 /src/ft_key_events.c | |
parent | Better code structure (diff) | |
download | 42-cub3d-e29dd2fa3688e1e96a25af3b651da574af08aa90.tar.gz 42-cub3d-e29dd2fa3688e1e96a25af3b651da574af08aa90.tar.bz2 42-cub3d-e29dd2fa3688e1e96a25af3b651da574af08aa90.tar.xz 42-cub3d-e29dd2fa3688e1e96a25af3b651da574af08aa90.tar.zst 42-cub3d-e29dd2fa3688e1e96a25af3b651da574af08aa90.zip |
Splited structs
Diffstat (limited to 'src/ft_key_events.c')
-rw-r--r-- | src/ft_key_events.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/ft_key_events.c b/src/ft_key_events.c index 40f211a..a08a534 100644 --- a/src/ft_key_events.c +++ b/src/ft_key_events.c @@ -60,6 +60,7 @@ int ft_key_event(int keycode, t_cub *clist) { t_player *pl; + t_map *ml; int8_t (*fun_ptr[4])(t_cub*); const int16_t tmp_code = keycode; @@ -75,13 +76,14 @@ int (tmp_code == 3) ? (keycode = INT16_MAX) : 0; (tmp_code == 4) ? (keycode = INT16_MAX) : 0; pl = clist->plist; + ml = clist->mlist; 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 - 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; + (pl->pos_y > ml->map_h - 1.4) ? (pl->pos_y = ml->map_h - 1.4) : 0; + (pl->pos_x > ml->map_w - 1.4) ? (pl->pos_x = ml->map_w - 1.4) : 0; ft_draw_scene(clist); return (0); } |