aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--inc/cub3d_structs.h4
-rw-r--r--src/ft_draw_verline.c2
-rw-r--r--src/ft_floor_cast.c21
3 files changed, 13 insertions, 14 deletions
diff --git a/inc/cub3d_structs.h b/inc/cub3d_structs.h
index cba13c0..7072628 100644
--- a/inc/cub3d_structs.h
+++ b/inc/cub3d_structs.h
@@ -130,8 +130,8 @@ typedef struct s_ray
float y_side_dist;
float x_delta_dist;
float y_delta_dist;
- double floor_x_wall;
- double floor_y_wall;
+ float floor_x_wall;
+ float floor_y_wall;
int16_t wall_t;
int16_t wall_b;
uint8_t side;
diff --git a/src/ft_draw_verline.c b/src/ft_draw_verline.c
index 9abb73f..dd7697a 100644
--- a/src/ft_draw_verline.c
+++ b/src/ft_draw_verline.c
@@ -28,7 +28,6 @@ static void
cl->img.ptr[x * 4 + cl->wlist.x_size * y + 3] = (int8_t)0;
}
-#include <stdio.h>
static void
ft_draw_floor(t_cub *cl, int32_t y, int32_t x)
{
@@ -57,7 +56,6 @@ static void
? (cl->tlist[6].tex_x) : (-cl->tlist[6].tex_x);
cl->tlist[6].tex_y = (cl->tlist[6].tex_y > 0)
? (cl->tlist[6].tex_y) : (-cl->tlist[6].tex_y);
- /* printf("tex_x %d | tex_y %d\n", cl->tlist[6].tex_x, cl->tlist[6].tex_y); */
ft_draw_floor_tex(cl, y, x, cl->tlist[6].tex_y);
/* *(int*)(cl->img.ptr + */
/* (x * 4 + (y * cl->img.sizeline))) */
diff --git a/src/ft_floor_cast.c b/src/ft_floor_cast.c
index e7d3b0f..d9afa5a 100644
--- a/src/ft_floor_cast.c
+++ b/src/ft_floor_cast.c
@@ -13,32 +13,33 @@
#include <cub3d.h>
#include <stdint.h>
+#include <stdio.h>
void
ft_floor_cast(t_cub *cl)
{
t_ray *rl;
- const uint32_t map_x = (uint32_t)&cl->plist.pos_x;
- const uint32_t map_y = (uint32_t)&cl->plist.pos_y;
+ const uint32_t map_x = (uint32_t)cl->plist.pos_x;
+ const uint32_t map_y = (uint32_t)cl->plist.pos_y;
rl = &cl->rlist;
if (rl->side == 0 && rl->x_ray_dir > 0)
{
- rl->floor_x_wall = (double)map_x;
- rl->floor_y_wall = (double)map_y + rl->wall_hit_x;
+ rl->floor_x_wall = (float)map_x;
+ rl->floor_y_wall = (float)map_y + rl->wall_hit_x;
}
else if (rl->side == 0 && rl->x_ray_dir < 0)
{
- rl->floor_x_wall = (double)map_x + 1.0;
- rl->floor_y_wall = (double)map_y + rl->wall_hit_x;
+ rl->floor_x_wall = (float)map_x + 1.0;
+ rl->floor_y_wall = (float)map_y + rl->wall_hit_x;
}
else if (rl->side == 1 && rl->y_ray_dir > 0)
{
- rl->floor_x_wall = (double)map_x + rl->wall_hit_x;
- rl->floor_y_wall = (double)map_y;
+ rl->floor_x_wall = (float)map_x + rl->wall_hit_x;
+ rl->floor_y_wall = (float)map_y;
}
else
{
- rl->floor_x_wall = (double)map_x + rl->wall_hit_x;
- rl->floor_y_wall = (double)map_y + 1.0;
+ rl->floor_x_wall = (float)map_x + rl->wall_hit_x;
+ rl->floor_y_wall = (float)map_y + 1.0;
}
}