Added memorybook to parsing and cleaned most of the files
This commit is contained in:
@@ -1,3 +1,15 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* colors.h :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: pblagoje <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2022/05/04 13:34:26 by pblagoje #+# #+# */
|
||||
/* Updated: 2022/05/04 13:35:12 by pblagoje ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef COLORS_H
|
||||
# define COLORS_H
|
||||
|
||||
@@ -22,4 +34,3 @@
|
||||
# define RESET "\e[0m"
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,3 +1,15 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* cube3d.h :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: pblagoje <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2022/05/04 13:34:54 by pblagoje #+# #+# */
|
||||
/* Updated: 2022/05/04 13:35:31 by pblagoje ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef CUBE3D_H
|
||||
# define CUBE3D_H
|
||||
|
||||
@@ -10,7 +22,6 @@
|
||||
# include <sys/stat.h> // for open()
|
||||
# include <fcntl.h> // for open flags
|
||||
|
||||
|
||||
# include "colors.h"
|
||||
# include "memorybook.h"
|
||||
|
||||
|
||||
@@ -1,3 +1,15 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* cube3d_macro.h :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: pblagoje <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2022/05/04 13:34:39 by pblagoje #+# #+# */
|
||||
/* Updated: 2022/05/04 13:34:46 by pblagoje ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef CUBE3D_MACRO_H
|
||||
# define CUBE3D_MACRO_H
|
||||
|
||||
|
||||
@@ -1,3 +1,15 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* cube3d_proto.h :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: pblagoje <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2022/05/04 13:36:55 by pblagoje #+# #+# */
|
||||
/* Updated: 2022/05/04 13:38:53 by pblagoje ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef CUBE3D_PROTO_H
|
||||
# define CUBE3D_PROTO_H
|
||||
|
||||
@@ -6,59 +18,56 @@
|
||||
// -------------------------------
|
||||
// cube3d.c
|
||||
void destroy_mlx(void *param);
|
||||
int shut_down();
|
||||
|
||||
int shut_down(void);
|
||||
|
||||
// -------------------------------
|
||||
// SRC/INIT
|
||||
// -------------------------------
|
||||
// init_struct.c
|
||||
t_game *init_struct(void);
|
||||
t_game *init_struct(void);
|
||||
// init_game.c
|
||||
void init_game(t_game *game);
|
||||
void init_game(t_game *game);
|
||||
// init_textures.c
|
||||
void init_txtr(t_txt *txt, void *mlx_ptr);
|
||||
|
||||
|
||||
// -------------------------------
|
||||
// SRC/GNL
|
||||
// -------------------------------
|
||||
// get_next_line.c
|
||||
int get_next_line(int fd, char **line);
|
||||
|
||||
int get_next_line(int fd, char **line);
|
||||
|
||||
// -------------------------------
|
||||
// SRC/PARSING
|
||||
// -------------------------------
|
||||
// init_parsing.c
|
||||
int init_parsing(t_game *game, char *file);
|
||||
int init_parsing(t_game *game, char *file);
|
||||
// check_extension.c
|
||||
int check_extension(char *filename, char *ext);
|
||||
int check_extension(char *filename, char *ext);
|
||||
// check_path.c
|
||||
int check_elements(t_game *game, char *file);
|
||||
int check_elements(t_game *game, char *file);
|
||||
// check_rgb.c
|
||||
int check_rgb(t_txt *txt, char *element, char identifier);
|
||||
// check_map.c
|
||||
int check_map(t_map *map);
|
||||
|
||||
int check_rgb(t_txt *txt, char *element, char identifier);
|
||||
// check_map_borders.c
|
||||
int check_map(t_map *map);
|
||||
// check_map_content.c
|
||||
int check_content(t_map *map);
|
||||
|
||||
// -------------------------------
|
||||
// SRC/HOOK
|
||||
// -------------------------------
|
||||
// keyhook.c
|
||||
int keypress(int keycode, t_game *game);
|
||||
int keyrelease(int keycode, t_game *game);
|
||||
int hook_action(t_game *game);
|
||||
int keypress(int keycode, t_game *game);
|
||||
int keyrelease(int keycode, t_game *game);
|
||||
int hook_action(t_game *game);
|
||||
// key_action_1.c
|
||||
int is_esc(int *k_hook, int *is_action);
|
||||
int is_go_left(int *k_hook, int *is_action);
|
||||
int is_go_right(int *k_hook, int *is_action);
|
||||
int is_go_forward(int *k_hook, int *is_action);
|
||||
int is_go_backward(int *k_hook, int *is_action);
|
||||
int is_esc(int *k_hook, int *is_action);
|
||||
int is_go_left(int *k_hook, int *is_action);
|
||||
int is_go_right(int *k_hook, int *is_action);
|
||||
int is_go_forward(int *k_hook, int *is_action);
|
||||
int is_go_backward(int *k_hook, int *is_action);
|
||||
// key_action_2.c
|
||||
int is_turn_left(int *k_hook, int *is_action);
|
||||
int is_turn_right(int *k_hook, int *is_action);
|
||||
|
||||
int is_turn_left(int *k_hook, int *is_action);
|
||||
int is_turn_right(int *k_hook, int *is_action);
|
||||
|
||||
// -------------------------------
|
||||
// SRC/PLAYER
|
||||
@@ -75,8 +84,8 @@ void plr_turn(t_plr *plr, int deg);
|
||||
void plr_turn_right(t_plr *plr);
|
||||
void plr_turn_left(t_plr *plr);
|
||||
// player_limits.c
|
||||
int is_wall(t_game *game, int cell_x, int cell_y);
|
||||
int plr_out_limits(t_game *game, int x, int y);
|
||||
int is_wall(t_game *game, int cell_x, int cell_y);
|
||||
int plr_out_limits(t_game *game, int x, int y);
|
||||
|
||||
// -------------------------------
|
||||
// SRC/DRAW
|
||||
|
||||
@@ -1,3 +1,15 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* cube3d_struct.h :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: pblagoje <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2022/05/04 13:31:38 by pblagoje #+# #+# */
|
||||
/* Updated: 2022/05/04 13:34:07 by pblagoje ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef CUBE3D_STRUCT_H
|
||||
# define CUBE3D_STRUCT_H
|
||||
|
||||
@@ -8,19 +20,19 @@
|
||||
* - vector (two points)
|
||||
*/
|
||||
|
||||
typedef struct s_d_coord
|
||||
typedef struct s_d_coord
|
||||
{
|
||||
double x;
|
||||
double y;
|
||||
} t_d_coord;
|
||||
|
||||
typedef struct s_coord
|
||||
typedef struct s_coord
|
||||
{
|
||||
int x;
|
||||
int y;
|
||||
} t_coord;
|
||||
|
||||
typedef struct s_vec
|
||||
typedef struct s_vec
|
||||
{
|
||||
t_coord start;
|
||||
t_coord end;
|
||||
@@ -30,7 +42,7 @@ typedef struct s_vec
|
||||
* struct with all elements for raycasting
|
||||
*/
|
||||
|
||||
typedef struct s_wall
|
||||
typedef struct s_wall
|
||||
{
|
||||
t_vec vec;
|
||||
int height;
|
||||
@@ -44,7 +56,7 @@ typedef struct s_wall
|
||||
* struct with all elements for raycasting
|
||||
*/
|
||||
|
||||
typedef struct s_rcast
|
||||
typedef struct s_rcast
|
||||
{
|
||||
t_vec screen_size;
|
||||
t_vec ray;
|
||||
@@ -76,14 +88,14 @@ typedef struct s_rcast
|
||||
* structs for windows, and images associated
|
||||
*/
|
||||
|
||||
typedef struct s_win
|
||||
typedef struct s_win
|
||||
{
|
||||
void *ptr;
|
||||
int size_x;
|
||||
int size_y;
|
||||
} t_win;
|
||||
|
||||
typedef struct s_img
|
||||
typedef struct s_img
|
||||
{
|
||||
void *ptr;
|
||||
char *data;
|
||||
@@ -98,7 +110,7 @@ typedef struct s_img
|
||||
* wall textures and floor/ceiling colors
|
||||
*/
|
||||
|
||||
typedef struct s_txt
|
||||
typedef struct s_txt
|
||||
{
|
||||
char *txt_north;
|
||||
char *txt_south;
|
||||
@@ -116,7 +128,7 @@ typedef struct s_txt
|
||||
* structs for the map
|
||||
*/
|
||||
|
||||
typedef struct s_map
|
||||
typedef struct s_map
|
||||
{
|
||||
char **content;
|
||||
char *tmp_str;
|
||||
@@ -132,12 +144,10 @@ typedef struct s_map
|
||||
* structs for the player and its moves
|
||||
*/
|
||||
|
||||
typedef struct s_plr
|
||||
typedef struct s_plr
|
||||
{
|
||||
// player
|
||||
t_d_coord exact;
|
||||
t_coord pos;
|
||||
// rot
|
||||
int rot;
|
||||
int deg;
|
||||
double cosi;
|
||||
@@ -150,32 +160,16 @@ typedef struct s_plr
|
||||
* struct with all elements for the project
|
||||
*/
|
||||
|
||||
typedef struct s_game
|
||||
typedef struct s_game
|
||||
{
|
||||
void *mlx_ptr;
|
||||
// game window
|
||||
t_win win;
|
||||
t_img img;
|
||||
// player
|
||||
t_plr plr;
|
||||
// rays
|
||||
t_rcast rcast;
|
||||
// textures and colors
|
||||
t_txt txt;
|
||||
// map
|
||||
t_map map;
|
||||
|
||||
//tmp draw map
|
||||
// // map window
|
||||
// t_win map_win;
|
||||
// t_img map_img;
|
||||
// // rays
|
||||
// int ray_highlight;
|
||||
// int ray_activ;
|
||||
// t_vec ray;
|
||||
// tmp end
|
||||
|
||||
// key hook
|
||||
int k_hook[MAX_NB_KEY];
|
||||
} t_game;
|
||||
|
||||
|
||||
@@ -1,3 +1,15 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* memorybook.h :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: pblagoje <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2022/05/04 13:35:47 by pblagoje #+# #+# */
|
||||
/* Updated: 2022/05/04 13:36:44 by pblagoje ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef MEMORYBOOK_H
|
||||
# define MEMORYBOOK_H
|
||||
|
||||
|
||||
Reference in New Issue
Block a user