aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/ft_draw_sprite.c4
-rw-r--r--src/ft_raycasting.c6
2 files changed, 5 insertions, 5 deletions
diff --git a/src/ft_draw_sprite.c b/src/ft_draw_sprite.c
index 701587f..c81e72b 100644
--- a/src/ft_draw_sprite.c
+++ b/src/ft_draw_sprite.c
@@ -22,6 +22,7 @@ void
{
int32_t d;
+ printf("start x : %d\nstart y : %d\nend x : %d\nend y : %d\n", sprite->drawstartx, sprite->drawstarty, sprite->drawendy, sprite->drawendy);
sprite->x = sprite->drawstartx;
while (sprite->x < sprite->drawendx)
{
@@ -32,7 +33,6 @@ void
sprite->x < (int32_t)cl->wlist->x_size)
while (sprite->y < sprite->drawendy)
{
- puts("qwe");
d = (sprite->y) * 256 - cl->wlist->y_size * 128 +
sprite->spriteheight * 128;
sprite->tex_y = ((d * cl->tlist[4].img_h) /
@@ -40,7 +40,7 @@ void
if (*(cl->tlist[4].ptr + sprite->tex_x + sprite->tex_y *
cl->tlist[4].sizeline / 4))
cl->img.ptr[sprite->x + sprite->y *
- cl->img.sizeline / 4] =
+ cl->img.sizeline] =
*(cl->tlist[4].ptr + sprite->tex_x + sprite->tex_y * cl->tlist[4].sizeline / 4);
sprite->y++;
}
diff --git a/src/ft_raycasting.c b/src/ft_raycasting.c
index 59021d3..e7cc4ef 100644
--- a/src/ft_raycasting.c
+++ b/src/ft_raycasting.c
@@ -47,12 +47,12 @@ void
t_sprite sprite;
sprite = cl->sprites;
- sprite.spritex = (sprite.spritex + 0.5) - cl->plist->pos_x;
- sprite.spritey = (sprite.spritey + 0.5) - cl->plist->pos_y;
+ sprite.spritex = (sprite.spritex + 1) - cl->plist->pos_x;
+ sprite.spritey = (sprite.spritey + 1) - cl->plist->pos_y;
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.spritey - cl->plist->dir_x * sprite.spritex);
sprite.transformy = sprite.invdet *
(-cl->plist->plane_y * sprite.spritex + cl->plist->plane_x * sprite.spritey);
sprite.spritescreenx = (int)((cl->wlist->x_size / 2) *