aboutsummaryrefslogtreecommitdiff
path: root/src/texture.c
diff options
context:
space:
mode:
authorCharles <sircharlesaze@gmail.com>2020-02-05 01:29:44 +0100
committerCharles <sircharlesaze@gmail.com>2020-02-05 01:29:44 +0100
commitaf747497060d8a311204ec58b3ac87cc585462fc (patch)
tree2022e10ac93243772f22f281071a4e0fd5c55f1d /src/texture.c
parent3b224458a5d539bbe00318d939c9a099f3f158e1 (diff)
downloadcub3d-af747497060d8a311204ec58b3ac87cc585462fc.tar.gz
cub3d-af747497060d8a311204ec58b3ac87cc585462fc.tar.bz2
cub3d-af747497060d8a311204ec58b3ac87cc585462fc.zip
better parsing
Diffstat (limited to 'src/texture.c')
-rw-r--r--src/texture.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/texture.c b/src/texture.c
index a5bf611..afeae92 100644
--- a/src/texture.c
+++ b/src/texture.c
@@ -6,7 +6,7 @@
/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/02/01 11:38:43 by cacharle #+# #+# */
-/* Updated: 2020/02/04 03:34:54 by cacharle ### ########.fr */
+/* Updated: 2020/02/04 23:16:02 by cacharle ### ########.fr */
/* */
/* ************************************************************************** */
@@ -45,7 +45,7 @@ t_image *texture_select(t_state *state, t_render_state *rstate)
}
else if (rstate->side == SIDE_WE)
{
- if (rstate->map_pos.x > state->pos.x)
+ if (rstate->map_pos.x < state->pos.x)
return (state->textures + TEX_WEST);
else
return (state->textures + TEX_EAST);
@@ -70,8 +70,8 @@ int texture_x(t_state *state, t_render_state *rstate, t_image *texture)
wall_x = state->pos.x + rstate->perp_dist * rstate->ray.x;
wall_x -= floor(wall_x);
tex_x = (int)(wall_x * (double)texture->width);
- if ((rstate->side == SIDE_NS && rstate->ray.x > 0) ||
- (rstate->side == SIDE_WE && rstate->ray.y < 0))
+ if ((rstate->side == SIDE_NS && rstate->ray.y > 0) ||
+ (rstate->side == SIDE_WE && rstate->ray.x < 0))
tex_x = texture->width - tex_x - 1;
return (tex_x);
}