aboutsummaryrefslogtreecommitdiffstats
path: root/inc/cub3d_defines.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--inc/cub3d_defines.h186
1 files changed, 132 insertions, 54 deletions
diff --git a/inc/cub3d_defines.h b/inc/cub3d_defines.h
index e201228..b3dd986 100644
--- a/inc/cub3d_defines.h
+++ b/inc/cub3d_defines.h
@@ -14,44 +14,93 @@
# define CUB3D_DEFINES_H
/*
-** ====== KEYS ======
+** ====== RETURN VALUES ======
*/
+enum
+{
+ FT_RET_FINE,
+ FT_RET_BAD_ARGV,
+ FT_RET_ALLOC_ERR,
+ FT_RET_FAILED_STRUCTS,
+ FT_RET_FAILED_MLX,
+ FT_RET_MAP_ERR,
+ FT_RET_NO_MAP,
+ FT_RET_READ_ERR,
+ FT_RET_BMP_ERR
+} retvals;
-# ifndef FT_W_KEY
-# define FT_W_KEY 13
-# endif
-# ifndef FT_A_KEY
-# define FT_A_KEY 0
-# endif
-# ifndef FT_S_KEY
-# define FT_S_KEY 1
-# endif
-# ifndef FT_D_KEY
-# define FT_D_KEY 2
-# endif
-# ifndef FT_L_ARR_KEY
-# define FT_L_ARR_KEY 123
-# endif
-# ifndef FT_R_ARR_KEY
-# define FT_R_ARR_KEY 124
-# endif
-# ifndef FT_ESC_KEY
-# define FT_ESC_KEY 53
+/*
+** 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
-# ifndef FT_F1_KEY
-# define FT_F1_KEY 122
+
+/*
+** ====== 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
-# ifndef FT_TAB_KEY
-# define FT_TAB_KEY 48
+
+/*
+** ====== MUSIC CMD ======
+*/
+
+# if FT_OS == 1
+# define FT_MUS_CMD "/usr/bin/afplay --volume 0.2 %s"
+# else
+# define FT_MUS_CMD "/usr/bin/aplay -f cd -t wav -q %s"
# endif
/*
** ====== MOVE SPEED ======
*/
-# define FT_MOVE_SPEED 0.1
-# define FT_STRAFE_SPEED 0.1
-# define FT_ROT_SPEED 0.09
+# define FT_MOVE_SPEED 0.2
+# define FT_STRAFE_SPEED 0.2
+# define FT_ROT_SPEED 0.2
+
+/*
+** ====== COLLISION ======
+*/
+
+# define FT_COLL_MULT 0.225
/*
** ====== SCREEN ======
@@ -62,40 +111,61 @@
# endif
/*
-** ====== OTHERS ======
+** ====== CHARSET ======
*/
-# ifndef FT_OS
-# define FT_OS "Darwin"
-# endif
+# define FT_CHRST_VALID_PARSE "RNSEWFCLM"
+# define FT_CHRST_MAP_ENTRY "012NSEWL "
+# define FT_CHRST_SPAWN "NSEW"
+# define FT_CHRST_MAP_NON_WALL "02NESWL"
+# define FT_CHRST_COLLISION "12 "
+# define FT_CHRST_DETECT "1L"
+
+/*
+** ====== BMP ======
+*/
+# ifndef FT_BMP_SAVE_DIR
+# define FT_BMP_SAVE_DIR "./"
+# endif
/*
** ====== MAP ERROR MSG ======
*/
-# define FT_ERR_ALLOCATE "allocation error"
-# define FT_ERR_READ "read error"
-# define FT_ERR_NOT_A_CUB "given map is not a .cub"
-# 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_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 three numbers separated by 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_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_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, 50x50 minimum pls"
+# define FT_ERR_RES_ALPHA "resolution should be digits only"
+# define FT_ERR_SH_ALPHA "shadow amount should be digits only"
+# define FT_ERR_SH_RANGE "shadow should be set between 0 - 20"
+# 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_NOT_A_WAV "given sound file is not a .wav"
+# 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_NO_MAP "No map"
+# define FT_ERR_MAP_WALLS "bad space or map is not surrounded by walls"
+# define FT_ERR_MAP_EMPL "empty line in map"
+# 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"
+# define FT_ERR_RD_MUSIC "could not find music file"
+# define FT_ERR_WR_BMP "could not export to bmp"
/*
** ====== MISSING ERROR MSG ======
@@ -107,9 +177,17 @@
# 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"
+/*
+** ====== OTHER ======
+*/
+
+# define FT_PARSE_END_RET 25
+
# endif