aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--inc/cub3d_structs.h2
-rw-r--r--map/map_one.cub2
-rw-r--r--src/ft_draw_sprite.c8
-rw-r--r--src/ft_init_map.c2
-rw-r--r--src/ft_sort_s_t.c18
5 files changed, 9 insertions, 23 deletions
diff --git a/inc/cub3d_structs.h b/inc/cub3d_structs.h
index ce45a92..b3cd636 100644
--- a/inc/cub3d_structs.h
+++ b/inc/cub3d_structs.h
@@ -206,7 +206,7 @@ typedef struct s_map
uint8_t sprite_var;
uint8_t weapon_var;
int32_t sprite_order[FT_TOTAL_SPRT][4096];
- int32_t st_o[FT_TOTAL_SPRT];
+ int32_t st_o[FT_TOTAL_SPRT + 1];
int32_t heals_nbr;
int32_t weaps_nbr[3];
int32_t heals_order[64];
diff --git a/map/map_one.cub b/map/map_one.cub
index cbc3634..fbe3ef9 100644
--- a/map/map_one.cub
+++ b/map/map_one.cub
@@ -21,7 +21,7 @@ SH 2
1000000000000000001
1000000000000000001
1000000000000000001
-111111111111000000000000000001
+111111111111000000000005000001
10000000000000000T0T0T00000001
100000000000020304000000T0T001
100000000000000000000000000001
diff --git a/src/ft_draw_sprite.c b/src/ft_draw_sprite.c
index 2aa1b43..1b3f912 100644
--- a/src/ft_draw_sprite.c
+++ b/src/ft_draw_sprite.c
@@ -76,11 +76,11 @@ static void
+ powf(cl->plist.pos_y - sprite->s_pos_y, 2))) <= 0)
dist = 0.0001;
rgb.r = (uint8_t)cl->tlist[sprite->current_sprite].ptr[sprite->tex_x
- * 4 + 4 * cl->tlist[sprite->current_sprite].img_h * sprite->tex_y + 2];
+ * 4 + 4 * cl->tlist[sprite->current_sprite].img_w * sprite->tex_y + 2];
rgb.g = (uint8_t)cl->tlist[sprite->current_sprite].ptr[sprite->tex_x
- * 4 + 4 * cl->tlist[sprite->current_sprite].img_h * sprite->tex_y + 1];
+ * 4 + 4 * cl->tlist[sprite->current_sprite].img_w * sprite->tex_y + 1];
rgb.b = (uint8_t)cl->tlist[sprite->current_sprite].ptr[sprite->tex_x
- * 4 + 4 * cl->tlist[sprite->current_sprite].img_h * sprite->tex_y];
+ * 4 + 4 * cl->tlist[sprite->current_sprite].img_w * sprite->tex_y];
*(int*)(cl->img.ptr + ((uint16_t)sprite->x * 4 +
(sprite->y * cl->img.sizeline))) = ft_rgb_to_hex(dist, rgb, cl);
}
@@ -105,7 +105,7 @@ void
sprite->spriteheight) / 128;
if (sprite->transformy > 0 &&
cl->tlist[sprite->current_sprite].ptr[sprite->tex_x * 4 + 4 *
- cl->tlist[sprite->current_sprite].img_h * sprite->tex_y]
+ cl->tlist[sprite->current_sprite].img_w * sprite->tex_y]
&& cl->rlist.wall_dist_tab[sprite->x] > sprite->transformy)
ft_put_sprite(sprite, cl);
sprite->y++;
diff --git a/src/ft_init_map.c b/src/ft_init_map.c
index 72a02fd..1859afe 100644
--- a/src/ft_init_map.c
+++ b/src/ft_init_map.c
@@ -70,7 +70,7 @@ int8_t
i = -1;
while (++i < FT_TOTAL_SPRT)
ft_bzero(mlist->sprite_order[i], 4096);
- ft_bzero(mlist->st_o, FT_TOTAL_SPRT);
+ ft_bzero(mlist->st_o, FT_TOTAL_SPRT + 1);
ft_bzero(mlist->heals_order, 64);
mlist->weaps_nbr[0] = 0;
mlist->weaps_nbr[1] = 0;
diff --git a/src/ft_sort_s_t.c b/src/ft_sort_s_t.c
index 9cbde8b..31ae237 100644
--- a/src/ft_sort_s_t.c
+++ b/src/ft_sort_s_t.c
@@ -34,19 +34,6 @@ float
}
static void
- ft_init_st(int32_t *st_o)
-{
- int8_t i;
-
- i = 0;
- while (i < FT_TOTAL_SPRT)
- {
- st_o[i] = i;
- i++;
- }
-}
-
-static void
ft_swap_them(int16_t i, float **dist_tab)
{
float tmp_i[4096];
@@ -63,11 +50,10 @@ void
int32_t tmp;
i = -1;
- ft_init_st(cl->mlist.st_o);
while (++i < FT_TOTAL_SPRT)
{
- if (i < FT_TOTAL_SPRT && dist_tab[i][0]
- && dist_tab[i][0] < dist_tab[i + 1][0])
+ cl->mlist.st_o[i] = i;
+ if (dist_tab[i][0] < dist_tab[i + 1][0])
{
tmp = cl->mlist.st_o[i];
cl->mlist.st_o[i] = cl->mlist.st_o[i + 1];