DEADSOFTWARE

Добавлена задержка между выстрелами. У клиента пули не создаются без подтвеждения...
[netwar.git] / game.h
1 #include <stdbool.h>
3 #include "protocol.h"
5 #define MAX_PLAYERS 32
6 #define MAX_BULLETS (MAX_PLAYERS * 8)
7 #define TICK_DELAY (1000 / 20) // 20 World updates per second
8 #define BULLET_TIME (TICK_DELAY * 6) // Bullet live time 6.0s
9 #define PLAYER_SIZE 0.01785 // Palyer radius
10 #define PLAYER_SHOOT (TICK_DELAY * 0.3) // Can shoot every 0.15s
12 typedef struct Player {
13 /* public */
14 bool live;
15 float x, y, r;
16 float vx, vy, vr;
17 int shoot;
19 /* internal */
20 bool updated;
21 } Player;
23 typedef struct Bullet {
24 /* public */
25 bool live;
26 int owner;
27 float x, y;
28 float vx, vy;
29 int tick;
31 /* internal */
32 bool updated;
33 } Bullet;
35 extern Player g_player[MAX_PLAYERS];
36 extern Bullet g_bullet[MAX_BULLETS];
38 void g_player_set(unsigned int id, bool live, float x, float y, float r, float vx, float vy, float vr, int shoot);
39 void g_bullet_set(unsigned int id, unsigned int owner, bool live, float x, float y, float vx, float vy, int tick);
40 void g_player_does(unsigned int id, DoesBits code);
41 void g_update();
42 void g_init(bool server_mode);