fix: directions WEST and EAST
This commit is contained in:
parent
424b9aa7b2
commit
189190b3c8
2 changed files with 7 additions and 7 deletions
|
@ -24,9 +24,9 @@ static void move_in_direction(t_point_double *pos, t_direction dir,
|
||||||
pos->y -= value;
|
pos->y -= value;
|
||||||
else if (dir == SOUTH)
|
else if (dir == SOUTH)
|
||||||
pos->y += value;
|
pos->y += value;
|
||||||
else if (dir == EAST)
|
|
||||||
pos->x -= value;
|
|
||||||
else if (dir == WEST)
|
else if (dir == WEST)
|
||||||
|
pos->x -= value;
|
||||||
|
else if (dir == EAST)
|
||||||
pos->x += value;
|
pos->x += value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,8 +45,8 @@ static void push_from_wall(int cx, int cy)
|
||||||
{
|
{
|
||||||
distance_with_side[NORTH] = p.y - (c_d.y - HITBOX);
|
distance_with_side[NORTH] = p.y - (c_d.y - HITBOX);
|
||||||
distance_with_side[SOUTH] = (c_d.y + 1 + HITBOX) - p.y;
|
distance_with_side[SOUTH] = (c_d.y + 1 + HITBOX) - p.y;
|
||||||
distance_with_side[EAST] = p.x - (c_d.x - HITBOX);
|
distance_with_side[WEST] = p.x - (c_d.x - HITBOX);
|
||||||
distance_with_side[WEST] = (c_d.x + 1 + HITBOX) - p.x;
|
distance_with_side[EAST] = (c_d.x + 1 + HITBOX) - p.x;
|
||||||
d_min = 0;
|
d_min = 0;
|
||||||
d = 0;
|
d = 0;
|
||||||
while (++d < 4)
|
while (++d < 4)
|
||||||
|
|
|
@ -22,16 +22,16 @@ void calculate_texdir_and_wallx(t_ray *ray)
|
||||||
if (ray->side && ray->dir.y >= 0)
|
if (ray->side && ray->dir.y >= 0)
|
||||||
ray->texdir = SOUTH;
|
ray->texdir = SOUTH;
|
||||||
if (!ray->side && ray->dir.x < 0)
|
if (!ray->side && ray->dir.x < 0)
|
||||||
ray->texdir = EAST;
|
|
||||||
if (!ray->side && ray->dir.x >= 0)
|
|
||||||
ray->texdir = WEST;
|
ray->texdir = WEST;
|
||||||
|
if (!ray->side && ray->dir.x >= 0)
|
||||||
|
ray->texdir = EAST;
|
||||||
if (!ray->side)
|
if (!ray->side)
|
||||||
ray->wallx = g_map.player.pos.y + ray->perpwalldist \
|
ray->wallx = g_map.player.pos.y + ray->perpwalldist \
|
||||||
* ray->dir.y;
|
* ray->dir.y;
|
||||||
else
|
else
|
||||||
ray->wallx = g_map.player.pos.x + ray->perpwalldist \
|
ray->wallx = g_map.player.pos.x + ray->perpwalldist \
|
||||||
* ray->dir.x;
|
* ray->dir.x;
|
||||||
if (ray->texdir == SOUTH || ray->texdir == EAST)
|
if (ray->texdir == SOUTH || ray->texdir == WEST)
|
||||||
ray->wallx = -ray->wallx;
|
ray->wallx = -ray->wallx;
|
||||||
ray->wallx -= floor((ray->wallx));
|
ray->wallx -= floor((ray->wallx));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue