-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcub3D.h
More file actions
105 lines (96 loc) · 3.46 KB
/
cub3D.h
File metadata and controls
105 lines (96 loc) · 3.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* cub3D.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: dasalaza <dasalaza@student.42barcelona.co +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/09/11 21:37:01 by dasalaza #+# #+# */
/* Updated: 2025/09/11 21:37:02 by dasalaza ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef CUB3D_H
# define CUB3D_H
# include <stdbool.h>
# include <stdlib.h>
# include <math.h>
# include "mlx/mlx.h"
// ===================== LEGACY INCLUDES (CURRENTLY ACTIVE) ================ //
# include "srcs/math/vector_math.h"
# include "srcs/math/rotation_math.h"
# include "srcs/graphics/image_operations.h"
# include "srcs/render/render_blur.h"
# include "srcs/game/game_map.h"
# include "srcs/file_loader/load_file.h"
# include "srcs/sound/audio_system.h"
# include "include/includes_cub.h"
# define TITLE_WINDOWS "Cub3D Ana & Daru"
# define COLOR_UNSET 0xDB000000
# define FAIL_MLX "Failed to initialize mlx."
# define ERROR_FORMAT "Cub is unproperly formated."
# define ERROR_MAP_UNCLOSED "Map is not enclosed."
# define ERROR_INVALID_DOOR_POS "Invalid door position."
# define ERROR_FILE_TYPE "Unknown file type."
# define ERROR_USAGE_CUB "Usage: cub3D [cub file]"
// ===================== PARSER ERROR MESSAGES ===================== //
# define ERROR_DUPLICATE_RESOLUTION "Duplicate resolution paramater."
# define ERROR_PARSING_RESOLUTION "Error parsing resolution."
# define ERROR_DUPLICATE_TEXTURE "Duplicate texture paramater."
# define ERROR_FAILED_LOAD_TEXTURE "Failed to load texture."
# define ERROR_COLOR_SET_TWICE "Color was set twice."
# define ERROR_READING_COLOR "Error reading color."
# define ERROR_COULD_NOT_READ_AUDIO "Could not read audio..."
# define ERROR_COULD_NOT_LOAD_FILE "Could not load file."
# define ERROR_MAP_GRID_EMPTY "Map grid is empty."
# define ERROR_FAILED_INIT_MAP "Failed to initialize map."
# define ERROR_DUPLICATE_PLAYER "Duplicate player in map."
# define ERROR_DUPLICATE_PATHFINDER "Duplicate pathfinder in map."
# define FPS60 16666
# define FPS50 20000
# define FPS_BONUS 25000 // using this default
# define FPS30 33333
typedef struct s_game
{
void *mlx;
void *win;
t_img img;
t_player player;
t_blur blur;
t_map map;
t_sprite *sprites;
double resx;
double resy;
t_line *file;
t_walls walls;
t_img floor;
t_img portal;
t_img skybox;
t_img gun;
t_img dash;
t_img sprite_img;
t_img health_img;
t_img goomba_img;
t_img door_img;
t_portal *first_portal;
t_portal *second_portal;
double fov;
double cam_width;
double *depth;
int shoot;
int time;
int top_color;
int bottom_color;
int render_distance;
bool should_dim;
t_vec *last_path;
t_vec pathfinder;
float bob;
bool bonus;
bool bmp;
t_sounds sounds;
unsigned long delay;
} t_game;
int render_next_frame(t_game *game);
int get_delay(bool startnow, int min, bool mac);
void set_bonus(bool *bonus);
#endif