diff options
Diffstat (limited to 'src/ft_key_events.c')
-rw-r--r-- | src/ft_key_events.c | 56 |
1 files changed, 10 insertions, 46 deletions
diff --git a/src/ft_key_events.c b/src/ft_key_events.c index d400684..5ca3d36 100644 --- a/src/ft_key_events.c +++ b/src/ft_key_events.c @@ -21,26 +21,8 @@ static int t_player *pl; pl = clist->plist; - if (pl->view_side == 1) - { - if ((pl->pos_y -= 0.3) < 0.4) - pl->pos_y = 0.4; - } - else if (pl->view_side == 2) - { - if ((pl->pos_x += 0.3) > clist->map_w - 0.4) - pl->pos_x = clist->map_w - 0.4; - } - else if (pl->view_side == 3) - { - if ((pl->pos_y += 0.3) > clist->map_h - 0.4) - pl->pos_y = clist->map_h - 0.4; - } - else if (pl->view_side == 4) - { - if ((pl->pos_x -= 0.3) < 0.4) - pl->pos_x = 0.4; - } + if ((pl->pos_y -= 0.3) < 0.4) + pl->pos_y = 0.4; ft_drawmap(clist); return (0); } @@ -51,9 +33,9 @@ static int t_player *pl; pl = clist->plist; - pl->view_side -= 1.0; - if (pl->view_side < 1.0) - pl->view_side = 4.0; + if ((pl->pos_x -= 0.3) < 0.4) + pl->pos_x = 0.4; + ft_drawmap(clist); return (0); } @@ -63,26 +45,8 @@ static int t_player *pl; pl = clist->plist; - if (pl->view_side == 1) - { - if ((pl->pos_y += 0.3) > clist->map_h - 0.4) - pl->pos_y = clist->map_h - 0.4; - } - else if (pl->view_side == 2) - { - if ((pl->pos_x -= 0.3) < 0.4) - pl->pos_x = 0.4; - } - else if (pl->view_side == 3) - { - if ((pl->pos_y -= 0.3) < 0.4) - pl->pos_y = 0.4; - } - else if (pl->view_side == 4) - { - if ((pl->pos_x += 0.3) > clist->map_w - 0.4) - pl->pos_x = clist->map_w - 0.4; - } + if ((pl->pos_y += 0.3) > clist->map_h - 0.4) + pl->pos_y = clist->map_h - 0.4; ft_drawmap(clist); return (0); } @@ -93,9 +57,9 @@ static int t_player *pl; pl = clist->plist; - pl->view_side += 1.0; - if (pl->view_side > 4.0) - pl->view_side = 1.0; + if ((pl->pos_x += 0.3) > clist->map_w - 0.4) + pl->pos_x = clist->map_w - 0.4; + ft_drawmap(clist); return (0); } |