2023-09-18 15:56:17 -04:00
# ifndef DEFINE_H__
# define DEFINE_H__
# include <iostream>
2023-09-25 08:23:52 -04:00
# include <chrono>
2023-09-18 15:56:17 -04:00
2023-10-27 13:39:18 -04:00
# define SRV_PORT 10000
# define CLI_PORT 10001
2023-09-24 08:45:40 -04:00
2023-10-31 14:38:30 -04:00
# define BUFFER_LENGTH 1500
2023-10-23 16:23:27 -04:00
2023-11-20 16:02:45 -05:00
# define CHUNK_SIZE_X 6
2023-09-25 08:23:52 -04:00
# define CHUNK_SIZE_Y 64
2023-11-20 16:02:45 -05:00
# define CHUNK_SIZE_Z 6
2023-09-25 08:23:52 -04:00
# define MAX_SELECTION_DISTANCE 5
2023-09-29 12:04:08 -04:00
# define SEED 0
2023-09-25 17:17:17 -04:00
# define COUNTDOWN 300
2023-09-25 08:23:52 -04:00
2023-09-18 15:56:17 -04:00
# define WORLD_SIZE_X 64
# define WORLD_SIZE_Y 64
2023-09-30 14:46:54 -04:00
# define FRAMES_RENDER_CHUNKS 1
# define FRAMES_UPDATE_CHUNKS 1
# define FRAMES_DELETE_CHUNKS 1
# define THREADS_GENERATE_CHUNKS 8
2023-09-30 18:33:23 -04:00
# define THREADS_UPDATE_CHUNKS 6
2023-09-30 14:46:54 -04:00
# define THREADS_DELETE_CHUNKS 3
2023-11-20 15:43:01 -05:00
# define VIEW_DISTANCE 512 // Si les chunks arr<72> tent de s'afficher pendant une game et qu'il y a un access violation quand tu quitte, il faut augmenter ce chiffre.
2023-09-25 08:23:52 -04:00
# define TEXTURE_SIZE 512
# define MAX_BULLETS 512
2023-09-18 15:56:17 -04:00
2023-10-30 14:03:10 -04:00
# define TIME_SPEED_BOOST 10 //secondes
# define TIME_DAMAGE_BOOST 10 //secondes
# define TIME_INVINCIBLE_BOOST 4 //secondes
# define STRENGTH_SPEED_BOOST 10 //Pourcentage
2023-10-27 13:27:00 -04:00
# define BULLET_TIME .1
2023-09-25 08:23:52 -04:00
typedef uint8_t BlockType ;
2023-11-20 16:02:45 -05:00
enum BLOCK_TYPE { BTYPE_AIR , BTYPE_DIRT , BTYPE_GRASS , BTYPE_METAL , BTYPE_ICE , BTYPE_GREENGRASS , BTYPE_LAST } ;
2023-10-30 14:03:10 -04:00
typedef uint8_t BoostType ;
2023-10-30 14:32:20 -04:00
enum BOOST_TYPE { BTYPE_SPEED , BTYPE_HEAL , BTYPE_DAMAGE , BTYPE_INVINCIBLE , BTYPE_BOOST_LAST } ;
2023-12-05 13:44:54 -05:00
//anim
2023-11-20 14:28:54 -05:00
enum ANIM_TYPE { STILL = 0 , SHOOTING = 8 , JUMPING = 16 , JUMPINGSHOOTING = 24 , DEAD = 32 , TYPE_LAST = 40 } ;
enum ANIM_POS { FRONT , QUARTER_FRONT_LEFT , QUATER_FRONT_RIGHT , PROFIL_LEFT , PROFIL_RIGHT , QUARTER_BACK_LEFT , QUARTER_BACK_RIGHT , BACK , POS_LAST } ;
2023-12-05 13:44:54 -05:00
2023-09-25 16:30:03 -04:00
typedef uint64_t Timestamp ;
2023-09-18 15:56:17 -04:00
2023-09-25 08:23:52 -04:00
# ifdef _WIN32
2023-09-18 15:56:17 -04:00
2023-09-25 08:23:52 -04:00
# pragma comment(lib,"wsock32.lib") // Pour pouvoir faire fonctionner le linker sans le vcxproject
2023-09-27 11:24:41 -04:00
# pragma comment(lib,"ws2_32.lib")
2023-11-16 23:39:44 -05:00
2023-09-27 11:24:41 -04:00
# include <ws2tcpip.h>
2023-09-25 08:23:52 -04:00
# include <Windows.h>
# include <cstdio>
# include <ctime>
2023-09-18 15:56:17 -04:00
2023-11-06 13:56:12 -05:00
# define poll WSAPoll
2023-10-30 11:11:13 -04:00
# define flag_t u_long
# define addrlen_t int
2023-10-28 14:11:01 -04:00
# define ioctl ioctlsocket
2023-10-28 14:41:23 -04:00
# define SOCK_NONBLOCK FIONBIO
2023-10-28 12:13:45 -04:00
# define strcpy strcpy_s
2023-09-25 08:23:52 -04:00
# define popen _popen
# define pclose _pclose
2023-09-18 15:56:17 -04:00
2023-09-25 08:23:52 -04:00
# else // Pas _WIN32
# include <unistd.h>
# include <time.h>
# include <stdio.h>
# include <sys/socket.h>
2023-10-28 14:11:01 -04:00
# include <sys/ioctl.h>
2023-09-25 08:23:52 -04:00
# include <arpa/inet.h>
# include <netinet/in.h>
2023-10-01 11:52:07 -04:00
# include <cstring>
2023-12-05 13:44:54 -05:00
# include <poll.h>
2023-09-25 08:23:52 -04:00
2023-10-30 11:11:13 -04:00
# define flag_t unsigned int
2023-10-24 07:32:16 -04:00
# define addrlen_t unsigned int
2023-09-25 08:23:52 -04:00
# define SOCKET int
# define INVALID_SOCKET -1
# define closesocket close
# endif // _WIN32
2023-09-18 15:56:17 -04:00
# endif // DEFINE_H__