aboutsummaryrefslogtreecommitdiffstats
path: root/inc/cub3d_defines.h
blob: f5cfd8a244ef7ce1bdb05f20f65b68a6ffc04c11 (plain)
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
/* ************************************************************************** */
/*                                                                            */
/*                                                        :::      ::::::::   */
/*   cub3d_defines.h                                    :+:      :+:    :+:   */
/*                                                    +:+ +:+         +:+     */
/*   By: rbousset <marvin@42.fr>                    +#+  +:+       +#+        */
/*                                                +#+#+#+#+#+   +#+           */
/*   Created: 2020/02/15 15:40:25 by rbousset          #+#    #+#             */
/*   Updated: 2020/02/15 15:40:27 by rbousset         ###   ########lyon.fr   */
/*                                                                            */
/* ************************************************************************** */

#	ifndef CUB3D_DEFINES_H
#	define CUB3D_DEFINES_H

/*
** ====== RETURN VALUES ======
*/
enum
{
	RET_FINE,
	RET_NO_ARGV,
	RET_FAILED_STRUCTS,
	RET_FAILED_MLX,
	RET_MAP_ERROR,
	RET_NO_MAP,
	RET_READ_ERROR
}	retvals;

/*
** ret vals:
** 1: no argv[1]
** 2: failed structs init
** 3: failed mlx init
** 4: map error
** 5: no map
** 6: read error
*/

/*
** ====== OS ======
*/

/*
** 1: Darwin
** 2: Linux
*/

#	ifndef FT_OS
#	define FT_OS 1
#	endif

/*
** ====== KEYS ======
*/

#	if FT_OS == 1
#		define FT_W_KEY		13
#		define FT_A_KEY		0
#		define FT_S_KEY		1
#		define FT_D_KEY		2
#		define FT_L_ARR_KEY	123
#		define FT_R_ARR_KEY	124
#		define FT_F1_KEY	122
#		define FT_TAB_KEY	48
#		define FT_ESC_KEY	53
#	else
#		define FT_W_KEY		119
#		define FT_A_KEY		97
#		define FT_S_KEY		115
#		define FT_D_KEY		100
#		define FT_L_ARR_KEY	65361
#		define FT_R_ARR_KEY	65363
#		define FT_TAB_KEY	65289
#		define FT_F1_KEY	65470
#		define FT_ESC_KEY	65307
#	endif

/*
** ====== MOVE SPEED ======
*/

#	define FT_MOVE_SPEED	0.2
#	define FT_STRAFE_SPEED	0.1
#	define FT_ROT_SPEED		0.09

/*
** ====== MOVE SPEED ======
*/

#	define FT_COLL_MULT		0.225

/*
** ====== SCREEN ======
*/

#	ifndef FT_SCR_SIZE
#	define FT_SCR_SIZE "1920x1080"
#	endif

/*
** ====== MAP ERROR MSG ======
*/

#	define FT_ERR_ALLOCATE		"allocation error"
#	define FT_ERR_READ			"read error"
#	define FT_ERR_ARGS			"too many or to few arguments"
#	define FT_ERR_RES_SMALL		"resolution is too small"
#	define FT_ERR_RES_ALPHA		"resolution should be digits only"
#	define FT_ERR_NOT_A_CUB		"given map is not a .cub"
#	define FT_ERR_NOT_A_XPM		"given texture is not a .xpm"
#	define FT_ERR_COLOR_ALPHA	"colors should be digits only"
#	define FT_ERR_COLOR_MAX		"colors should be maximum 255"
#	define FT_ERR_COLOR_ARGS	"colors should be three numbers with commas"
#	define FT_ERR_UNFINISHED	"no map"
#	define FT_ERR_MAP_LEN		"map length inconsistency"
#	define FT_ERR_ILL_ENTRY		"illegal map entry"
#	define FT_ERR_ALR_SET		"duplicate entry"
#	define FT_ERR_ILL_MAP		"map contains illegal char"
#	define FT_ERR_MULT_SPAWN	"multiple spawn points"
#	define FT_ERR_MULT_NLVL		"multiple spawn new level access points"
#	define FT_ERR_MAP_L_L		"last line is invalid"
#	define FT_ERR_RD_NO			"could not find north side texture file"
#	define FT_ERR_RD_SO			"could not find south side texture file"
#	define FT_ERR_RD_EA			"could not find east side texture file"
#	define FT_ERR_RD_WE			"could not find west side texture file"
#	define FT_ERR_RD_SP			"could not find sprite texture file"
#	define FT_ERR_RD_NL_TEX		"could not find next level texture file"
#	define FT_ERR_RD_NL_MAP		"could not find next level map file"

/*
** ====== MISSING ERROR MSG ======
*/

#	define FT_ERR_MISS_ELEMENT		"Missing element:"
#	define FT_ERR_MISS_NORTH		"north side texture"
#	define FT_ERR_MISS_SOUTH		"south side texture"
#	define FT_ERR_MISS_EAST			"east side texture"
#	define FT_ERR_MISS_WEST			"west side texture"
#	define FT_ERR_MISS_SPRITE		"sprite texture"
#	define FT_ERR_MISS_NLVL_PATH	"next level path"
#	define FT_ERR_MISS_NLVL			"next level texture"
#	define FT_ERR_MISS_RESOLUTION	"resolution"
#	define FT_ERR_MISS_FLOOR_C		"floor color"
#	define FT_ERR_MISS_CEIL_C		"ceiling color"
#	define FT_ERR_MISS_PLAYER_SPAWN	"player spawn"

#	endif