1 #define MAX_PLAYERNAME_LENGTH 20
2 #define MAX_PLAYERS 32
3 #define MAX_FILENAME_SIZE 80
4 #define MAX_NAME_LENGTH 80
5 #define NUM_THREADS 5
6 #define NUM_GAME_TYPES 3
7 #define TRUE 1
8 #define FALSE 0
9 #define MAX_WORLD_WIDTH 65535
10 #define MAX_WORLD_HEIGHT 65535
11 #define MIN_WORLD_WIDTH 320
12 #define MIN_WORLD_HEIGHT 240
13 #define MAX_PORT_VALUE 65535
14 #define NUM_SHIP_PHASES 48
15 #define STATUS_SEND_TYPE 0
16 #define SHIP_SEND_TYPE 1
17 #define OBJ_SEND_TYPE 2
18 #define SOUND_SEND_TYPE 3
19 #define MAX_SHOTS 18
20 #define MAX_SHOT_SPEED 256
21 #define MAX_SLEEP_TIME 1000
22 #define MAX_OBJECTS 512
23 #define MAX_MODELS 255
24 #define SHIP_TYPE 1
25 #define SHOT_TYPE 2
26 #define ASTEROID_TYPE 3
27 #define EXPLOSION_TYPE 4
28 #define BIG_EXPLOSION_TYPE 5
29 #define SHIELD_POWERUP_TYPE 6
30 #define ARMOR_POWERUP_TYPE 7
31 #define NUKE_POWERUP_TYPE 8
32 #define HYPERWARP_POWERUP_TYPE 9
33 #define NUKE_TYPE 10
34 #define NUKE_EXPLOSION_TYPE 11
35 #define SINGLE_PLAYER 0
36 #define FREE_FOR_ALL 1
37 #define DEATHMATCH 2
38 #define MAX_PACKET_SIZE 2048
39 #define MAX_VOLUME 9
40 #define NUM_POWERUPS 4
41 #define MAX_TYPES 128
42 
43 // Time in milliseconds between frames
44 #define FRAME_DELAY 20
45 
46 #define NUM_STARS 500
47 #define MAX_MENU_ITEMS 50
48 #define MAX_ASTEROIDS 256
49 
50 #define true 1
51 #define false 0
52 
53 
54 struct ControlStruct {
55   char Fire;
56   char Shield;
57   char xForward;
58   char xBackward;
59   char yForward;
60   char yBackward;
61   char zForward;
62   char zBackward;
63   char xFRotate;
64   char xBRotate;
65   char yFRotate;
66   char yBRotate;
67   char zFRotate;
68   char zBRotate;
69   char Nuke;
70   char Warp;
71   char rView;
72   char Score;
73   char Quit;
74 };
75 
76 struct Point {
77   float x, y, z;
78 };
79 
80 struct Color {
81   float red, green, blue;
82 };
83 
84 struct ModelPoint {
85   struct Point point;
86   struct Color color;
87   struct ModelPoint *next;
88 };
89 
90 struct Triangle {
91   struct Point *Vertices[3];
92   struct Color *VertexColors[3];
93 };
94 
95 struct Model {
96   int NumSides;
97   struct Triangle *Sides;
98   struct ModelPoint *Points;
99 };
100 
101 struct Star {
102   struct Point Position;
103   struct Color StarColor;
104 };
105 
106 struct ObjectDesc {
107   int Type;
108   int Number;
109   struct Point Position;
110   float Size;
111   float RotationMatrix[3][3];
112 };
113 
114 struct ShipDesc {
115   int Type;
116   int Number;
117   int Score;
118   int Lives;
119   char ShieldOn;
120   int Shield;
121   int Armor;
122   char Shaking;
123   char Alive;
124   char Nukes;
125   char Warps;
126   char Warping;
127   struct Point Position;
128   char PlayerName[MAX_PLAYERNAME_LENGTH];
129   float Size;
130   float RotationMatrix[3][3];
131 };
132 
133 struct SoundStruct {
134   char type;
135   struct Point Position;
136 };
137 
138 struct GameParametersStruct {
139   char GameOn;
140   short GameType;
141   short MaxPlayers;
142   short PlayerNum;
143   float WorldWidth;
144   unsigned int MaxShield;
145   unsigned int MaxArmor;
146 };
147 
148 struct PlayerActionStruct {
149   bool shooting;
150   bool shield;
151 };
152 
153 struct KeyValuesStruct {
154   char FireKey;
155   char ShieldKey;
156   char WarpKey;
157   char NukeKey;
158   char xForwardKey;
159   char xBackwardKey;
160   char yForwardKey;
161   char yBackwardKey;
162   char zForwardKey;
163   char zBackwardKey;
164   char xFRotateKey;
165   char xBRotateKey;
166   char yFRotateKey;
167   char yBRotateKey;
168   char zFRotateKey;
169   char zBRotateKey;
170 };
171