aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsalaaad2 <arthudurant263@gmail.com>2020-02-28 10:57:51 +0100
committersalaaad2 <arthudurant263@gmail.com>2020-02-28 10:57:51 +0100
commit859f84a4c6819e91d38b1cacdc39d94a7df71969 (patch)
tree637805150f4641fd0eb11b8f3c0e9b6cf58bf8a1
parentonly one floating sprite, one line / 2 correct, start and end seems flawed (diff)
download42-cub3d-859f84a4c6819e91d38b1cacdc39d94a7df71969.tar.gz
42-cub3d-859f84a4c6819e91d38b1cacdc39d94a7df71969.tar.bz2
42-cub3d-859f84a4c6819e91d38b1cacdc39d94a7df71969.tar.xz
42-cub3d-859f84a4c6819e91d38b1cacdc39d94a7df71969.tar.zst
42-cub3d-859f84a4c6819e91d38b1cacdc39d94a7df71969.zip
on est al
-rw-r--r--inc/cub3d_defines.h2
-rw-r--r--src/ft_draw_sprite.c34
2 files changed, 21 insertions, 15 deletions
diff --git a/inc/cub3d_defines.h b/inc/cub3d_defines.h
index c4be489..e201228 100644
--- a/inc/cub3d_defines.h
+++ b/inc/cub3d_defines.h
@@ -49,7 +49,7 @@
** ====== MOVE SPEED ======
*/
-# define FT_MOVE_SPEED 0.2
+# define FT_MOVE_SPEED 0.1
# define FT_STRAFE_SPEED 0.1
# define FT_ROT_SPEED 0.09
diff --git a/src/ft_draw_sprite.c b/src/ft_draw_sprite.c
index c81e72b..45f9217 100644
--- a/src/ft_draw_sprite.c
+++ b/src/ft_draw_sprite.c
@@ -24,6 +24,10 @@ void
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;
+ /* sprite->drawstartx = 1000; */
+ /* sprite->drawstarty = 200; */
+ /* sprite->drawendx = 700; */
+ /* sprite->drawendy = 1000; */
while (sprite->x < sprite->drawendx)
{
sprite->tex_x = (int32_t)((sprite->x - (-sprite->spritewidth / 2 +
@@ -31,20 +35,22 @@ void
sprite->y = sprite->drawstarty;
if (sprite->transformy > 0 && sprite->x >= 0 &&
sprite->x < (int32_t)cl->wlist->x_size)
- while (sprite->y < sprite->drawendy)
- {
- d = (sprite->y) * 256 - cl->wlist->y_size * 128 +
- sprite->spriteheight * 128;
- sprite->tex_y = ((d * cl->tlist[4].img_h) /
- sprite->spriteheight) / 128;
- 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] =
- *(cl->tlist[4].ptr + sprite->tex_x + sprite->tex_y * cl->tlist[4].sizeline / 4);
- sprite->y++;
- }
+ while (sprite->y < sprite->drawendy)
+ {
+ d = (sprite->y) * 256 - cl->wlist->y_size * 128 +
+ sprite->spriteheight * 128;
+ sprite->tex_y = ((d * cl->tlist[4].img_h) /
+ sprite->spriteheight) / 128;
+ 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] =
+ *(cl->tlist[4].ptr + sprite->tex_x + sprite->tex_y * cl->tlist[4].sizeline / 4);
+
+ }
+ sprite->y++;
+ }
sprite->x++;
}
-
}