DEADSOFTWARE

Скорости не зависят от количества тиков
[netwar.git] / game.h
diff --git a/game.h b/game.h
index 17c2b68dfafec9a26463c9db8624a2fd732069c9..00b06cccfc30130de9f36ef98de92257200e363e 100644 (file)
--- a/game.h
+++ b/game.h
@@ -2,22 +2,41 @@
 
 #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_DELAY   (1000 / 20)       // 20 World updates per second
+#define BULLET_TIME  (TICK_DELAY * 6)  // Bullet live time 6.0s
+#define PLAYER_SIZE  0.01785           // Palyer radius
+#define PLAYER_SHOOT (TICK_DELAY * 1)  // Can shoot every 1.0s (less then 1s not work)
 
 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);