diff options
author | Rudy Bousset <rbousset@z2r5p2.le-101.fr> | 2020-03-12 16:55:03 +0100 |
---|---|---|
committer | Rudy Bousset <rbousset@z2r5p2.le-101.fr> | 2020-03-12 16:55:14 +0100 |
commit | accac39aba634dd91e90ff4e44e6421ac87a63c0 (patch) | |
tree | 4aa3c7a82331e47d490a5fca04462c51283c2c6a | |
parent | Merge branch 'multis' (diff) | |
download | 42-cub3d-accac39aba634dd91e90ff4e44e6421ac87a63c0.tar.gz 42-cub3d-accac39aba634dd91e90ff4e44e6421ac87a63c0.tar.bz2 42-cub3d-accac39aba634dd91e90ff4e44e6421ac87a63c0.tar.xz 42-cub3d-accac39aba634dd91e90ff4e44e6421ac87a63c0.tar.zst 42-cub3d-accac39aba634dd91e90ff4e44e6421ac87a63c0.zip |
removed junk
-rw-r--r-- | src/\ | 84 |
1 files changed, 0 insertions, 84 deletions
@@ -1,84 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_draw_sprite_extra.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: rbousset <marvin@42.fr> +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2020/02/24 20:22:45 by rbousset #+# #+# */ -/* Updated: 2020/03/09 18:56:01 by rbousset ### ########lyon.fr */ -/* */ -/* ************************************************************************** */ - -#include <libft.h> -#include <cub3d.h> -#include <stdint.h> -#include <stdio.h> -#include <stdlib.h> -#include <math.h> - -void - ft_sprite_height(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; - if (sprite->drawstarty < 0) - sprite->drawstarty = 0; - 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) - sprite->drawstartx = 0; - sprite->drawendx = sprite->spritewidth / 2 + sprite->spritescreenx; - if (sprite->drawendx >= (int)cl->wlist.x_size) - sprite->drawendx = cl->wlist.x_size - 1; -} - -void - ft_calc_sprite(t_cub *cl) -{ - t_sprite sprite; - int32_t i; - int32_t j; - - i = 0; - j = 0; - printf("%d\n", cl->sprites[0][0].s_pos_x); - printf("%d\n", cl->sprites[1][0].s_pos_x); - printf("%d\n", cl->sprites[2][0].s_pos_x); - printf("%d\n", cl->sprites[3][0].s_pos_x); - cl->sprites[2][0].s_pos_x = 4; - cl->sprites[2][0].s_pos_y = 3; - while (j < cl->mlist.sprite_var) - { - while (i < cl->mlist.sprite_nbr) - { - sprite = cl->sprites[j][i]; - sprite.current_sprite = (j == 0) ? 4 : j + 7; - /* printf("j :%d curr : %d\n", j, sprite.current_sprite); */ - sprite.spritey = sprite.s_pos_x - (cl->plist.pos_x - 0.5); - sprite.spritex = sprite.s_pos_y - (cl->plist.pos_y - 0.5); - 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.transformy = sprite.invdet * (-cl->plist.plane_y * sprite.spritex - + cl->plist.plane_x * sprite.spritey); - sprite.spritescreenx = (int)(cl->wlist.x_size / 2) * - (1 + sprite.transformx / sprite.transformy); - ft_sprite_height(cl, &sprite); - ft_sprite_width(cl, &sprite); - ft_draw_sprite(cl, &sprite); - i++; - } - i = 0; - j++; - } -} |