DEADSOFTWARE

Изменены физические константы
[netwar.git] / game.h
1 #include <stdbool.h>
3 #include "protocol.h"
5 #define MAX_PLAYERS 8
6 #define MAX_BULLETS (MAX_PLAYERS * 5)
7 #define TICK 24 // Количество обновлений мира в секунду
8 #define TICK_DELAY (1000 / TICK) // Задержка между тиками
9 #define BULLET_TIME (TICK * 6) // Время жизни игрока
10 #define PLAYER_SHOOT ((int)(TICK * 0.8)) // Задержка между выстрелами
12 #define PLAYER_SIZE 0.03 // Радиус игрока
13 #define STAR_SIZE 0.15 // Радиус звезды
15 typedef struct Player {
16 /* public */
17 bool live;
18 float x, y, r;
19 float vx, vy, vr;
20 int shoot;
22 /* internal */
23 bool updated;
24 } Player;
26 typedef struct Bullet {
27 /* public */
28 bool live;
29 int owner;
30 float x, y;
31 float vx, vy;
32 int tick;
34 /* internal */
35 bool updated;
36 } Bullet;
38 extern Player g_player[MAX_PLAYERS];
39 extern Bullet g_bullet[MAX_BULLETS];
41 void g_player_set(unsigned int id, bool live, float x, float y, float r, float vx, float vy, float vr, int shoot);
42 void g_bullet_set(unsigned int id, unsigned int owner, bool live, float x, float y, float vx, float vy, int tick);
43 void g_player_does(unsigned int id, DoesBits code);
44 void g_update();
45 void g_init(bool server_mode);