Mercurial > ~darius > hgwebdir.cgi > paradise_client
comparison defs.h @ 3:5a977ccbc7a9 default tip
Empty changelog
author | darius |
---|---|
date | Sat, 06 Dec 1997 05:41:29 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
2:fba0b6e6cdc7 | 3:5a977ccbc7a9 |
---|---|
1 /* $Id: defs.h,v 1.1.1.1 1997/12/06 05:41:29 darius Exp $ */ | |
2 | |
3 /* | |
4 * defs.h | |
5 */ | |
6 | |
7 #ifndef defs_h_ | |
8 #define defs_h_ | |
9 | |
10 #include "copyright.h" | |
11 | |
12 #define MAX_PLAYER 257 /* Maximum number of players we can configure | |
13 the game for, not the server's max | |
14 players. */ | |
15 | |
16 #ifdef HOCKEY | |
17 /* defs for hockey [BDyess] */ | |
18 #define NUM_HOCKEY_LINES 13 | |
19 #endif /*HOCKEY*/ | |
20 | |
21 #ifdef SIZE_LOGGING | |
22 /* redefine EXIT as print totals followed by a normal exit [BDyess] */ | |
23 #define EXIT(x) {print_totals();exit(x);} | |
24 #else | |
25 #define EXIT exit | |
26 #endif /* SIZE_LOGGING */ | |
27 | |
28 /* defs for new message window data structure [BDyess] */ | |
29 #define WREVIEW 0 | |
30 #define WTEAM 1 | |
31 #define WINDIV 2 | |
32 #define WKILL 3 | |
33 #define WPHASER 4 | |
34 #define WALL 5 | |
35 #define WNUM 6 | |
36 /* message window allow mask */ | |
37 #define WA_TEAM 1 | |
38 #define WA_INDIV 2 | |
39 #define WA_KILL 4 | |
40 #define WA_PHASER 8 | |
41 #define WA_ALL 16 | |
42 #define WA_REVIEW 32 | |
43 #define WA_MACRO 64 | |
44 | |
45 /* defs for updatePlayer [BDyess] */ | |
46 #define NO_UPDATE 0 | |
47 #define SMALL_UPDATE 1 /* update non-blk_bozo players */ | |
48 #define LARGE_UPDATE 2 /* update blk_bozo players */ | |
49 #define ALL_UPDATE (SMALL_UPDATE|LARGE_UPDATE) /* update both */ | |
50 | |
51 /* defs for terrain */ | |
52 #define TERRAIN_STARTED 1 | |
53 #define TERRAIN_DONE 2 | |
54 | |
55 /* defs for timer [BDyess] */ | |
56 #define T_NONE 0 /* no timer */ | |
57 #define T_DAY 1 /* time of day */ | |
58 #define T_SERVER 2 /* time on server */ | |
59 #define T_SHIP 3 /* time in ship */ | |
60 #define T_USR 4 /* user reset timer */ | |
61 #define T_TOTAL 5 /* number of T_ defs */ | |
62 #define TIMESTRLEN 10 /* used in db_timer(), timeString() */ | |
63 /* */ | |
64 | |
65 /* defs for mapmode */ | |
66 #define GMAP_NEVER 0 | |
67 #define GMAP_FREQUENT 1 | |
68 #define GMAP_INFREQUENT 2 | |
69 | |
70 #ifdef METASERVER | |
71 /* metaserver window defs */ | |
72 #define LINE 80 | |
73 #define METASERVERADDRESS "metaserver.ecst.csuchico.edu" /* new metaserver */ | |
74 #define METAPORT 3521 /* HAVE to use nicely formated version */ | |
75 #define KEY 3 | |
76 #endif /* METASERVER */ | |
77 | |
78 #define MAX_PLANETS 257 | |
79 | |
80 #define WINSIDE 500 /* Size of strategic and tactical windows */ | |
81 #define BORDER 4 /* border width for option windows */ | |
82 #define PSEUDOSIZE 16 | |
83 #define CLOAK_PHASES 7 /* number of drawing phases in a cloak | |
84 engage/disengage */ | |
85 #define NUMRANKS 9 /* old netrek ranks */ | |
86 /*#define NUMRANKS2 18*/ | |
87 | |
88 /* These are configuration definitions */ | |
89 | |
90 #define GWIDTH 200000 /* galaxy is 200000 spaces on a side */ | |
91 #define WARP1 20 /* warp one will move 20 spaces per update */ | |
92 #define SCALE 40 /* Window will be one pixel for 20 spaces */ | |
93 #define EXPDIST 350 /* At this range a torp will explode */ | |
94 #define GRIDSIZE 33333 | |
95 | |
96 #define DETDIST 1600 /* At this range a player can detonate a torp */ | |
97 | |
98 #define PHASEDIST 6000 /* At this range a player can do damage with | |
99 phasers */ | |
100 #define ENTORBDIST 900 /* At this range a player can orbit a planet */ | |
101 #define ORBDIST 800 /* A player will orbit at this radius */ | |
102 #define ORBSPEED 2 /* This is the fastest a person can go into | |
103 orbit */ | |
104 #define PFIREDIST 1500 /* At this range a planet will shoot at a | |
105 player */ | |
106 #define UPDATE 100000 /* Update time is 100000 micro-seconds */ | |
107 | |
108 #define AUTOQUIT 60 /* auto logout in 60 secs */ | |
109 | |
110 #define VACANT -1 /* indicates vacant port on a starbase */ | |
111 #define DOCKDIST 600 | |
112 #define DOCKSPEED 2 /* If base is moving, there will be some | |
113 finesse involved to dock */ | |
114 #define NUMPORTS 4 | |
115 #define SBFUELMIN 10000 /* If starbase's fuel is less than this, it | |
116 will not refuel docked vessels */ | |
117 #define TRACTDIST 6000 /* maximum effective tractor beam range */ | |
118 #define TRACTEHEAT 5 /* ammount tractor beams heat engines */ | |
119 #define TRACTCOST 20 /* fuel cost of activated tractor beam */ | |
120 | |
121 /* These are memory sections */ | |
122 #define PLAYER 1 | |
123 #define MAXMESSAGE 50 | |
124 #define MAXREVIEWMESSAGE 20 | |
125 | |
126 #ifdef SVR4 | |
127 #define MCOPY(b1,b2,l) memcpy(b2,b1,l) | |
128 #else | |
129 #define MCOPY(b1,b2,l) bcopy(b1,b2,l) | |
130 #endif | |
131 #define rosette(x, ndiv) (( (((x)&0xff) + 0x100/(2*(ndiv))) * (ndiv)/0x100 ) % ndiv) | |
132 | |
133 /* These are the teams */ | |
134 /* Note that I used bit types for these mostly for messages and | |
135 war status. This was probably a mistake. It meant that Ed | |
136 had to add the 'remap' area to map these (which are used throughout | |
137 the code as the proper team variable) into a nice four team deep | |
138 array for his color stuff. Oh well. | |
139 */ | |
140 #define NOBODY 0x0 | |
141 #define FEDi 0 | |
142 #define ROMi 1 | |
143 #define KLIi 2 | |
144 #define ORIi 3 | |
145 /* #define ALLTEAMi 4 *//* replaced by number_of_teams */ | |
146 #define FEDm 0x1 | |
147 #define ROMm 0x2 | |
148 #define KLIm 0x4 | |
149 #define ORIm 0x8 | |
150 #define ALLTEAM ( (1<<number_of_teams) - 1) | |
151 /*#define MAXTEAM 3 *//* number_of_teams -1 */ | |
152 /*#define NUMTEAM 4 *//* number_of_teams */ | |
153 /* | |
154 ** These are random configuration variables | |
155 */ | |
156 #define VICTORY 3 /* Number of systems needed to conquer the | |
157 galaxy */ | |
158 #define WARNTIME 30 /* Number of updates to have a warning on the | |
159 screen */ | |
160 #define MESSTIME 30 /* Number of updates to have a message on the | |
161 screen */ | |
162 | |
163 /* Flags for gettarget */ | |
164 #define TARG_SHIP (1<<0) | |
165 #define TARG_BASE (1<<1) | |
166 #define TARG_PLANET (1<<2) | |
167 #define TARG_CLOAK (1<<3) /* Include cloaked ships in search */ | |
168 #define TARG_SELF (1<<4) | |
169 #define TARG_ENEMY (1<<5) /* enemy ships/planets only */ | |
170 #define TARG_FRIENDLY (1<<6) /* friendly ships/planets only */ | |
171 #define TARG_TEAM (1<<7) /* same team */ | |
172 #define TARG_STAR (1<<8) | |
173 #define TARG_NEBULA (1<<9) | |
174 #define TARG_BLACKHOLE (1<<10) | |
175 | |
176 #define TARG_PLAYER (TARG_SHIP|TARG_BASE) | |
177 #define TARG_ASTRAL (TARG_PLANET|TARG_STAR|TARG_NEBULA|TARG_BLACKHOLE) | |
178 | |
179 #define DEFAULT_SERVER "cassius.cs.uiuc.edu" | |
180 #define DEFAULT_PORT 2592 | |
181 | |
182 #define hypot(x,y) sqrt((x)*(x)+(y)*(y)) | |
183 | |
184 #define ABS(a) /* abs(a) */ (((a) < 0) ? -(a) : (a)) | |
185 #ifndef MAX | |
186 #define MAX(a,b) ((a) > (b) ? (a) : (b)) | |
187 #endif | |
188 | |
189 #define myPlasmaTorp(t) (me->p_no == (t)->pt_owner) | |
190 #define myTorp(t) (me->p_no == (t)->t_owner) | |
191 #define friendlyPlasmaTorp(t) ((!(idx_to_mask(me->p_teami) & (t)->pt_war)) || (myPlasmaTorp(t))) | |
192 #define friendlyTorp(t) ((!(idx_to_mask(me->p_teami) & (t)->t_war)) || (myTorp(t))) | |
193 #define myPhaser(p) (&phasers[me->p_no] == (p)) | |
194 #define friendlyPhaser(p) (me->p_teami == players[(p) - phasers].p_teami) | |
195 #define myPlayer(p) (me == (p)) | |
196 #define myPlanet(p) (me->p_teami == mask_to_idx((p)->pl_owner)) | |
197 #define friendlyPlayer(p) ((!(idx_to_mask(me->p_teami) & \ | |
198 ((p)->p_swar | (p)->p_hostile))) && \ | |
199 (!(idx_to_mask((p)->p_teami) & \ | |
200 (me->p_swar | me->p_hostile)))) | |
201 #define isAlive(p) ((p)->p_status == PALIVE) | |
202 #define isPlaying(p) ((p)->p_status != PFREE) | |
203 #define isBase(num) ((num)==STARBASE || (num)==WARBASE || \ | |
204 (num)==JUMPSHIP) | |
205 #define friendlyPlanet(p) ((p)->pl_info & idx_to_mask(me->p_teami) && \ | |
206 !((p)->pl_owner & (me->p_swar | me->p_hostile))) | |
207 | |
208 #define isLockPlanet(p) ((me->p_flags & PFPLLOCK) && (me->p_planet == p->pl_no)) | |
209 #define isLockPlayer(p) ((me->p_flags & PFPLOCK) && (me->p_playerl == p->p_no)) | |
210 #define PtOutsideWin(x, y) (x < 0 || x > WINSIDE || y < 0 || y > WINSIDE) /* TSH */ | |
211 | |
212 #define torpColor(t) \ | |
213 (myTorp(t) ? myColor : shipCol[1+players[(t)->t_owner].p_teami]) | |
214 #define droneColor(t) \ | |
215 (myTorp(t) ? myColor : shipCol[1+players[(t)->t_owner].p_teami]) | |
216 #define plasmatorpColor(t) \ | |
217 (myPlasmaTorp(t) ? myColor : shipCol[1+players[(t)->pt_owner].p_teami]) | |
218 #define phaserColor(p) \ | |
219 (myPhaser(p) ? myColor : shipCol[1+players[(p) - phasers].p_teami]) | |
220 /* | |
221 * Cloaking phase (and not the cloaking flag) is the factor in determining | |
222 * the color of the ship. Color 0 is white (same as 'myColor' used to be). | |
223 */ | |
224 #define playerColor(p) \ | |
225 (myPlayer(p) ? myColor : shipCol[1+(p)->p_teami]) | |
226 #define planetColor(p) \ | |
227 (((p)->pl_info & idx_to_mask(me->p_teami)) ? shipCol[1+mask_to_idx((p)->pl_owner)] : unColor) | |
228 | |
229 #define planetFont(p) \ | |
230 (myPlanet(p) ? W_BoldFont : friendlyPlanet(p) ? W_UnderlineFont \ | |
231 : W_RegularFont) | |
232 #define shipFont(p) \ | |
233 (myPlayer(p) ? W_BoldFont : friendlyPlayer(p) ? W_UnderlineFont \ | |
234 : W_RegularFont) | |
235 #define bombingRating(p) \ | |
236 ((float) (p)->p_stats.st_tarmsbomb * status->timeprod / \ | |
237 ((float) (p)->p_stats.st_tticks * status->armsbomb)) | |
238 #define planetRating(p) \ | |
239 ((float) (p)->p_stats.st_tplanets * status->timeprod / \ | |
240 ((float) (p)->p_stats.st_tticks * status->planets)) | |
241 #define offenseRating(p) \ | |
242 ((float) (p)->p_stats.st_tkills * status->timeprod / \ | |
243 ((float) (p)->p_stats.st_tticks * status->kills)) | |
244 #define defenseRating(p) \ | |
245 ((float) (p)->p_stats.st_tticks * status->losses / \ | |
246 ((p)->p_stats.st_tlosses!=0 ? \ | |
247 ((float) (p)->p_stats.st_tlosses * status->timeprod) : \ | |
248 (status->timeprod))) | |
249 | |
250 #ifdef SVR4 /* to get it to work under Solaris */ | |
251 #define srandom srand48 | |
252 #define bcopy(s,d,l) memmove((d),(s),(l)) | |
253 #define bzero(s,l) memset((s),(char)0,(l)) | |
254 #define random lrand48 | |
255 #define rindex(s,c) strrchr((s),(c)) | |
256 #endif /* SVR4 */ | |
257 | |
258 #ifdef ROTATERACE | |
259 #define sendTorpReq(dir) sendShortPacket(CP_TORP, RotateDirSend(dir)) | |
260 #define sendPhaserReq(dir) sendShortPacket(CP_PHASER, RotateDirSend(dir)) | |
261 #define sendDirReq(dir) sendShortPacket(CP_DIRECTION, RotateDirSend(dir)) | |
262 #define sendPlasmaReq(dir) sendShortPacket(CP_PLASMA, RotateDirSend(dir)) | |
263 #else | |
264 #define sendTorpReq(dir) sendShortPacket(CP_TORP, dir) | |
265 #define sendPhaserReq(dir) sendShortPacket(CP_PHASER, dir) | |
266 #define sendDirReq(dir) sendShortPacket(CP_DIRECTION, dir) | |
267 #define sendPlasmaReq(dir) sendShortPacket(CP_PLASMA, dir) | |
268 #endif /* ROTATERACE */ | |
269 | |
270 #define sendSpeedReq(speed) sendShortPacket(CP_SPEED, speed) | |
271 #define sendShieldReq(state) sendShortPacket(CP_SHIELD, state) | |
272 #define sendOrbitReq(state) sendShortPacket(CP_ORBIT, state) | |
273 #define sendRepairReq(state) sendShortPacket(CP_REPAIR, state) | |
274 #define sendBeamReq(state) sendShortPacket(CP_BEAM, state) | |
275 #define sendCopilotReq(state) sendShortPacket(CP_COPILOT, state) | |
276 #define sendDetonateReq() sendShortPacket(CP_DET_TORPS, 0) | |
277 #define sendCloakReq(state) sendShortPacket(CP_CLOAK, state) | |
278 #define sendBombReq(state) sendShortPacket(CP_BOMB, state) | |
279 #define sendPractrReq() sendShortPacket(CP_PRACTR, 0) | |
280 #define sendWarReq(mask) sendShortPacket(CP_WAR, mask) | |
281 #define sendRefitReq(ship) sendShortPacket(CP_REFIT, ship) | |
282 #define sendPlaylockReq(pnum) sendShortPacket(CP_PLAYLOCK, pnum) | |
283 #define sendPlanlockReq(pnum) sendShortPacket(CP_PLANLOCK, pnum) | |
284 #define sendCoupReq() sendShortPacket(CP_COUP, 0) | |
285 #define sendQuitReq() sendShortPacket(CP_QUIT, 0) | |
286 #define sendByeReq() sendShortPacket(CP_BYE, 0) | |
287 #define sendDockingReq(state) sendShortPacket(CP_DOCKPERM, state) | |
288 #define sendResetStatsReq(verify) sendShortPacket(CP_RESETSTATS, verify) | |
289 #ifdef ATM | |
290 #define sendScanReq(who) sendShortPacket(CP_SCAN, who) /* ATM */ | |
291 #endif /* ATM */ | |
292 | |
293 /* This macro allows us to time things based upon # frames / sec. | |
294 */ | |
295 #define ticks(x) ((x)*200000/timerDelay) | |
296 | |
297 char *getdefault(); | |
298 | |
299 #ifdef ATM | |
300 /* | |
301 * UDP control stuff | |
302 */ | |
303 #ifdef GATEWAY | |
304 #define UDP_NUMOPTS 11 | |
305 #define UDP_GW UDP_NUMOPTS-1 | |
306 #else | |
307 #define UDP_NUMOPTS 10 | |
308 #endif | |
309 #define UDP_CURRENT 0 | |
310 #define UDP_STATUS 1 | |
311 #define UDP_DROPPED 2 | |
312 #define UDP_SEQUENCE 3 | |
313 #define UDP_SEND 4 | |
314 #define UDP_RECV 5 | |
315 #define UDP_DEBUG 6 | |
316 #define UDP_FORCE_RESET 7 | |
317 #define UDP_UPDATE_ALL 8 | |
318 #define UDP_DONE 9 | |
319 #define COMM_TCP 0 | |
320 #define COMM_UDP 1 | |
321 #define COMM_VERIFY 2 | |
322 #define COMM_UPDATE 3 | |
323 #define COMM_MODE 4 | |
324 #define SWITCH_TCP_OK 0 | |
325 #define SWITCH_UDP_OK 1 | |
326 #define SWITCH_DENIED 2 | |
327 #define SWITCH_VERIFY 3 | |
328 #define CONNMODE_PORT 0 | |
329 #define CONNMODE_PACKET 1 | |
330 #define STAT_CONNECTED 0 | |
331 #define STAT_SWITCH_UDP 1 | |
332 #define STAT_SWITCH_TCP 2 | |
333 #define STAT_VERIFY_UDP 3 | |
334 #define MODE_TCP 0 | |
335 #define MODE_SIMPLE 1 | |
336 #define MODE_FAT 2 | |
337 #define MODE_DOUBLE 3 | |
338 | |
339 #define UDP_RECENT_INTR 300 | |
340 #define UDP_UPDATE_WAIT 5 | |
341 | |
342 /* client version of UDPDIAG */ | |
343 #define UDPDIAG(x) { if (udpDebug) { printf("UDP: "); printf x; }} | |
344 #define V_UDPDIAG(x) UDPDIAG(x) | |
345 #endif /* ATM */ | |
346 | |
347 #define RSA_VERSION "RSA v2.0 CLIENT" /* string must begin with characters | |
348 "RSA v" */ | |
349 #define KEY_SIZE 32 | |
350 #define RESERVED_SIZE 16 | |
351 #define MSG_LEN 80 | |
352 #define NAME_LEN 16 | |
353 #define KEYMAP_LEN 96 | |
354 | |
355 #ifdef ROTATERACE | |
356 #define RotateDirSend(d) (rotate?d-rotate_deg:d) | |
357 #endif | |
358 | |
359 #ifdef SHORT_PACKETS | |
360 #define SPK_VOFF 0 /* variable packets off */ | |
361 #define SPK_VON 1 /* variable packets on */ | |
362 #define SPK_MOFF 2 /* message packets off */ | |
363 #define SPK_MON 3 /* message packets on */ | |
364 #define SPK_M_KILLS 4 /* send kill mesgs */ | |
365 #define SPK_M_NOKILLS 5 /* don't send kill mesgs */ | |
366 #define SPK_THRESHOLD 6 /* threshold */ | |
367 #define SPK_M_WARN 7 /* warnings */ | |
368 #define SPK_M_NOWARN 8 /* no warnings */ | |
369 #define SPK_SALL 9 /* only planets,kills and weapons */ | |
370 #define SPK_ALL 10 /* Full Update - SP_STATS */ | |
371 | |
372 #define SPK_NUMFIELDS 7 | |
373 | |
374 #define SPK_VFIELD 0 | |
375 #define SPK_MFIELD 1 | |
376 #define SPK_KFIELD 2 | |
377 #define SPK_WFIELD 3 | |
378 #define SPK_TFIELD 4 | |
379 #define SPK_WHYFIELD 5 | |
380 #define SPK_DONE 6 | |
381 #endif | |
382 | |
383 #ifdef TOOLS | |
384 #define TOOLSWINLEN 25 | |
385 #endif | |
386 | |
387 #ifdef BEEPLITE | |
388 #define LITE_PLAYERS_MAP 0x01 | |
389 #define LITE_PLAYERS_LOCAL 0x02 | |
390 #define LITE_SELF 0x04 | |
391 #define LITE_PLANETS 0x08 | |
392 #define LITE_SOUNDS 0x10 | |
393 #define LITE_COLOR 0x20 | |
394 #endif | |
395 | |
396 #ifdef AMIGA | |
397 #include "amigadefs.h" | |
398 #else | |
399 #define sock_write write | |
400 #define sock_close close | |
401 #define sock_ioctl ioctl | |
402 #endif /* AMIGA */ | |
403 | |
404 #ifdef RECORDER | |
405 #define PB_REDALERT -1 | |
406 #define PB_YELLOWALERT -2 | |
407 #define PB_DEATH -3 | |
408 #endif | |
409 | |
410 #if defined (sgi) || defined (__FreeBSD__) || defined (__NetBSD__) | |
411 #define strcmpi strcasecmp | |
412 #define strncmpi strncasecmp | |
413 #endif | |
414 | |
415 #endif |