From 575990647d8ee677ff9515ecb0c17da9fe66312f Mon Sep 17 00:00:00 2001 From: salaaad2 Date: Mon, 16 Mar 2020 18:57:40 +0100 Subject: fatfingered solution to the sprites problem, changes needed --- src/ft_draw_sprite_extra.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/ft_draw_sprite_extra.c') diff --git a/src/ft_draw_sprite_extra.c b/src/ft_draw_sprite_extra.c index 2545ec0..696bdff 100644 --- a/src/ft_draw_sprite_extra.c +++ b/src/ft_draw_sprite_extra.c @@ -63,11 +63,12 @@ void i = 0; j = 0; + ft_sort_sprites(cl); while (j < cl->mlist.sprite_var) { while (i < cl->mlist.sprite_nbr) { - sprite = cl->sprites[j][i]; + sprite = cl->sprites[j][cl->mlist.sprite_order[i]]; sprite.current_sprite = (j == 0) ? 4 : j + 7; sprite.spritey = sprite.s_pos_x - (cl->plist.pos_x - 0.5); sprite.spritex = sprite.s_pos_y - (cl->plist.pos_y - 0.5); -- cgit v1.2.3 From 8ca4c9563629c60122ba998ad64ad2d999d0902a Mon Sep 17 00:00:00 2001 From: salaaad2 Date: Mon, 16 Mar 2020 19:14:11 +0100 Subject: it just works (unpeu) --- src/ft_draw_sprite_extra.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ft_draw_sprite_extra.c') diff --git a/src/ft_draw_sprite_extra.c b/src/ft_draw_sprite_extra.c index 696bdff..25c9c7a 100644 --- a/src/ft_draw_sprite_extra.c +++ b/src/ft_draw_sprite_extra.c @@ -68,7 +68,7 @@ void { while (i < cl->mlist.sprite_nbr) { - sprite = cl->sprites[j][cl->mlist.sprite_order[i]]; + sprite = cl->sprites[j][cl->mlist.sprite_order[j][i]]; sprite.current_sprite = (j == 0) ? 4 : j + 7; sprite.spritey = sprite.s_pos_x - (cl->plist.pos_x - 0.5); sprite.spritex = sprite.s_pos_y - (cl->plist.pos_y - 0.5); -- cgit v1.2.3 From 322f3191c5a76cf702d4ddd7b1122219be3f5779 Mon Sep 17 00:00:00 2001 From: salaaad2 Date: Mon, 16 Mar 2020 19:24:29 +0100 Subject: fix norme --- src/ft_draw_sprite_extra.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ft_draw_sprite_extra.c') diff --git a/src/ft_draw_sprite_extra.c b/src/ft_draw_sprite_extra.c index 25c9c7a..d81913c 100644 --- a/src/ft_draw_sprite_extra.c +++ b/src/ft_draw_sprite_extra.c @@ -68,7 +68,7 @@ void { while (i < cl->mlist.sprite_nbr) { - sprite = cl->sprites[j][cl->mlist.sprite_order[j][i]]; + sprite = cl->sprites[j][cl->mlist.sprite_order[j][i]]; sprite.current_sprite = (j == 0) ? 4 : j + 7; sprite.spritey = sprite.s_pos_x - (cl->plist.pos_x - 0.5); sprite.spritex = sprite.s_pos_y - (cl->plist.pos_y - 0.5); -- cgit v1.2.3 From b4bee5505af7e0cfb3681ed9b866d51bbc3f2690 Mon Sep 17 00:00:00 2001 From: salaaad2 Date: Mon, 16 Mar 2020 19:26:15 +0100 Subject: fix norme2 --- src/ft_draw_sprite_extra.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ft_draw_sprite_extra.c') diff --git a/src/ft_draw_sprite_extra.c b/src/ft_draw_sprite_extra.c index d81913c..523bf3d 100644 --- a/src/ft_draw_sprite_extra.c +++ b/src/ft_draw_sprite_extra.c @@ -63,7 +63,7 @@ void i = 0; j = 0; - ft_sort_sprites(cl); + ft_sort_sprites(cl); while (j < cl->mlist.sprite_var) { while (i < cl->mlist.sprite_nbr) -- cgit v1.2.3 From 0cde149ec5e478c3d6283136065ff0129231c25d Mon Sep 17 00:00:00 2001 From: salaaad2 Date: Mon, 16 Mar 2020 19:43:16 +0100 Subject: bunchoshit --- src/ft_draw_sprite_extra.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ft_draw_sprite_extra.c') diff --git a/src/ft_draw_sprite_extra.c b/src/ft_draw_sprite_extra.c index 523bf3d..6096522 100644 --- a/src/ft_draw_sprite_extra.c +++ b/src/ft_draw_sprite_extra.c @@ -13,7 +13,6 @@ #include #include #include -#include #include #include @@ -64,6 +63,7 @@ void i = 0; j = 0; ft_sort_sprites(cl); + ft_sort_s_t(cl, cl->sprites); while (j < cl->mlist.sprite_var) { while (i < cl->mlist.sprite_nbr) -- cgit v1.2.3 From 0036fe1e23be842e8baa48162bcdb3bf632b02de Mon Sep 17 00:00:00 2001 From: salaaad2 Date: Wed, 18 Mar 2020 18:59:59 +0100 Subject: gng --- src/ft_draw_sprite_extra.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'src/ft_draw_sprite_extra.c') diff --git a/src/ft_draw_sprite_extra.c b/src/ft_draw_sprite_extra.c index 6096522..9198e8d 100644 --- a/src/ft_draw_sprite_extra.c +++ b/src/ft_draw_sprite_extra.c @@ -17,7 +17,7 @@ #include void - ft_sprite_height(t_cub *cl, t_sprite *sprite) + ft_sprite_h_w(t_cub *cl, t_sprite *sprite) { sprite->spriteheight = abs((int)(cl->wlist.y_size / (sprite->transformy))); sprite->drawstarty = -sprite->spriteheight / 2 + cl->wlist.y_size / 2; @@ -26,11 +26,6 @@ void sprite->drawendy = sprite->spriteheight / 2 + cl->wlist.y_size / 2; if (sprite->drawendy >= (int)cl->wlist.y_size) sprite->drawendy = cl->wlist.y_size - 1; -} - -void - ft_sprite_width(t_cub *cl, t_sprite *sprite) -{ sprite->spritewidth = abs((int)(cl->wlist.x_size / (sprite->transformy))); sprite->drawstartx = -sprite->spritewidth / 2 + sprite->spritescreenx; if (sprite->drawstartx < 0) @@ -40,6 +35,7 @@ void sprite->drawendx = cl->wlist.x_size - 1; } + static void ft_init_sprite(t_cub *cl, t_sprite *sprite) { @@ -63,7 +59,6 @@ void i = 0; j = 0; ft_sort_sprites(cl); - ft_sort_s_t(cl, cl->sprites); while (j < cl->mlist.sprite_var) { while (i < cl->mlist.sprite_nbr) @@ -73,8 +68,7 @@ void sprite.spritey = sprite.s_pos_x - (cl->plist.pos_x - 0.5); sprite.spritex = sprite.s_pos_y - (cl->plist.pos_y - 0.5); ft_init_sprite(cl, &sprite); - ft_sprite_height(cl, &sprite); - ft_sprite_width(cl, &sprite); + ft_sprite_h_w(cl, &sprite); ft_draw_sprite(cl, &sprite); i++; } -- cgit v1.2.3