aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_key_loop.c
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-03-03 14:47:33 +0100
committerJozanLeClerc <bousset.rudy@gmail.com>2020-03-03 14:47:33 +0100
commit8866ef5699150d0549096efa94fc311ff7a48dc7 (patch)
tree4a03267f7e7f9b399a9ad0536b50ba6a90407e47 /src/ft_key_loop.c
parentMusic is pretty bav (diff)
download42-cub3d-8866ef5699150d0549096efa94fc311ff7a48dc7.tar.gz
42-cub3d-8866ef5699150d0549096efa94fc311ff7a48dc7.tar.bz2
42-cub3d-8866ef5699150d0549096efa94fc311ff7a48dc7.tar.xz
42-cub3d-8866ef5699150d0549096efa94fc311ff7a48dc7.tar.zst
42-cub3d-8866ef5699150d0549096efa94fc311ff7a48dc7.zip
Changing stuff
Diffstat (limited to '')
-rw-r--r--src/ft_key_loop.c38
1 files changed, 19 insertions, 19 deletions
diff --git a/src/ft_key_loop.c b/src/ft_key_loop.c
index a7eaccf..0c759db 100644
--- a/src/ft_key_loop.c
+++ b/src/ft_key_loop.c
@@ -19,13 +19,13 @@ static uint64_t
ft_find_x(int32_t key, const t_player *pl)
{
if (key == 0)
- return (pl->pos_x + (pl->dir_y * FT_COLL_MULT));
+ return (pl.pos_x + (pl.dir_y * FT_COLL_MULT));
else if (key == 1)
- return (pl->pos_x + (pl->dir_x * (FT_COLL_MULT / 2)));
+ return (pl.pos_x + (pl.dir_x * (FT_COLL_MULT / 2)));
else if (key == 2)
- return (pl->pos_x - (pl->dir_y * FT_COLL_MULT));
+ return (pl.pos_x - (pl.dir_y * FT_COLL_MULT));
else if (key == 3)
- return (pl->pos_x - (pl->dir_x * (FT_COLL_MULT / 2)));
+ return (pl.pos_x - (pl.dir_x * (FT_COLL_MULT / 2)));
return (1);
}
@@ -33,13 +33,13 @@ static uint64_t
ft_find_y(int32_t key, const t_player *pl)
{
if (key == 0)
- return (pl->pos_y + (pl->dir_x * FT_COLL_MULT));
+ return (pl.pos_y + (pl.dir_x * FT_COLL_MULT));
else if (key == 1)
- return (pl->pos_y - (pl->dir_y * (FT_COLL_MULT / 2)));
+ return (pl.pos_y - (pl.dir_y * (FT_COLL_MULT / 2)));
else if (key == 2)
- return (pl->pos_y - (pl->dir_x * FT_COLL_MULT));
+ return (pl.pos_y - (pl.dir_x * FT_COLL_MULT));
else if (key == 3)
- return (pl->pos_y + (pl->dir_y * (FT_COLL_MULT / 2)));
+ return (pl.pos_y + (pl.dir_y * (FT_COLL_MULT / 2)));
return (1);
}
@@ -50,13 +50,13 @@ static void
uint64_t y;
t_player *pl;
- pl = cl->plist;
+ pl = cl.plist;
x = ft_find_x(key, pl);
y = ft_find_y(key, pl);
- if (cl->mlist->map[y][x] == '1' || cl->mlist->map[y][x] == '2')
+ if (cl.mlist.map[y][x] == '1' || cl.mlist.map[y][x] == '2')
{
- pl->pos_y = old_y;
- pl->pos_x = old_x;
+ pl.pos_y = old_y;
+ pl.pos_x = old_x;
}
}
@@ -64,22 +64,22 @@ int
ft_key_loop(t_cub *cl)
{
uint8_t i;
- const float old_y = cl->plist->pos_y;
- const float old_x = cl->plist->pos_x;
+ const float old_y = cl.plist.pos_y;
+ const float old_x = cl.plist.pos_x;
i = 0;
- while (i < 5 && cl->key_input[i] != -1 && cl->key_input[i] <= 5)
+ while (i < 5 && cl.key_input[i] != -1 && cl.key_input[i] <= 5)
{
- cl->key_ptr[cl->key_input[i]](cl);
- ft_collision(old_y, old_x, cl->key_input[i], cl);
- if (cl->mlist->isnlvl)
+ cl.key_ptr[cl.key_input[i]](cl);
+ ft_collision(old_y, old_x, cl.key_input[i], cl);
+ if (cl.mlist.isnlvl)
{
if (ft_warp_level(cl) < 0)
return (ft_exit(FT_RET_FAILED_STRUCTS, cl));
}
i++;
}
- if (cl->key_input[0] != -1)
+ if (cl.key_input[0] != -1)
ft_draw_scene(cl);
return (0);
}