aboutsummaryrefslogtreecommitdiffstats
path: root/inc
diff options
context:
space:
mode:
authorRudy Bousset <rbousset@z2r4p3.le-101.fr>2020-03-09 18:53:35 +0100
committerRudy Bousset <rbousset@z2r4p3.le-101.fr>2020-03-09 18:53:35 +0100
commit00f719e87a853f1c0b5dfc7085f605b452e75314 (patch)
tree1af5b195d41e26a284bec552aa9f07e4cc217db8 /inc
parentNorme (diff)
parentgang (diff)
download42-cub3d-00f719e87a853f1c0b5dfc7085f605b452e75314.tar.gz
42-cub3d-00f719e87a853f1c0b5dfc7085f605b452e75314.tar.bz2
42-cub3d-00f719e87a853f1c0b5dfc7085f605b452e75314.tar.xz
42-cub3d-00f719e87a853f1c0b5dfc7085f605b452e75314.tar.zst
42-cub3d-00f719e87a853f1c0b5dfc7085f605b452e75314.zip
Merge branch 'shpritz'
Diffstat (limited to 'inc')
-rw-r--r--inc/cub3d.h4
-rw-r--r--inc/cub3d_defines.h4
-rw-r--r--inc/cub3d_structs.h47
3 files changed, 32 insertions, 23 deletions
diff --git a/inc/cub3d.h b/inc/cub3d.h
index a961dcb..615112b 100644
--- a/inc/cub3d.h
+++ b/inc/cub3d.h
@@ -68,11 +68,13 @@ void ft_draw_texture(t_cub *cl, int x, int y, int tex_y);
int8_t ft_draw_hud(t_cub *clist);
void ft_draw_scene(t_cub *clist);
void ft_draw_scene_bmp(t_cub *clist);
-void ft_draw_sprite(t_cub *cl, int i);
void ft_draw_circle(float a, float b,
int32_t color, t_cub *cl);
int8_t ft_draw_verline(t_cub *cl, int32_t x,
int32_t y1, int32_t y2);
+void ft_calc_sprite(t_cub *cl);
+void ft_draw_sprite(t_cub *cl, t_sprite *sprite);
+void ft_get_sprite_spawn(t_cub *cl);
/*
** ====== PARSING ======
diff --git a/inc/cub3d_defines.h b/inc/cub3d_defines.h
index f20e5d4..b3dd986 100644
--- a/inc/cub3d_defines.h
+++ b/inc/cub3d_defines.h
@@ -93,8 +93,8 @@ enum
*/
# define FT_MOVE_SPEED 0.2
-# define FT_STRAFE_SPEED 0.1
-# define FT_ROT_SPEED 0.09
+# define FT_STRAFE_SPEED 0.2
+# define FT_ROT_SPEED 0.2
/*
** ====== COLLISION ======
diff --git a/inc/cub3d_structs.h b/inc/cub3d_structs.h
index 1160015..3c7ae28 100644
--- a/inc/cub3d_structs.h
+++ b/inc/cub3d_structs.h
@@ -86,25 +86,29 @@ typedef struct s_rgb
typedef struct s_sprite
{
- int32_t s_screen_x;
- int32_t s_pos_x;
- int32_t s_pos_y;
- double s_x;
- double s_y;
- int32_t s_h;
- int32_t s_w;
- int32_t s_start_x;
- int32_t s_start_y;
- int32_t s_end_x;
- int32_t s_end_y;
- int32_t s_tex_y;
- double sprite_transform_x;
- double sprite_transform_y;
- double sprite_dist;
- double inv_c_m;
-} t_sprite;
-
-typedef struct s_player
+ int32_t spritescreenx;
+ int32_t x;
+ int32_t y;
+ int32_t tex_x;
+ int32_t tex_y;
+ int32_t s_pos_x;
+ int32_t s_pos_y;
+ double spritex;
+ double spritey;
+ int32_t spriteheight;
+ int32_t spritewidth;
+ int32_t drawstartx;
+ int32_t drawstarty;
+ int32_t drawendx;
+ int32_t drawendy;
+ int32_t s_tex_y;
+ double transformx;
+ double transformy;
+ double sprite_dist;
+ double invdet;
+} t_sprite;
+
+typedef struct s_player
{
float pos_x;
float pos_y;
@@ -122,6 +126,7 @@ typedef struct s_ray
{
uint16_t line_h;
float wall_dist;
+ float *wall_dist_tab;
float x_ray_pos;
float y_ray_pos;
float x_ray_dir;
@@ -172,6 +177,8 @@ typedef struct s_map
size_t map_w;
size_t map_h;
size_t mapl_len;
+ int32_t sprite_nbr;
+ int32_t sprite_order[12];
size_t line_chk;
size_t map_start;
uint8_t isspawn;
@@ -210,7 +217,7 @@ typedef struct s_cub
struct s_rgb f_rgb;
struct s_rgb c_rgb;
struct s_img tlist[8];
- struct s_sprite sp_list;
+ struct s_sprite sprites[12];
} t_cub;
# endif