aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ft_basic_keys.c16
-rw-r--r--src/ft_castray_loop.c12
-rw-r--r--src/ft_collision.c16
-rw-r--r--src/ft_damage_bad_boy.c4
-rw-r--r--src/ft_detect.c14
-rw-r--r--src/ft_draw_sprite_extra.c8
-rw-r--r--src/ft_draw_textures.c4
-rw-r--r--src/ft_extra_keys.c21
-rw-r--r--src/ft_floor_cast_inits.c8
-rw-r--r--src/ft_get_player_spawn.c18
-rw-r--r--src/ft_init_lists.c4
-rw-r--r--src/ft_init_s_ray.c2
-rw-r--r--src/ft_select_bad_boy_action.c81
-rw-r--r--src/ft_shoot.c28
14 files changed, 120 insertions, 116 deletions
diff --git a/src/ft_basic_keys.c b/src/ft_basic_keys.c
index 471038b..2d029ff 100644
--- a/src/ft_basic_keys.c
+++ b/src/ft_basic_keys.c
@@ -20,8 +20,8 @@ int
const float move_speed = FT_MOVE_SPEED;
pl = &clist->plist;
- pl->pos_y += move_speed * pl->dir_x;
- pl->pos_x += move_speed * pl->dir_y;
+ pl->pos_y += move_speed * pl->dir_y;
+ pl->pos_x += move_speed * pl->dir_x;
clist->moves = 1;
return (0);
}
@@ -33,8 +33,8 @@ int
const float move_speed = FT_STRAFE_SPEED;
pl = &clist->plist;
- pl->pos_y += move_speed * -pl->dir_y;
- pl->pos_x += move_speed * pl->dir_x;
+ pl->pos_y += move_speed * -pl->dir_x;
+ pl->pos_x += move_speed * pl->dir_y;
clist->moves = 1;
return (0);
}
@@ -46,8 +46,8 @@ int
const float move_speed = FT_MOVE_SPEED;
pl = &clist->plist;
- pl->pos_y += move_speed * -pl->dir_x;
- pl->pos_x += move_speed * -pl->dir_y;
+ pl->pos_y += move_speed * -pl->dir_y;
+ pl->pos_x += move_speed * -pl->dir_x;
clist->moves = 1;
return (0);
}
@@ -59,8 +59,8 @@ int
const float move_speed = FT_STRAFE_SPEED;
pl = &clist->plist;
- pl->pos_y += move_speed * pl->dir_y;
- pl->pos_x += move_speed * -pl->dir_x;
+ pl->pos_y += move_speed * pl->dir_x;
+ pl->pos_x += move_speed * -pl->dir_y;
clist->moves = 1;
return (0);
}
diff --git a/src/ft_castray_loop.c b/src/ft_castray_loop.c
index 28277a7..3d12680 100644
--- a/src/ft_castray_loop.c
+++ b/src/ft_castray_loop.c
@@ -47,21 +47,21 @@ void
pl->cam_x = 2 * i / (float)(wl->x_size) - 1;
cl->rlist.x_ray_pos = pl->pos_y;
cl->rlist.y_ray_pos = pl->pos_x;
- cl->rlist.x_ray_dir = pl->dir_x + pl->plane_x *
+ cl->rlist.x_ray_dir = pl->dir_y + pl->plane_x *
pl->cam_x;
- cl->rlist.y_ray_dir = pl->dir_y + pl->plane_y *
+ cl->rlist.y_ray_dir = pl->dir_x + pl->plane_y *
pl->cam_x;
- cl->rlist.sqx = (int16_t)cl->rlist.x_ray_pos;
- cl->rlist.sqy = (int16_t)cl->rlist.y_ray_pos;
+ cl->rlist.sqy = (int16_t)cl->rlist.x_ray_pos;
+ cl->rlist.sqx = (int16_t)cl->rlist.y_ray_pos;
ft_detect(cl);
if (cl->rlist.side == 0)
{
- cl->rlist.wall_dist = (cl->rlist.sqx - cl->rlist.x_ray_pos +
+ cl->rlist.wall_dist = (cl->rlist.sqy - cl->rlist.x_ray_pos +
(1 - cl->mlist.x_step) / 2) / cl->rlist.x_ray_dir;
}
else
{
- cl->rlist.wall_dist = (cl->rlist.sqy - cl->rlist.y_ray_pos +
+ cl->rlist.wall_dist = (cl->rlist.sqx - cl->rlist.y_ray_pos +
(1 - cl->mlist.y_step) / 2) / cl->rlist.y_ray_dir;
}
}
diff --git a/src/ft_collision.c b/src/ft_collision.c
index 00dab1f..859bfc3 100644
--- a/src/ft_collision.c
+++ b/src/ft_collision.c
@@ -21,13 +21,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_x * FT_COLL_MULT));
else if (key == 1)
- return (pl->pos_x + (pl->dir_x * (FT_COLL_MULT / 2)));
+ return (pl->pos_x + (pl->dir_y * (FT_COLL_MULT / 2)));
else if (key == 2)
- return (pl->pos_x - (pl->dir_y * FT_COLL_MULT));
+ return (pl->pos_x - (pl->dir_x * FT_COLL_MULT));
else if (key == 3)
- return (pl->pos_x - (pl->dir_x * (FT_COLL_MULT / 2)));
+ return (pl->pos_x - (pl->dir_y * (FT_COLL_MULT / 2)));
return ((uint64_t)pl->pos_x);
}
@@ -35,13 +35,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_y * FT_COLL_MULT));
else if (key == 1)
- return (pl->pos_y - (pl->dir_y * (FT_COLL_MULT / 2)));
+ return (pl->pos_y - (pl->dir_x * (FT_COLL_MULT / 2)));
else if (key == 2)
- return (pl->pos_y - (pl->dir_x * FT_COLL_MULT));
+ return (pl->pos_y - (pl->dir_y * FT_COLL_MULT));
else if (key == 3)
- return (pl->pos_y + (pl->dir_y * (FT_COLL_MULT / 2)));
+ return (pl->pos_y + (pl->dir_x * (FT_COLL_MULT / 2)));
return ((uint64_t)pl->pos_y);
}
diff --git a/src/ft_damage_bad_boy.c b/src/ft_damage_bad_boy.c
index c404e94..8f896b0 100644
--- a/src/ft_damage_bad_boy.c
+++ b/src/ft_damage_bad_boy.c
@@ -22,8 +22,8 @@ static uint8_t
i = 0;
while (i < cl->mlist.sprite_nbr[13])
{
- if (lround(cl->sprites[13][i].s_pos_x) == (long)cl->rlist.sqy &&
- lround(cl->sprites[13][i].s_pos_y) == (long)cl->rlist.sqx)
+ if (lround(cl->sprites[13][i].s_pos_x) == (long)cl->rlist.sqx &&
+ lround(cl->sprites[13][i].s_pos_y) == (long)cl->rlist.sqy)
break ;
i++;
}
diff --git a/src/ft_detect.c b/src/ft_detect.c
index 0ef8831..44e5bb2 100644
--- a/src/ft_detect.c
+++ b/src/ft_detect.c
@@ -24,12 +24,12 @@ void
{
cl->mlist.y_step = -1;
cl->rlist.y_side_dist = (cl->rlist.y_ray_pos -
- cl->rlist.sqy) * cl->rlist.y_delta_dist;
+ cl->rlist.sqx) * cl->rlist.y_delta_dist;
}
else
{
cl->mlist.y_step = 1;
- cl->rlist.y_side_dist = (cl->rlist.sqy + 1.0 -
+ cl->rlist.y_side_dist = (cl->rlist.sqx + 1.0 -
cl->rlist.y_ray_pos) * cl->rlist.y_delta_dist;
}
}
@@ -44,12 +44,12 @@ void
{
cl->mlist.x_step = -1;
cl->rlist.x_side_dist = (cl->rlist.x_ray_pos -
- cl->rlist.sqx) * cl->rlist.x_delta_dist;
+ cl->rlist.sqy) * cl->rlist.x_delta_dist;
}
else
{
cl->mlist.x_step = 1;
- cl->rlist.x_side_dist = (cl->rlist.sqx + 1.0 -
+ cl->rlist.x_side_dist = (cl->rlist.sqy + 1.0 -
cl->rlist.x_ray_pos) * cl->rlist.x_delta_dist;
}
}
@@ -65,17 +65,17 @@ void
if (cl->rlist.x_side_dist < cl->rlist.y_side_dist)
{
cl->rlist.x_side_dist += cl->rlist.x_delta_dist;
- cl->rlist.sqx += cl->mlist.x_step;
+ cl->rlist.sqy += cl->mlist.x_step;
cl->rlist.side = 0;
}
else
{
cl->rlist.y_side_dist += cl->rlist.y_delta_dist;
- cl->rlist.sqy += cl->mlist.y_step;
+ cl->rlist.sqx += cl->mlist.y_step;
cl->rlist.side = 1;
}
if (ft_ischarset(FT_CHRST_DETECT,
- cl->mlist.map[cl->rlist.sqx][cl->rlist.sqy]))
+ cl->mlist.map[cl->rlist.sqy][cl->rlist.sqx]))
cl->rlist.hit = 1;
}
}
diff --git a/src/ft_draw_sprite_extra.c b/src/ft_draw_sprite_extra.c
index d85540d..bb26cc2 100644
--- a/src/ft_draw_sprite_extra.c
+++ b/src/ft_draw_sprite_extra.c
@@ -38,10 +38,10 @@ void
static void
ft_init_sprite(t_cub *cl, t_sprite *sprite)
{
- sprite->invdet = 1.0 / (cl->plist.plane_x * cl->plist.dir_y
- - cl->plist.dir_x * cl->plist.plane_y);
- sprite->transformx = sprite->invdet * (cl->plist.dir_y * sprite->spritex
- - cl->plist.dir_x * sprite->spritey);
+ sprite->invdet = 1.0 / (cl->plist.plane_x * cl->plist.dir_x
+ - cl->plist.dir_y * cl->plist.plane_y);
+ sprite->transformx = sprite->invdet * (cl->plist.dir_x * sprite->spritex
+ - cl->plist.dir_y * sprite->spritey);
sprite->transformy = sprite->invdet * (-cl->plist.plane_y * sprite->spritex
+ cl->plist.plane_x * sprite->spritey);
sprite->spritescreenx = (int)(cl->wlist.x_size / 2) *
diff --git a/src/ft_draw_textures.c b/src/ft_draw_textures.c
index 5bf0854..0f8bc43 100644
--- a/src/ft_draw_textures.c
+++ b/src/ft_draw_textures.c
@@ -46,8 +46,8 @@ void
void
ft_choose_tex(uint16_t x, t_cub *clist)
{
- if (clist->rlist.sqy == clist->mlist.nlx
- && clist->rlist.sqx == clist->mlist.nly)
+ if (clist->rlist.sqx == clist->mlist.nlx
+ && clist->rlist.sqy == clist->mlist.nly)
{
clist->w_side = 5;
}
diff --git a/src/ft_extra_keys.c b/src/ft_extra_keys.c
index 03c6f75..dba1026 100644
--- a/src/ft_extra_keys.c
+++ b/src/ft_extra_keys.c
@@ -17,21 +17,24 @@
#include <libft.h>
#include <pthread.h>
+#include <stdio.h>
int
ft_left_key(t_cub *clist)
{
t_player *pl;
- float sav_dir_x;
+ float sav_dir_y;
float sav_plane_x;
const float rot_speed = FT_ROT_SPEED;
pl = &clist->plist;
- 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);
+ sav_dir_y = pl->dir_y;
+ pl->dir_y = pl->dir_y * cos(rot_speed) - pl->dir_x * sin(rot_speed);
+ pl->dir_x = sav_dir_y * sin(rot_speed) + pl->dir_x * cos(rot_speed);
sav_plane_x = pl->plane_x;
pl->plane_x = pl->plane_x * cos(rot_speed) - pl->plane_y * sin(rot_speed);
pl->plane_y = sav_plane_x * sin(rot_speed) + pl->plane_y * cos(rot_speed);
+ printf("dir_y %f\n", pl->dir_y);
+ printf("dir_x %f\n\n", pl->dir_x);
return (0);
}
@@ -39,17 +42,19 @@ int
ft_right_key(t_cub *clist)
{
t_player *pl;
- float sav_dir_x;
+ float sav_dir_y;
float sav_plane_x;
const float rot_speed = FT_ROT_SPEED;
pl = &clist->plist;
- 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);
+ sav_dir_y = pl->dir_y;
+ pl->dir_y = pl->dir_y * cos(-rot_speed) - pl->dir_x * sin(-rot_speed);
+ pl->dir_x = sav_dir_y * sin(-rot_speed) + pl->dir_x * cos(-rot_speed);
sav_plane_x = pl->plane_x;
pl->plane_x = pl->plane_x * cos(-rot_speed) - pl->plane_y * sin(-rot_speed);
pl->plane_y = sav_plane_x * sin(-rot_speed) + pl->plane_y * cos(-rot_speed);
+ printf("dir_y %f\n", pl->dir_y);
+ printf("dir_x %f\n\n", pl->dir_x);
return (0);
}
diff --git a/src/ft_floor_cast_inits.c b/src/ft_floor_cast_inits.c
index 92b660b..22c735a 100644
--- a/src/ft_floor_cast_inits.c
+++ b/src/ft_floor_cast_inits.c
@@ -33,10 +33,10 @@ void
void
ft_floor_cast_inits(uint16_t y, t_ray *rl, t_cub *cl)
{
- rl->x_f_ray_dir = cl->plist.dir_x - cl->plist.plane_x;
- rl->y_f_ray_dir = cl->plist.dir_y - cl->plist.plane_y;
- rl->x_f_ray_dir_bis = cl->plist.dir_x + cl->plist.plane_x;
- rl->y_f_ray_dir_bis = cl->plist.dir_y + cl->plist.plane_y;
+ rl->x_f_ray_dir = cl->plist.dir_y - cl->plist.plane_x;
+ rl->y_f_ray_dir = cl->plist.dir_x - cl->plist.plane_y;
+ rl->x_f_ray_dir_bis = cl->plist.dir_y + cl->plist.plane_x;
+ rl->y_f_ray_dir_bis = cl->plist.dir_x + cl->plist.plane_y;
rl->p = y - cl->wlist.y_size / 2;
cl->plist.pos_z = 0.5 * cl->wlist.y_size;
rl->row_dist = cl->plist.pos_z / rl->p;
diff --git a/src/ft_get_player_spawn.c b/src/ft_get_player_spawn.c
index c506775..25f9b75 100644
--- a/src/ft_get_player_spawn.c
+++ b/src/ft_get_player_spawn.c
@@ -18,12 +18,12 @@
static void
ft_get_e_dir(t_player *pl)
{
- float sav_dir_x;
+ float sav_dir_y;
float sav_plane_x;
- sav_dir_x = pl->dir_x;
- pl->dir_x = -pl->dir_y;
- pl->dir_y = sav_dir_x;
+ sav_dir_y = pl->dir_y;
+ pl->dir_y = -pl->dir_x;
+ pl->dir_x = sav_dir_y;
sav_plane_x = pl->plane_x;
pl->plane_x = -pl->plane_y;
pl->plane_y = sav_plane_x;
@@ -32,8 +32,8 @@ static void
static void
ft_get_s_dir(t_player *pl)
{
- pl->dir_x = -pl->dir_x;
pl->dir_y = -pl->dir_y;
+ pl->dir_x = -pl->dir_x;
pl->plane_x = -pl->plane_x;
pl->plane_y = -pl->plane_y;
}
@@ -41,12 +41,12 @@ static void
static void
ft_get_w_dir(t_player *pl)
{
- float sav_dir_x;
+ float sav_dir_y;
float sav_plane_x;
- sav_dir_x = pl->dir_x;
- pl->dir_x = pl->dir_y;
- pl->dir_y = -sav_dir_x;
+ sav_dir_y = pl->dir_y;
+ pl->dir_y = pl->dir_x;
+ pl->dir_x = -sav_dir_y;
sav_plane_x = pl->plane_x;
pl->plane_x = pl->plane_y;
pl->plane_y = -sav_plane_x;
diff --git a/src/ft_init_lists.c b/src/ft_init_lists.c
index 2105a64..76b56e3 100644
--- a/src/ft_init_lists.c
+++ b/src/ft_init_lists.c
@@ -47,8 +47,8 @@ t_player
plist.start_x = 0;
plist.start_y = 0;
plist.cam_x = 0;
- plist.dir_x = -1;
- plist.dir_y = 0;
+ plist.dir_y = -1;
+ plist.dir_x = 0;
plist.plane_x = 0;
plist.plane_y = 0.66;
plist.has_weapon[0] = 0;
diff --git a/src/ft_init_s_ray.c b/src/ft_init_s_ray.c
index 0d4ba96..d13f17d 100644
--- a/src/ft_init_s_ray.c
+++ b/src/ft_init_s_ray.c
@@ -32,8 +32,8 @@ t_ray
rl.x_delta_dist = 0;
rl.y_delta_dist = 0;
rl.side = 0;
- rl.sqx = 0;
rl.sqy = 0;
+ rl.sqx = 0;
rl.hit = 0;
return (rl);
}
diff --git a/src/ft_select_bad_boy_action.c b/src/ft_select_bad_boy_action.c
index 71122eb..f0ce7e7 100644
--- a/src/ft_select_bad_boy_action.c
+++ b/src/ft_select_bad_boy_action.c
@@ -79,47 +79,46 @@ static void
cl->bad_boy[i].sleep = 1;
}
-/* int8_t */
-/* ft_can_it_shoot(int8_t id, t_cub *cl) */
-/* { */
-/* uint8_t hit; */
-/* t_win *wl; */
-/* t_player *pl; */
+int8_t
+ ft_can_it_shoot(int8_t id, t_cub *cl)
+{
+ uint8_t hit;
+ t_win *wl;
+ t_player *pl;
-/* (void)id; */
-/* (void)cl; */
-/* wl = &cl->wlist; */
-/* pl = &cl->plist; */
-/* hit = 0; */
-/* cl->rlist.x_ray_pos = cl->plist.pos_y; */
-/* cl->rlist.y_ray_pos = cl->plist.pos_x; */
-/* cl->rlist.x_ray_dir = pl->dir_x; */
-/* cl->rlist.y_ray_dir = pl->dir_y; */
-/* cl->rlist.sqx = (int16_t)cl->rlist.x_ray_pos; */
-/* cl->rlist.sqy = (int16_t)cl->rlist.y_ray_pos; */
-/* ft_detection_init_x(cl); */
-/* ft_detection_init_y(cl); */
-/* while (hit == 0 && (cl->rlist.sqx != (uint64_t)cl->sprites[13][id].s_pos_y && */
-/* cl->rlist.sqy != (uint64_t)cl->sprites[13][id].s_pos_x)) */
-/* { */
-/* if (cl->rlist.x_side_dist < cl->rlist.y_side_dist) */
-/* { */
-/* cl->rlist.x_side_dist += cl->rlist.x_delta_dist; */
-/* cl->rlist.sqx += cl->mlist.x_step; */
-/* cl->rlist.side = 0; */
-/* } */
-/* else */
-/* { */
-/* cl->rlist.y_side_dist += cl->rlist.y_delta_dist; */
-/* cl->rlist.sqy += cl->mlist.y_step; */
-/* cl->rlist.side = 1; */
-/* } */
-/* if (cl->mlist.map[cl->rlist.sqx][cl->rlist.sqy] == '1') */
-/* hit = 1; */
-/* } */
-/* ft_printf("%hhu\n", hit); */
-/* return ((hit == 1) ? (0) : (1)); */
-/* } */
+ (void)id;
+ (void)cl;
+ wl = &cl->wlist;
+ pl = &cl->plist;
+ hit = 0;
+ cl->rlist.x_ray_pos = cl->plist.pos_y;
+ cl->rlist.y_ray_pos = cl->plist.pos_x;
+ cl->rlist.x_ray_dir = pl->dir_y;
+ cl->rlist.y_ray_dir = pl->dir_x;
+ cl->rlist.sqy = (uint64_t)cl->rlist.x_ray_pos;
+ cl->rlist.sqx = (uint64_t)cl->rlist.y_ray_pos;
+ ft_detection_init_x(cl);
+ ft_detection_init_y(cl);
+ while (hit == 0 && (cl->rlist.sqy != (uint64_t)cl->sprites[13][id].s_pos_y &&
+ cl->rlist.sqx != (uint64_t)cl->sprites[13][id].s_pos_x))
+ {
+ if (cl->rlist.x_side_dist < cl->rlist.y_side_dist)
+ {
+ cl->rlist.x_side_dist += cl->rlist.x_delta_dist;
+ cl->rlist.sqy += cl->mlist.x_step;
+ cl->rlist.side = 0;
+ }
+ else
+ {
+ cl->rlist.y_side_dist += cl->rlist.y_delta_dist;
+ cl->rlist.sqx += cl->mlist.y_step;
+ cl->rlist.side = 1;
+ }
+ if (cl->mlist.map[cl->rlist.sqy][cl->rlist.sqx] == '1')
+ hit = 1;
+ }
+ return ((hit == 1) ? (0) : (1));
+}
void
ft_select_bad_boy_action(t_cub *cl)
@@ -132,7 +131,7 @@ void
can_shoot = 0;
while (++i < cl->mlist.sprite_nbr[13])
{
- /* can_shoot = ft_can_it_shoot(i, cl); */
+ can_shoot = ft_can_it_shoot(i, cl);
if (cl->bad_boy[i].sleep == 0 && cl->bad_boy[i].life > 0 &&
(ft_get_dist(cl->sprites[13][i], cl) > FT_ENMY_SIGHT_RANGE ||
can_shoot == 0))
diff --git a/src/ft_shoot.c b/src/ft_shoot.c
index 1797b2d..248ea6e 100644
--- a/src/ft_shoot.c
+++ b/src/ft_shoot.c
@@ -28,8 +28,8 @@ static void
{
while (++j < 4096)
{
- if (cl->sprites[i][j].s_pos_x == cl->rlist.sqy &&
- cl->sprites[i][j].s_pos_y == cl->rlist.sqx)
+ if (cl->sprites[i][j].s_pos_x == cl->rlist.sqx &&
+ cl->sprites[i][j].s_pos_y == cl->rlist.sqy)
{
stop = 1;
break ;
@@ -39,7 +39,7 @@ static void
break ;
j = -1;
}
- cl->mlist.map[cl->rlist.sqx][cl->rlist.sqy] = '0';
+ cl->mlist.map[cl->rlist.sqy][cl->rlist.sqx] = '0';
cl->sprites[i][j].s_pos_x = 0;
cl->sprites[i][j].s_pos_y = 0;
}
@@ -48,8 +48,8 @@ static int8_t
ft_weap_range(t_cub *cl)
{
if (cl->plist.handles_weapon == 0 &&
- sqrtf(powf(cl->plist.pos_x - cl->rlist.sqy, 2)
- + powf(cl->plist.pos_y - cl->rlist.sqx, 2)) > 1.6)
+ sqrtf(powf(cl->plist.pos_x - cl->rlist.sqx, 2)
+ + powf(cl->plist.pos_y - cl->rlist.sqy, 2)) > 1.6)
return (0);
return (1);
}
@@ -60,13 +60,13 @@ static void
if (cl->rlist.x_side_dist < cl->rlist.y_side_dist)
{
cl->rlist.x_side_dist += cl->rlist.x_delta_dist;
- cl->rlist.sqx += cl->mlist.x_step;
+ cl->rlist.sqy += cl->mlist.x_step;
cl->rlist.side = 0;
}
else
{
cl->rlist.y_side_dist += cl->rlist.y_delta_dist;
- cl->rlist.sqy += cl->mlist.y_step;
+ cl->rlist.sqx += cl->mlist.y_step;
cl->rlist.side = 1;
}
}
@@ -78,18 +78,18 @@ static void
{
ft_set_sq(cl);
if (ft_ischarset(FT_CHRST_SPRITES,
- cl->mlist.map[cl->rlist.sqx][cl->rlist.sqy]) && ft_weap_range(cl))
+ cl->mlist.map[cl->rlist.sqy][cl->rlist.sqx]) && ft_weap_range(cl))
{
hit = 1;
ft_hide_sprite(cl);
}
- else if (cl->mlist.map[cl->rlist.sqx][cl->rlist.sqy] == 'e' &&
+ else if (cl->mlist.map[cl->rlist.sqy][cl->rlist.sqx] == 'e' &&
ft_weap_range(cl))
{
hit = 1;
ft_damage_bad_boy(cl);
}
- else if (cl->mlist.map[cl->rlist.sqx][cl->rlist.sqy] == '1')
+ else if (cl->mlist.map[cl->rlist.sqy][cl->rlist.sqx] == '1')
hit = 1;
}
}
@@ -104,10 +104,10 @@ void
pl = &cl->plist;
cl->rlist.x_ray_pos = pl->pos_y;
cl->rlist.y_ray_pos = pl->pos_x;
- cl->rlist.x_ray_dir = pl->dir_x;
- cl->rlist.y_ray_dir = pl->dir_y;
- cl->rlist.sqx = (uint64_t)cl->rlist.x_ray_pos;
- cl->rlist.sqy = (uint64_t)cl->rlist.y_ray_pos;
+ cl->rlist.x_ray_dir = pl->dir_y;
+ cl->rlist.y_ray_dir = pl->dir_x;
+ cl->rlist.sqy = (uint64_t)cl->rlist.x_ray_pos;
+ cl->rlist.sqx = (uint64_t)cl->rlist.y_ray_pos;
ft_detection_init_x(cl);
ft_detection_init_y(cl);
ft_hitscan(cl, 0);