/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* cub3d_defines.h :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: joelecle +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/02/15 15:40:25 by joelecle #+# #+# */ /* Updated: 2020/02/15 15:40:27 by joelecle ### ########lyon.fr */ /* */ /* ************************************************************************** */ # ifndef CUB3D_DEFINES_H # define CUB3D_DEFINES_H /* ** ====== RETURN VALUES ====== ** ** ret vals: ** --------- ** 1: no argv[1] ** 2: allocation error ** 3: failed structs init ** 4: failed mlx init ** 5: map error ** 6: no map ** 7: read error ** 8: bmp related error ** 9: missing some media files */ 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, FT_ERR_MISSING } retvals; /* ** ====== OS ====== ** ** 1: Darwin ** 2: Linux ** 3: FreeBSD */ # 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 # define FT_RET_KEY 36 # define FT_SPC_KEY 49 # define FT_ONE_KEY 18 # define FT_TWO_KEY 19 # define FT_THREE_KEY 20 # 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 # define FT_RET_KEY 65293 # define FT_SPC_KEY 32 # define FT_ONE_KEY 49 # define FT_TWO_KEY 50 # define FT_THREE_KEY 51 # endif /* ** ====== NEEDED PATHS ====== */ # define FT_SFX_DEATH_PATH "./media/sound/sfx/death_screen.wav" # define FT_SFX_FS_ONE_PATH "./media/sound/sfx/footstep_one.wav" # define FT_SFX_FS_TWO_PATH "./media/sound/sfx/footstep_two.wav" # define FT_SFX_N_LVL_PATH "./media/sound/sfx/next_lvl.wav" # define FT_SFX_SCR_ONE_PATH "./media/sound/sfx/scream_one.wav" # define FT_SFX_SCR_TWO_PATH "./media/sound/sfx/scream_two.wav" # define FT_SFX_TRAP_PATH "./media/sound/sfx/trap.wav" # define FT_SFX_HEAL_PATH "./media/sound/sfx/heal.wav" # define FT_SFX_W_ONE_LOAD_PATH "./media/sound/sfx/sword_load.wav" # define FT_SFX_W_ONE_FIRE_PATH "./media/sound/sfx/sword_fire.wav" # define FT_SFX_W_TWO_LOAD_PATH "./media/sound/sfx/colt_load.wav" # define FT_SFX_W_TWO_FIRE_PATH "./media/sound/sfx/colt_fire.wav" # define FT_SFX_W_THREE_LOAD_PATH "./media/sound/sfx/double_b_load.wav" # define FT_SFX_W_THREE_FIRE_PATH "./media/sound/sfx/double_b_fire.wav" # define FT_SFX_OOA_PATH "./media/sound/sfx/ooa.wav" # define FT_SFX_ENMY_DEATH_PATH "./media/sound/sfx/skel_death.wav" # define FT_SFX_ENMY_SCR_ONE_PATH "./media/sound/sfx/skel_scream_one.wav" # define FT_SFX_ENMY_SCR_TWO_PATH "./media/sound/sfx/skel_scream_two.wav" # define FT_SFX_ENMY_FIRE_PATH "./media/sound/sfx/skel_gun.wav" # define FT_DEATH_SCREEN_PATH "./media/img/screens/death_screen.xpm" # define FT_HUD_BACK_PATH "./media/img/hud/hud_back_small.xpm" # define FT_WEAPON_ONE_SPR_PATH "./media/img/weapons/sword_s.xpm" # define FT_WEAPON_TWO_SPR_PATH "./media/img/weapons/colt_s.xpm" # define FT_WEAPON_THREE_SPR_PATH "./media/img/weapons/double_b_s.xpm" # define FT_WEAPON_ONE_PATH "./media/img/weapons/sword_w.xpm" # define FT_WEAPON_ONE_FIRE_PATH "./media/img/weapons/sword_w_fire.xpm" # define FT_WEAPON_TWO_PATH "./media/img/weapons/colt_w.xpm" # define FT_WEAPON_TWO_FIRE_PATH "./media/img/weapons/colt_w_fire.xpm" # define FT_WEAPON_THREE_PATH "./media/img/weapons/double_b_w.xpm" # define FT_WEAPON_THREE_FIRE_PATH "media/img/weapons/double_b_w_fire.xpm" # define FT_ENMY_WAIT_PATH "./media/img/sprites/skel_waiting.xpm" # define FT_ENMY_WALK_PATH "./media/img/sprites/skel_walking.xpm" # define FT_ENMY_FIRE_PATH "./media/img/sprites/skel_firing.xpm" # define FT_ENMY_DEAD_PATH "./media/img/sprites/skel_dead.xpm" # define FT_CB_WAIT_PATH "./media/img/sprites/chr_cb1.xpm" # define FT_CB_WALK_PATH "./media/img/sprites/chr_cb2.xpm" # define FT_CB_FIRE_PATH "./media/img/sprites/chr_cb3.xpm" # define FT_CB_DEAD_PATH "./media/img/sprites/chr_cbd.xpm" # define FT_HEAL_PACK_PATH "./media/img/sprites/heal_pot.xpm" # define FT_WHISK_PACK_PATH "./media/img/sprites/sr_hp.xpm" # define FT_ZER_PATH "./media/img/hud/zero.xpm" # define FT_ONE_PATH "./media/img/hud/one.xpm" # define FT_TWO_PATH "./media/img/hud/two.xpm" # define FT_THR_PATH "./media/img/hud/three.xpm" # define FT_FOU_PATH "./media/img/hud/four.xpm" # define FT_FIV_PATH "./media/img/hud/five.xpm" # define FT_SIX_PATH "./media/img/hud/six.xpm" # define FT_SEV_PATH "./media/img/hud/seven.xpm" # define FT_EIG_PATH "./media/img/hud/eight.xpm" # define FT_NIN_PATH "./media/img/hud/nine.xpm" # define FT_PER_PATH "./media/img/hud/percent.xpm" # define FT_INF_PATH "./media/img/hud/infinite.xpm" # define FT_CAP_HEALTH_PATH "./media/img/hud/health.xpm" # define FT_CAP_AMMO_PATH "./media/img/hud/ammo.xpm" /* ** ====== SOUNDS ====== */ # if FT_OS == 1 # define FT_SND_CMD "/usr/bin/afplay --volume 0.2 %s" # endif # if FT_OS == 2 # define FT_SND_CMD "/usr/bin/aplay -f cd -t wav -q %s" # endif # if FT_OS == 3 # define FT_SND_CMD "/usr/local/bin/waveplay -s %s" # endif # if FT_OS == 1 # define FT_SND_TERM_CMD "pkill -SIGTERM afplay" # endif # if FT_OS == 2 # define FT_SND_TERM_CMD "pkill -SIGTERM aplay" # endif # if FT_OS == 3 # define FT_SND_TERM_CMD "pkill -SIGTERM waveplay" # endif /* ** ====== MOVE SPEED ====== */ # define FT_MOVE_SPEED 0.18 # define FT_STRAFE_SPEED 0.13 # define FT_ROT_SPEED 0.13 /* ** ====== COLLISION ====== */ # define FT_COLL_MULT 0.3 /* ** ====== SCREEN ====== */ # ifndef FT_SCR_SIZE # define FT_SCR_SIZE "1920x1080" # endif /* ** ====== CHARSET ====== */ # define FT_CHRST_VALID_PARSE "RNSEWFCLMT" # define FT_CHRST_MAP_ENTRY "0123456789NSEWLT!@+#e " # define FT_CHRST_SPRITES "23456789" # define FT_CHRST_SPAWN "NSEW" # define FT_CHRST_MAP_NON_WALL "023456789NESWLT!@+#ex" # define FT_CHRST_COLLISION "123456789e " # define FT_CHRST_DETECT "1L" # define FT_CHRST_ITEM "!@+#x" # define FT_CHRST_WEAPONS "!@#x" /* ** ====== 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_ARGS "too many or to few arguments" # define FT_ERR_ARGV "Bad 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_SPRITE_DUMB "bad sprite order" # 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 new level access points" # define FT_ERR_NO_MAP "No map" # define FT_ERR_MAP_WALLS "bad space or map isn't 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_SB "could not find skybox 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_RD_TRAP "could not find trap texture file" # define FT_ERR_WR_BMP "could not export to bmp" # define FT_ERR_UNDEF_SPRITE "undefined sprite" # define FT_ERR_TOO_MUCH_SPRT "too much sprites, limit is 4096" # define FT_ERR_TOO_MUCH_HEALS "too much heal packs, limit is 64" # define FT_ERR_TOO_MUCH_TRAPS "too much traps, limit is 512" # define FT_ERR_TOO_MUCH_W_ONE "too much weapon one, limit is 4" # define FT_ERR_TOO_MUCH_W_TWO "too much weapon two, limit is 4" # define FT_ERR_TOO_MUCH_W_THREE "too much weapon three, limit is 4" # define FT_ERR_TOO_MUCH_ENMY "too much enemy, limit is 32" /* ** ====== 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" # define FT_ERR_MISS_TRAP "traps" # define FT_ERR_MISS_SFX_DEATH "death sound effect" # define FT_ERR_MISS_SFX_N_LVL "new level sound effect" # define FT_ERR_MISS_SFX_SCR_ONE "scream one sound effect" # define FT_ERR_MISS_SFX_SCR_TWO "scream two sound effect" # define FT_ERR_MISS_SFX_TRAP "trap sound effect" # define FT_ERR_MISS_SFX_HEAL "heal sound effect" # define FT_ERR_MISS_SFX_W_ONE_LOAD "weapon one load sound effect" # define FT_ERR_MISS_SFX_W_ONE_FIRE "weapon one fire sound effect" # define FT_ERR_MISS_SFX_W_TWO_LOAD "weapon two load sound effect" # define FT_ERR_MISS_SFX_W_TWO_FIRE "weapon two fire sound effect" # define FT_ERR_MISS_SFX_W_THREE_LOAD "weapon three load sound effect" # define FT_ERR_MISS_SFX_W_THREE_FIRE "weapon three fire sound effect" # define FT_ERR_MISS_SFX_OOA "out of ammunitions sound effect" # define FT_ERR_MISS_SFX_ENMY "one or several enemy sound effect" # define FT_ERR_MISS_DEATH_SCREEN "death screen image" # define FT_ERR_MISS_HUD_BACK "HUD background image" # define FT_ERR_MISS_HEAL_PACK "heal pack image" # define FT_ERR_MISS_W_ONE "weapon one handed image" # define FT_ERR_MISS_W_ONE_FIRE "weapon one shooting image" # define FT_ERR_MISS_W_TWO "weapon two handed image" # define FT_ERR_MISS_W_TWO_FIRE "weapon two shooting image" # define FT_ERR_MISS_W_THREE "weapon three handed image" # define FT_ERR_MISS_W_THREE_FIRE "weapon three shooting image" # define FT_ERR_MISS_W_ONE_SPR "weapon one sprite image" # define FT_ERR_MISS_W_TWO_SPR "weapon two sprite image" # define FT_ERR_MISS_W_THREE_SPR "weapon three sprite image" # define FT_ERR_MISS_ENMY "one or several enemy sprites image" # define FT_ERR_MISS_NUMBER "number image" # define FT_ERR_MISS_H_CAPTION "health caption" # define FT_ERR_MISS_A_CAPTION "ammo caption" /* ** ====== GAMEPLAY ====== */ # define FT_STRT_LIFE 270 # define FT_TRAP_DAMAGE_AMOUNT 45 # define FT_HEAL_PACK_AMOUNT 20 # define FT_BOUNCE_FACTOR 4 # define FT_WEAP_ONE_STRT_AMMO -4 # define FT_WEAP_TWO_STRT_AMMO 30 # define FT_WEAP_THREE_STRT_AMMO 10 # define FT_AMMO_PACK 6 # define FT_WEAP_MAX_AMMO 1000 # define FT_ENMY_STRT_LIFE 10 # define FT_ENMY_SIGHT_RANGE 8.5 # define FT_ENMY_DAMAGE_AMOUNT 14 # define FT_ENMY_MOVE_SPEED 0.44 # define FT_WEAP_ONE_VEL 900.0 # define FT_WEAP_TWO_VEL 450.0 # define FT_WEAP_THREE_VEL 1400.0 # define FT_W_ONE_DANAGE_AMOUNT 5 # define FT_W_TWO_DANAGE_AMOUNT 3 # define FT_W_THREE_DANAGE_AMOUNT 4 /* ** ====== OTHER ====== */ # define FT_PARSE_END_RET 25 # define FT_TOTAL_SPRT 14 # define FT_TOTAL_SFX 18 # endif