X-Git-Url: https://deadsoftware.ru/gitweb?a=blobdiff_plain;f=game.h;h=e41bb05b40a5a75a2ff54bc39db0c044601a4a41;hb=f23bc975650813d88a819d403e1b9e1795086242;hp=17c2b68dfafec9a26463c9db8624a2fd732069c9;hpb=c4b04d12861ae0eac6315b1c2170013422136f80;p=netwar.git diff --git a/game.h b/game.h index 17c2b68..e41bb05 100644 --- a/game.h +++ b/game.h @@ -2,22 +2,44 @@ #include "protocol.h" -#define MAX_PLAYERS 64 -#define TICK_DELAY (1000 / 60) -#define PLAYER_SIZE 0.01785 +#define MAX_PLAYERS 32 +#define MAX_BULLETS (MAX_PLAYERS * 8) +#define TICK 24 // Количество обновлений мира в секунду +#define TICK_DELAY (1000 / TICK) // Задержка между тиками +#define BULLET_TIME (TICK * 6) // Время жизни игрока +#define PLAYER_SHOOT ((int)(TICK * 0.8)) // Задержка между выстрелами + +#define PLAYER_SIZE 0.01785 // Радиус игрока +#define STAR_SIZE 0.1 // Радиус звезды typedef struct Player { /* public */ bool live; float x, y, r; float vx, vy, vr; + int shoot; /* internal */ bool updated; } Player; +typedef struct Bullet { + /* public */ + bool live; + int owner; + float x, y; + float vx, vy; + int tick; + + /* internal */ + bool updated; +} Bullet; + extern Player g_player[MAX_PLAYERS]; +extern Bullet g_bullet[MAX_BULLETS]; -void g_player_set(unsigned int id, bool live, float x, float y, float r, float vx, float vy, float vr); -void g_player_does(unsigned int id, DoesCode code); +void g_player_set(unsigned int id, bool live, float x, float y, float r, float vx, float vy, float vr, int shoot); +void g_bullet_set(unsigned int id, unsigned int owner, bool live, float x, float y, float vx, float vy, int tick); +void g_player_does(unsigned int id, DoesBits code); void g_update(); +void g_init(bool server_mode);