aboutsummaryrefslogtreecommitdiffstats
path: root/inc/cub3d_structs.h
diff options
context:
space:
mode:
Diffstat (limited to 'inc/cub3d_structs.h')
-rw-r--r--inc/cub3d_structs.h269
1 files changed, 171 insertions, 98 deletions
diff --git a/inc/cub3d_structs.h b/inc/cub3d_structs.h
index cceafec..3c7ae28 100644
--- a/inc/cub3d_structs.h
+++ b/inc/cub3d_structs.h
@@ -14,40 +14,77 @@
# define CUB3D_STRUCTS_H
#include <stddef.h>
+#include <stdlib.h>
#include <stdint.h>
+#include <sys/types.h>
-typedef struct s_win
+typedef struct s_win
{
- void *wlx;
- void *winptr;
- uint8_t inited;
- uint16_t x_max_size;
- uint16_t y_max_size;
- uint32_t x_size;
- uint32_t y_size;
-} t_win;
-
-typedef struct s_img
+ void *wlx;
+ void *winptr;
+ uint8_t inited;
+ uint16_t x_max_size;
+ uint16_t y_max_size;
+ uint32_t x_size;
+ uint32_t y_size;
+} t_win;
+
+# pragma pack(push, 1)
+
+typedef struct s_bmp_file
{
- void *img;
- char *ptr;
- int bpp;
- int sizeline;
- int endian;
- int img_w;
- int img_h;
- int tex_x;
- int tex_y;
-} t_img;
-
-typedef struct s_rgb
+ uint16_t file_type;
+ uint32_t file_size;
+ uint16_t reserv_one;
+ uint16_t reserv_two;
+ uint32_t offset_data;
+} t_bmp_file;
+
+typedef struct s_bmp_info
{
- int16_t r;
- int16_t g;
- int16_t b;
-} t_rgb;
+ uint32_t size;
+ int32_t width;
+ int32_t height;
+ uint16_t planes;
+ uint16_t bit_count;
+ uint32_t compression;
+ uint32_t size_image;
+ int32_t x_pixels_per_meter;
+ int32_t y_pixels_per_meter;
+ uint32_t colors_used;
+ uint32_t colors_important;
+} t_bmp_info;
-typedef struct s_sprite
+typedef struct s_bmp_rgb
+{
+ uint8_t r;
+ uint8_t g;
+ uint8_t b;
+} t_bmp_rgb;
+
+# pragma pack(pop)
+
+typedef struct s_img
+{
+ void *img;
+ char *ptr;
+ int bpp;
+ int sizeline;
+ int endian;
+ int img_w;
+ int img_h;
+ int tex_x;
+ int tex_y;
+} t_img;
+
+typedef struct s_rgb
+{
+ int16_t r;
+ int16_t g;
+ int16_t b;
+} t_rgb;
+
+typedef struct s_sprite
{
int32_t spritescreenx;
int32_t x;
@@ -73,78 +110,114 @@ typedef struct s_sprite
typedef struct s_player
{
- float pos_x;
- float pos_y;
- float start_x;
- float start_y;
- float dir_x;
- float dir_y;
- float cam_x;
- float plane_x;
- float plane_y;
-} t_player;
-
-typedef struct s_ray
+ float pos_x;
+ float pos_y;
+ float pos_z;
+ float start_x;
+ float start_y;
+ float dir_x;
+ float dir_y;
+ float cam_x;
+ float plane_x;
+ float plane_y;
+} t_player;
+
+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;
- float y_ray_dir;
- float x_side_dist;
- float y_side_dist;
- float x_delta_dist;
- float y_delta_dist;
- int16_t wall_t;
- int16_t wall_b;
- uint8_t side;
- size_t sqx;
- size_t sqy;
- uint8_t hit;
- double wall_hit_x;
- double step_tex_v;
-} t_ray;
-
-typedef struct s_map
+ uint16_t line_h;
+ float wall_dist;
+ float *wall_dist_tab;
+ float x_ray_pos;
+ float y_ray_pos;
+ float x_ray_dir;
+ float y_ray_dir;
+ float x_side_dist;
+ float y_side_dist;
+ float x_delta_dist;
+ float y_delta_dist;
+ int16_t wall_t;
+ int16_t wall_b;
+ uint8_t side;
+ size_t sqx;
+ size_t sqy;
+ uint8_t hit;
+ double wall_hit_x;
+ double step_tex_v;
+ float x_f_ray_dir;
+ float y_f_ray_dir;
+ float x_f_ray_dir_bis;
+ float y_f_ray_dir_bis;
+ uint16_t p;
+ float row_dist;
+ float x_floor;
+ float y_floor;
+ int32_t x_cell;
+ int32_t y_cell;
+} t_ray;
+
+typedef struct s_map
{
- char *no_tex_path;
- char *so_tex_path;
- char *ea_tex_path;
- char *we_tex_path;
- char *sprite_path;
- char *mapl;
- char **map;
- int32_t sprite_nbr;
- int32_t sprite_order[12];
- int8_t x_step;
- int8_t y_step;
- size_t map_w;
- size_t map_h;
- size_t line_chk;
- size_t map_start;
- uint8_t isspawn;
- uint8_t scale;
- uint8_t isnlvl;
-} t_map;
-
-typedef struct s_cub
+ char *filename;
+ char *no_tex_path;
+ char *so_tex_path;
+ char *ea_tex_path;
+ char *we_tex_path;
+ char *sprite_path;
+ char *nl_tex_path;
+ char *fl_tex_path;
+ char *ce_tex_path;
+ char *nlevel_path;
+ char *music_path;
+ char *music_cmd;
+ char *mapl;
+ char **map;
+ char **mcmd_words;
+ int8_t x_step;
+ int8_t y_step;
+ 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;
+ uint8_t isnlvl;
+ uint8_t ismusic;
+ uint8_t isftex;
+ uint8_t isctex;
+ uint8_t darklvl;
+ uint8_t scale;
+ uint32_t nlx;
+ uint32_t nly;
+ float x_floor_step;
+ float y_floor_step;
+} t_map;
+
+typedef struct s_cub
{
- uint8_t w_side;
- uint8_t ishud;
- char errmsg[40];
- int32_t key_input[5];
- int (*key_ptr[6])(struct s_cub*);
- struct s_win *wlist;
- struct s_player *plist;
- struct s_map *mlist;
- struct s_ray rlist;
- struct s_img img;
- struct s_rgb f_rgb;
- struct s_rgb c_rgb;
- struct s_img tlist[5];
- struct s_sprite sprites[12];
-} t_cub;
+ uint8_t w_side;
+ uint8_t ishud;
+ uint8_t walltexgood;
+ uint8_t isoldmus;
+ uint16_t currlvl;
+ uint16_t i;
+ char *const *envp;
+ char errmsg[64];
+ int32_t key_input[5];
+ pid_t mpid;
+ int (*key_ptr[6])(struct s_cub*);
+ int8_t (*get_ptr[12])(char**, struct s_cub*);
+ char ref[13][3];
+ struct s_win wlist;
+ struct s_player plist;
+ struct s_map mlist;
+ struct s_ray rlist;
+ struct s_img img;
+ struct s_rgb f_rgb;
+ struct s_rgb c_rgb;
+ struct s_img tlist[8];
+ struct s_sprite sprites[12];
+} t_cub;
# endif