annotate src/defs.h @ 11:9fda93e18de5

Testing CVS in xEmacs
author darius
date Sat, 06 Dec 1997 04:46:49 +0000
parents cafa94d86546
children b7fe2e0e4b86
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3
cafa94d86546 Initial revision
darius
parents:
diff changeset
1 /*--------------------------------------------------------------------------
cafa94d86546 Initial revision
darius
parents:
diff changeset
2 NETREK II -- Paradise
cafa94d86546 Initial revision
darius
parents:
diff changeset
3
cafa94d86546 Initial revision
darius
parents:
diff changeset
4 Permission to use, copy, modify, and distribute this software and its
cafa94d86546 Initial revision
darius
parents:
diff changeset
5 documentation, or any derivative works thereof, for any NON-COMMERCIAL
cafa94d86546 Initial revision
darius
parents:
diff changeset
6 purpose and without fee is hereby granted, provided that this copyright
cafa94d86546 Initial revision
darius
parents:
diff changeset
7 notice appear in all copies. No representations are made about the
cafa94d86546 Initial revision
darius
parents:
diff changeset
8 suitability of this software for any purpose. This software is provided
cafa94d86546 Initial revision
darius
parents:
diff changeset
9 "as is" without express or implied warranty.
cafa94d86546 Initial revision
darius
parents:
diff changeset
10
cafa94d86546 Initial revision
darius
parents:
diff changeset
11 Xtrek Copyright 1986 Chris Guthrie
cafa94d86546 Initial revision
darius
parents:
diff changeset
12 Netrek (Xtrek II) Copyright 1989 Kevin P. Smith
cafa94d86546 Initial revision
darius
parents:
diff changeset
13 Scott Silvey
cafa94d86546 Initial revision
darius
parents:
diff changeset
14 Paradise II (Netrek II) Copyright 1993 Larry Denys
cafa94d86546 Initial revision
darius
parents:
diff changeset
15 Kurt Olsen
cafa94d86546 Initial revision
darius
parents:
diff changeset
16 Brandon Gillespie
cafa94d86546 Initial revision
darius
parents:
diff changeset
17 --------------------------------------------------------------------------*/
cafa94d86546 Initial revision
darius
parents:
diff changeset
18
cafa94d86546 Initial revision
darius
parents:
diff changeset
19 #ifndef defs_h_
cafa94d86546 Initial revision
darius
parents:
diff changeset
20 #define defs_h_
cafa94d86546 Initial revision
darius
parents:
diff changeset
21
cafa94d86546 Initial revision
darius
parents:
diff changeset
22
cafa94d86546 Initial revision
darius
parents:
diff changeset
23 #ifdef SVR4 /* to get it to work under Solaris [BDyess] */
cafa94d86546 Initial revision
darius
parents:
diff changeset
24 #define sigsetmask sigset
cafa94d86546 Initial revision
darius
parents:
diff changeset
25 #endif /* SVR4 */
cafa94d86546 Initial revision
darius
parents:
diff changeset
26
cafa94d86546 Initial revision
darius
parents:
diff changeset
27 #define MAXPLAYER 32
cafa94d86546 Initial revision
darius
parents:
diff changeset
28
cafa94d86546 Initial revision
darius
parents:
diff changeset
29 #define MAXPLANETS 60 /* A new variable called NUMPLANETS takes the
cafa94d86546 Initial revision
darius
parents:
diff changeset
30 * place of this #define in many parts of the
cafa94d86546 Initial revision
darius
parents:
diff changeset
31 * code -- this one just sets the initial
cafa94d86546 Initial revision
darius
parents:
diff changeset
32 * array sizes, so it is, literally, a
cafa94d86546 Initial revision
darius
parents:
diff changeset
33 * maximum */
cafa94d86546 Initial revision
darius
parents:
diff changeset
34
cafa94d86546 Initial revision
darius
parents:
diff changeset
35 #define MAX_GWIDTH 200000 /* GWIDTH is used in most of the code -- this
cafa94d86546 Initial revision
darius
parents:
diff changeset
36 * is a max value. */
cafa94d86546 Initial revision
darius
parents:
diff changeset
37 #define TGRID_GRANULARITY 800 /* The width and height, in the same units as
cafa94d86546 Initial revision
darius
parents:
diff changeset
38 * GWIDTH, of one terrain_grid unit. */
cafa94d86546 Initial revision
darius
parents:
diff changeset
39 #define NTERRAIN 128 /* number of bytes of zipped terrain data to
cafa94d86546 Initial revision
darius
parents:
diff changeset
40 * send */
cafa94d86546 Initial revision
darius
parents:
diff changeset
41 /* at once */
cafa94d86546 Initial revision
darius
parents:
diff changeset
42 #define LOG2NTERRAIN 7 /* well, you should be able to figure this
cafa94d86546 Initial revision
darius
parents:
diff changeset
43 * out */
cafa94d86546 Initial revision
darius
parents:
diff changeset
44 #define TERRAIN_MASK NTERRAIN-1 /* NTERRAIN should always be a power of 2,
cafa94d86546 Initial revision
darius
parents:
diff changeset
45 * otherwise */
cafa94d86546 Initial revision
darius
parents:
diff changeset
46 /* updateTerrain() in socket.c will break */
cafa94d86546 Initial revision
darius
parents:
diff changeset
47 /*
cafa94d86546 Initial revision
darius
parents:
diff changeset
48 * NOTE! NTERRAIN can *NEVER* be greater than 128 due to the way the
cafa94d86546 Initial revision
darius
parents:
diff changeset
49 * structure
cafa94d86546 Initial revision
darius
parents:
diff changeset
50 */
cafa94d86546 Initial revision
darius
parents:
diff changeset
51 /*
cafa94d86546 Initial revision
darius
parents:
diff changeset
52 * and socket code work. This may eventually be a bummer when higher
cafa94d86546 Initial revision
darius
parents:
diff changeset
53 * bandwidths
cafa94d86546 Initial revision
darius
parents:
diff changeset
54 */
cafa94d86546 Initial revision
darius
parents:
diff changeset
55 /*
cafa94d86546 Initial revision
darius
parents:
diff changeset
56 * are around, but for now with me & my linux box, this is just fine.
cafa94d86546 Initial revision
darius
parents:
diff changeset
57 * Besides,
cafa94d86546 Initial revision
darius
parents:
diff changeset
58 */
cafa94d86546 Initial revision
darius
parents:
diff changeset
59 /*
cafa94d86546 Initial revision
darius
parents:
diff changeset
60 * preliminary tests show that the gzipped terrain grid to be usually less
cafa94d86546 Initial revision
darius
parents:
diff changeset
61 * than
cafa94d86546 Initial revision
darius
parents:
diff changeset
62 */
cafa94d86546 Initial revision
darius
parents:
diff changeset
63 /* 350 bytes anyway. */
cafa94d86546 Initial revision
darius
parents:
diff changeset
64
cafa94d86546 Initial revision
darius
parents:
diff changeset
65 #define TGRID_SIZE (MAX_GWIDTH/TGRID_GRANULARITY)
cafa94d86546 Initial revision
darius
parents:
diff changeset
66
cafa94d86546 Initial revision
darius
parents:
diff changeset
67 #define MAXTORP 8
cafa94d86546 Initial revision
darius
parents:
diff changeset
68
cafa94d86546 Initial revision
darius
parents:
diff changeset
69 /* Parnes's (Raynfala's) Butt Torp Code */
cafa94d86546 Initial revision
darius
parents:
diff changeset
70 /* HALFARC = (0-128), FACTOR = (0-16) */
cafa94d86546 Initial revision
darius
parents:
diff changeset
71
cafa94d86546 Initial revision
darius
parents:
diff changeset
72 #define TORP_PENALTY_HALFARC myship->s_torp.wtemp_halfarc
cafa94d86546 Initial revision
darius
parents:
diff changeset
73 #define TORP_PENALTY_FACTOR myship->s_torp.wtemp_factor
cafa94d86546 Initial revision
darius
parents:
diff changeset
74
cafa94d86546 Initial revision
darius
parents:
diff changeset
75 #define NPTHINGIES 8
cafa94d86546 Initial revision
darius
parents:
diff changeset
76 #define NGTHINGIES 40
cafa94d86546 Initial revision
darius
parents:
diff changeset
77 #define TOTALTHINGIES (MAXPLAYER*NPTHINGIES + NGTHINGIES)
cafa94d86546 Initial revision
darius
parents:
diff changeset
78 #define MAXPLASMA 1
cafa94d86546 Initial revision
darius
parents:
diff changeset
79 #define WINSIDE 500 /* Size of strategic and tactical windows */
cafa94d86546 Initial revision
darius
parents:
diff changeset
80 #define BORDER 4 /* border width for option windows */
cafa94d86546 Initial revision
darius
parents:
diff changeset
81 #define PSEUDOSIZE 16
cafa94d86546 Initial revision
darius
parents:
diff changeset
82 #define CLOAK_PHASES 7 /* number of drawing phases in a cloak
cafa94d86546 Initial revision
darius
parents:
diff changeset
83 * engage/disengage */
cafa94d86546 Initial revision
darius
parents:
diff changeset
84 #define NUMRANKS 18
cafa94d86546 Initial revision
darius
parents:
diff changeset
85 #ifdef CASSIUS_ROYALTY
cafa94d86546 Initial revision
darius
parents:
diff changeset
86 #define NUMROYALRANKS 10
cafa94d86546 Initial revision
darius
parents:
diff changeset
87 #else
cafa94d86546 Initial revision
darius
parents:
diff changeset
88 #define NUMROYALRANKS 5
cafa94d86546 Initial revision
darius
parents:
diff changeset
89 #endif
cafa94d86546 Initial revision
darius
parents:
diff changeset
90 #define GODLIKE (NUMROYALRANKS-2)
cafa94d86546 Initial revision
darius
parents:
diff changeset
91
cafa94d86546 Initial revision
darius
parents:
diff changeset
92 /* These are configuration definitions */
cafa94d86546 Initial revision
darius
parents:
diff changeset
93 /* GWIDTH was once a #define, now it's a variable in the configvals */
cafa94d86546 Initial revision
darius
parents:
diff changeset
94
cafa94d86546 Initial revision
darius
parents:
diff changeset
95 #define WARP1 20 /* warp one will move 20 spaces per update */
cafa94d86546 Initial revision
darius
parents:
diff changeset
96 #define SCALE 40 /* Window will be one pixel for 20 spaces */
cafa94d86546 Initial revision
darius
parents:
diff changeset
97 #define SHIPDAMDIST 3000 /* At this range, an exploding ship does
cafa94d86546 Initial revision
darius
parents:
diff changeset
98 * damage */
cafa94d86546 Initial revision
darius
parents:
diff changeset
99 #define DETDIST 1800 /* At this range a torp can be detonated */
cafa94d86546 Initial revision
darius
parents:
diff changeset
100 /* was 1600. 6/29/92 TC */
cafa94d86546 Initial revision
darius
parents:
diff changeset
101 /* was 1800 8/1/92 TC */
cafa94d86546 Initial revision
darius
parents:
diff changeset
102 #define NEWDETDIST 1800
cafa94d86546 Initial revision
darius
parents:
diff changeset
103
cafa94d86546 Initial revision
darius
parents:
diff changeset
104 #define PHASEDIST 6000 /* At this range a player can do damage with
cafa94d86546 Initial revision
darius
parents:
diff changeset
105 * phasers -- outdated */
cafa94d86546 Initial revision
darius
parents:
diff changeset
106 #define ENTORBDIST 900 /* At this range a player can orbit a planet */
cafa94d86546 Initial revision
darius
parents:
diff changeset
107 #define ORBDIST 800 /* A player will orbit at this radius */
cafa94d86546 Initial revision
darius
parents:
diff changeset
108 #define FORBDIST 7500 /* The radius at which fighters patrol */
cafa94d86546 Initial revision
darius
parents:
diff changeset
109 #define ORBSPEED 2 /* This is the fastest a person can go into
cafa94d86546 Initial revision
darius
parents:
diff changeset
110 * orbit */
cafa94d86546 Initial revision
darius
parents:
diff changeset
111 #define PFIREDIST 1500 /* At this range a planet will shoot at a
cafa94d86546 Initial revision
darius
parents:
diff changeset
112 * player */
cafa94d86546 Initial revision
darius
parents:
diff changeset
113
cafa94d86546 Initial revision
darius
parents:
diff changeset
114 #define MIN_AST_DAMAGE 10 /* the minimum damage caused by an asteroid */
cafa94d86546 Initial revision
darius
parents:
diff changeset
115 #define VAR_AST_DAMAGE 5 /* the max additional damage caused by an
cafa94d86546 Initial revision
darius
parents:
diff changeset
116 * asteroid per speed factor */
cafa94d86546 Initial revision
darius
parents:
diff changeset
117 #define MIN_AST_HIT 2 /* the minimum chance of hitting an asteroid */
cafa94d86546 Initial revision
darius
parents:
diff changeset
118
cafa94d86546 Initial revision
darius
parents:
diff changeset
119 #define TORP_HIT_AST 8
cafa94d86546 Initial revision
darius
parents:
diff changeset
120 #define PLASMA_HIT_AST 12 /* percent for asteroid collisions. */
cafa94d86546 Initial revision
darius
parents:
diff changeset
121 #define FIGHTER_HIT_AST 3
cafa94d86546 Initial revision
darius
parents:
diff changeset
122 #define MISSILE_HIT_AST 5
cafa94d86546 Initial revision
darius
parents:
diff changeset
123
cafa94d86546 Initial revision
darius
parents:
diff changeset
124 #define VACANT -1 /* indicates vacant port on a starbase */
cafa94d86546 Initial revision
darius
parents:
diff changeset
125 #define PDAMAGE -2 /* indicates damaged port on a starbase */
cafa94d86546 Initial revision
darius
parents:
diff changeset
126 #define DOCKDIST 600
cafa94d86546 Initial revision
darius
parents:
diff changeset
127
cafa94d86546 Initial revision
darius
parents:
diff changeset
128 #define TRACTDIST 6000 /* maximum effective tractor beam range */
cafa94d86546 Initial revision
darius
parents:
diff changeset
129
cafa94d86546 Initial revision
darius
parents:
diff changeset
130 #define TICKSPERSEC 10 /* clock ticks per second */
cafa94d86546 Initial revision
darius
parents:
diff changeset
131 #define UPDATE (1000000/TICKSPERSEC) /* Update time is 100000
cafa94d86546 Initial revision
darius
parents:
diff changeset
132 * micro-seconds */
cafa94d86546 Initial revision
darius
parents:
diff changeset
133 #define AUTOQUIT 60 /* auto logout in 60 secs */
cafa94d86546 Initial revision
darius
parents:
diff changeset
134 #define SECONDS(s) (TICKSPERSEC*s)
cafa94d86546 Initial revision
darius
parents:
diff changeset
135 #define MINUTES(s) (60*SECONDS(s))
cafa94d86546 Initial revision
darius
parents:
diff changeset
136
cafa94d86546 Initial revision
darius
parents:
diff changeset
137 /* These are memory sections */
cafa94d86546 Initial revision
darius
parents:
diff changeset
138 #define PLAYER 1
cafa94d86546 Initial revision
darius
parents:
diff changeset
139 #define MAXMESSAGE 50
cafa94d86546 Initial revision
darius
parents:
diff changeset
140 #define MAXREVIEWMESSAGE 20
cafa94d86546 Initial revision
darius
parents:
diff changeset
141
cafa94d86546 Initial revision
darius
parents:
diff changeset
142 #define rosette(x) ((((x) + 8) / 16) & 15)
cafa94d86546 Initial revision
darius
parents:
diff changeset
143 /* #define rosette(x) ((((x) + 256/VIEWS/2) / (256/VIEWS) + VIEWS) % VIEWS) */
cafa94d86546 Initial revision
darius
parents:
diff changeset
144 /* (((x + 8) / 16 + 16) % 16) */
cafa94d86546 Initial revision
darius
parents:
diff changeset
145
cafa94d86546 Initial revision
darius
parents:
diff changeset
146 /* These are the teams */
cafa94d86546 Initial revision
darius
parents:
diff changeset
147 /*
cafa94d86546 Initial revision
darius
parents:
diff changeset
148 * Note that I used bit types for these mostly for messages and war status.
cafa94d86546 Initial revision
darius
parents:
diff changeset
149 * This was probably a mistake. It meant that Ed had to add the 'remap' area
cafa94d86546 Initial revision
darius
parents:
diff changeset
150 * to map these (which are used throughout the code as the proper team
cafa94d86546 Initial revision
darius
parents:
diff changeset
151 * variable) into a nice four team deep array for his color stuff. Oh well.
cafa94d86546 Initial revision
darius
parents:
diff changeset
152 */
cafa94d86546 Initial revision
darius
parents:
diff changeset
153 #define NOBODY 0x0
cafa94d86546 Initial revision
darius
parents:
diff changeset
154 #define FED 0x1
cafa94d86546 Initial revision
darius
parents:
diff changeset
155 #define ROM 0x2
cafa94d86546 Initial revision
darius
parents:
diff changeset
156 #define KLI 0x4
cafa94d86546 Initial revision
darius
parents:
diff changeset
157 #define ORI 0x8
cafa94d86546 Initial revision
darius
parents:
diff changeset
158 #define ALLTEAM (FED|ROM|KLI|ORI)
cafa94d86546 Initial revision
darius
parents:
diff changeset
159 #define MAXTEAM (ORI) /* was ALLTEAM (overkill?) 6/22/92 TMC */
cafa94d86546 Initial revision
darius
parents:
diff changeset
160 #define NUMTEAM 4
cafa94d86546 Initial revision
darius
parents:
diff changeset
161 /*
cafa94d86546 Initial revision
darius
parents:
diff changeset
162 * * These are random configuration variables
cafa94d86546 Initial revision
darius
parents:
diff changeset
163 */
cafa94d86546 Initial revision
darius
parents:
diff changeset
164 #define VICTORY 3 /* Number of systems needed to conquer the
cafa94d86546 Initial revision
darius
parents:
diff changeset
165 * galaxy */
cafa94d86546 Initial revision
darius
parents:
diff changeset
166 #define WARNTIME 30 /* Number of updates to have a warning on the
cafa94d86546 Initial revision
darius
parents:
diff changeset
167 * screen */
cafa94d86546 Initial revision
darius
parents:
diff changeset
168 #define MESSTIME 30 /* Number of updates to have a message on the
cafa94d86546 Initial revision
darius
parents:
diff changeset
169 * screen */
cafa94d86546 Initial revision
darius
parents:
diff changeset
170
cafa94d86546 Initial revision
darius
parents:
diff changeset
171 #define BUILD_SB_TIME 30 /* Minutes to rebuild an SB */
cafa94d86546 Initial revision
darius
parents:
diff changeset
172 #define BUILD_JS_TIME 15 /* Minutes to rebuild an JS 1-24 bjg */
cafa94d86546 Initial revision
darius
parents:
diff changeset
173 #define BUILD_WA_TIME 45 /* Minutes to rebuild an WA 1-24 bjg */
cafa94d86546 Initial revision
darius
parents:
diff changeset
174
cafa94d86546 Initial revision
darius
parents:
diff changeset
175 #define TARG_PLAYER 0x1 /* Flags for gettarget */
cafa94d86546 Initial revision
darius
parents:
diff changeset
176 #define TARG_PLANET 0x2
cafa94d86546 Initial revision
darius
parents:
diff changeset
177 #define TARG_CLOAK 0x4 /* Include cloaked ships in search */
cafa94d86546 Initial revision
darius
parents:
diff changeset
178 #define TARG_SELF 0x8
cafa94d86546 Initial revision
darius
parents:
diff changeset
179
cafa94d86546 Initial revision
darius
parents:
diff changeset
180 /* Data files to make the game play across daemon restarts. */
cafa94d86546 Initial revision
darius
parents:
diff changeset
181
cafa94d86546 Initial revision
darius
parents:
diff changeset
182 #ifdef LEAGUE_SUPPORT
cafa94d86546 Initial revision
darius
parents:
diff changeset
183 #define PLAYERFILE (status2->league ? "/tmp/tourney.players":"etc/db.players")
cafa94d86546 Initial revision
darius
parents:
diff changeset
184 #else
cafa94d86546 Initial revision
darius
parents:
diff changeset
185 #define PLAYERFILE "etc/db.players"
cafa94d86546 Initial revision
darius
parents:
diff changeset
186 #endif
cafa94d86546 Initial revision
darius
parents:
diff changeset
187 #define GLOBAL "etc/db.global"
cafa94d86546 Initial revision
darius
parents:
diff changeset
188 #define PLFILE "etc/planets"
cafa94d86546 Initial revision
darius
parents:
diff changeset
189 #define MOTD "etc/motd"
cafa94d86546 Initial revision
darius
parents:
diff changeset
190 #define WCMOTD "etc/motd.wc" /* wrong client message */
cafa94d86546 Initial revision
darius
parents:
diff changeset
191 #define CLOSEDMOTD "etc/motd.closed" /* if doesn't exist, MOTD is
cafa94d86546 Initial revision
darius
parents:
diff changeset
192 * used. */
cafa94d86546 Initial revision
darius
parents:
diff changeset
193 #define PICS "etc/conf.pics"
cafa94d86546 Initial revision
darius
parents:
diff changeset
194 #define NTSERV "bin/ntserv"
cafa94d86546 Initial revision
darius
parents:
diff changeset
195 #define DAEMON "bin/daemonII"
cafa94d86546 Initial revision
darius
parents:
diff changeset
196 #define ROBOT "bin/robotII"
cafa94d86546 Initial revision
darius
parents:
diff changeset
197 #define LOGFILENAME "logs/server.log"
cafa94d86546 Initial revision
darius
parents:
diff changeset
198 #define CONQFILE "logs/conquer"
cafa94d86546 Initial revision
darius
parents:
diff changeset
199 #define SYSDEF_FILE "etc/conf.sysdef"
cafa94d86546 Initial revision
darius
parents:
diff changeset
200 #define RSA_KEY_FILE "etc/rsa.keys"
cafa94d86546 Initial revision
darius
parents:
diff changeset
201 #define GODLOGFILE "logs/god.log"
cafa94d86546 Initial revision
darius
parents:
diff changeset
202 #define CLUEPHRASEFILE "etc/cluephrases"
cafa94d86546 Initial revision
darius
parents:
diff changeset
203 #define MAILCLUECHECK "bin/mailcluecheck"
cafa94d86546 Initial revision
darius
parents:
diff changeset
204
cafa94d86546 Initial revision
darius
parents:
diff changeset
205 /*
cafa94d86546 Initial revision
darius
parents:
diff changeset
206 * If this isn't defined, the "Count: n players" messages will go into
cafa94d86546 Initial revision
darius
parents:
diff changeset
207 * logfile, as before. Otherwise, they'll go into this file:
cafa94d86546 Initial revision
darius
parents:
diff changeset
208 */
cafa94d86546 Initial revision
darius
parents:
diff changeset
209 /* #define COUNTFILENAME "logs/countfile" */
cafa94d86546 Initial revision
darius
parents:
diff changeset
210
cafa94d86546 Initial revision
darius
parents:
diff changeset
211 /* Listen stuff */
cafa94d86546 Initial revision
darius
parents:
diff changeset
212 #define METASERVER "metaserver.ecst.csuchico.edu"
cafa94d86546 Initial revision
darius
parents:
diff changeset
213 #define PORT 2592 /* port to listen on */
cafa94d86546 Initial revision
darius
parents:
diff changeset
214
cafa94d86546 Initial revision
darius
parents:
diff changeset
215 /* Other stuff that Ed added */
cafa94d86546 Initial revision
darius
parents:
diff changeset
216
cafa94d86546 Initial revision
darius
parents:
diff changeset
217 #define ABS(a) /* abs(a) */ (((a) < 0) ? -(a) : (a))
cafa94d86546 Initial revision
darius
parents:
diff changeset
218 #ifndef MAX
cafa94d86546 Initial revision
darius
parents:
diff changeset
219 #define MAX(a,b) ((a) > (b) ? (a) : (b))
cafa94d86546 Initial revision
darius
parents:
diff changeset
220 #endif
cafa94d86546 Initial revision
darius
parents:
diff changeset
221 #ifndef MIN
cafa94d86546 Initial revision
darius
parents:
diff changeset
222 #define MIN(a,b) ((a) < (b) ? (a) : (b))
cafa94d86546 Initial revision
darius
parents:
diff changeset
223 #endif
cafa94d86546 Initial revision
darius
parents:
diff changeset
224
cafa94d86546 Initial revision
darius
parents:
diff changeset
225 #define myPlasmaTorp(t) (me->p_no == (t)->pt_owner)
cafa94d86546 Initial revision
darius
parents:
diff changeset
226 #define myTorp(t) (me->p_no == (t)->t_owner)
cafa94d86546 Initial revision
darius
parents:
diff changeset
227 #define myMissile(t) (me->p_no == (t)->ms_owner)
cafa94d86546 Initial revision
darius
parents:
diff changeset
228 #define friendlyPlasmaTorp(t) ((!(me->p_team & (t)->pt_war)) || (myPlasmaTorp(t)))
cafa94d86546 Initial revision
darius
parents:
diff changeset
229 #define friendlyTorp(t) (((!(me->p_team & (t)->t_war)) && \
cafa94d86546 Initial revision
darius
parents:
diff changeset
230 (!(t->t_team & (me->p_swar | me->p_hostile)))) || \
cafa94d86546 Initial revision
darius
parents:
diff changeset
231 (myTorp(t)))
cafa94d86546 Initial revision
darius
parents:
diff changeset
232 #define friendlyMissile(t) (((!(me->p_team & (t)->ms_war)) && \
cafa94d86546 Initial revision
darius
parents:
diff changeset
233 (!(t->ms_team & (me->p_swar | me->p_hostile)))) || \
cafa94d86546 Initial revision
darius
parents:
diff changeset
234 (myMissile(t)))
cafa94d86546 Initial revision
darius
parents:
diff changeset
235 #define myPhaser(p) (&phasers[me->p_no] == (p))
cafa94d86546 Initial revision
darius
parents:
diff changeset
236 #define friendlyPhaser(p) (me->p_team == players[(p) - phasers].p_team)
cafa94d86546 Initial revision
darius
parents:
diff changeset
237 #define myPlayer(p) (me == (p))
cafa94d86546 Initial revision
darius
parents:
diff changeset
238 #define myPlanet(p) (me->p_team == (p)->pl_owner)
cafa94d86546 Initial revision
darius
parents:
diff changeset
239 #define friendlyPlayer(p) ((!(me->p_team & \
cafa94d86546 Initial revision
darius
parents:
diff changeset
240 ((p)->p_swar | (p)->p_hostile))) && \
cafa94d86546 Initial revision
darius
parents:
diff changeset
241 (!((p)->p_team & \
cafa94d86546 Initial revision
darius
parents:
diff changeset
242 (me->p_swar | me->p_hostile))))
cafa94d86546 Initial revision
darius
parents:
diff changeset
243 #define isAlive(p) ((p)->p_status == PALIVE)
cafa94d86546 Initial revision
darius
parents:
diff changeset
244 #define friendlyPlanet(p) ((p)->pl_info & me->p_team && \
cafa94d86546 Initial revision
darius
parents:
diff changeset
245 !((p)->pl_owner & (me->p_swar | me->p_hostile)))
cafa94d86546 Initial revision
darius
parents:
diff changeset
246
cafa94d86546 Initial revision
darius
parents:
diff changeset
247 #if 0
cafa94d86546 Initial revision
darius
parents:
diff changeset
248 #define torpColor(t) \
cafa94d86546 Initial revision
darius
parents:
diff changeset
249 (myTorp(t) ? myColor : shipCol[remap[players[(t)->t_owner].p_team]])
cafa94d86546 Initial revision
darius
parents:
diff changeset
250 #define plasmatorpColor(t) \
cafa94d86546 Initial revision
darius
parents:
diff changeset
251 (myPlasmaTorp(t) ? myColor : shipCol[remap[players[(t)->pt_owner].p_team]])
cafa94d86546 Initial revision
darius
parents:
diff changeset
252 #define phaserColor(p) \
cafa94d86546 Initial revision
darius
parents:
diff changeset
253 (myPhaser(p) ? myColor : shipCol[remap[players[(p) - phasers].p_team]])
cafa94d86546 Initial revision
darius
parents:
diff changeset
254 /*
cafa94d86546 Initial revision
darius
parents:
diff changeset
255 * Cloaking phase (and not the cloaking flag) is the factor in determining
cafa94d86546 Initial revision
darius
parents:
diff changeset
256 * the color of the ship. Color 0 is white (same as 'myColor' used to be).
cafa94d86546 Initial revision
darius
parents:
diff changeset
257 */
cafa94d86546 Initial revision
darius
parents:
diff changeset
258 #define playerColor(p) \
cafa94d86546 Initial revision
darius
parents:
diff changeset
259 (myPlayer(p) ? \
cafa94d86546 Initial revision
darius
parents:
diff changeset
260 (cloak_pixels[0][me->p_cloakphase]) \
cafa94d86546 Initial revision
darius
parents:
diff changeset
261 : (cloak_pixels[remap[(p)->p_team]][(p)->p_cloakphase]))
cafa94d86546 Initial revision
darius
parents:
diff changeset
262 #define planetColor(p) \
cafa94d86546 Initial revision
darius
parents:
diff changeset
263 (((p)->pl_info & me->p_team) ? shipCol[remap[(p)->pl_owner]] : unColor)
cafa94d86546 Initial revision
darius
parents:
diff changeset
264
cafa94d86546 Initial revision
darius
parents:
diff changeset
265 #define planetFont(p) \
cafa94d86546 Initial revision
darius
parents:
diff changeset
266 (myPlanet(p) ? bfont : friendlyPlanet(p) ? ifont : dfont)
cafa94d86546 Initial revision
darius
parents:
diff changeset
267 #define shipFont(p) \
cafa94d86546 Initial revision
darius
parents:
diff changeset
268 (myPlayer(p) ? bfont : friendlyPlayer(p) ? ifont : dfont)
cafa94d86546 Initial revision
darius
parents:
diff changeset
269 #endif
cafa94d86546 Initial revision
darius
parents:
diff changeset
270
cafa94d86546 Initial revision
darius
parents:
diff changeset
271 /*
cafa94d86546 Initial revision
darius
parents:
diff changeset
272 * This macro allows us to time things based upon the SIGALRM signal. Given a
cafa94d86546 Initial revision
darius
parents:
diff changeset
273 * number of 1/5 seconds, it will return the number of SIGALRMs we will
cafa94d86546 Initial revision
darius
parents:
diff changeset
274 * receive in that period.
cafa94d86546 Initial revision
darius
parents:
diff changeset
275 */
cafa94d86546 Initial revision
darius
parents:
diff changeset
276 #define efticks(x) ((x)*200000/timerDelay)
cafa94d86546 Initial revision
darius
parents:
diff changeset
277
cafa94d86546 Initial revision
darius
parents:
diff changeset
278 /*
cafa94d86546 Initial revision
darius
parents:
diff changeset
279 * UDP control stuff
cafa94d86546 Initial revision
darius
parents:
diff changeset
280 */
cafa94d86546 Initial revision
darius
parents:
diff changeset
281 #ifdef GATEWAY
cafa94d86546 Initial revision
darius
parents:
diff changeset
282 #define UDP_NUMOPTS 11
cafa94d86546 Initial revision
darius
parents:
diff changeset
283 #define UDP_GW UDP_NUMOPTS-1
cafa94d86546 Initial revision
darius
parents:
diff changeset
284 #else
cafa94d86546 Initial revision
darius
parents:
diff changeset
285 #define UDP_NUMOPTS 10
cafa94d86546 Initial revision
darius
parents:
diff changeset
286 #endif
cafa94d86546 Initial revision
darius
parents:
diff changeset
287 #define UDP_CURRENT 0
cafa94d86546 Initial revision
darius
parents:
diff changeset
288 #define UDP_STATUS 1
cafa94d86546 Initial revision
darius
parents:
diff changeset
289 #define UDP_DROPPED 2
cafa94d86546 Initial revision
darius
parents:
diff changeset
290 #define UDP_SEQUENCE 3
cafa94d86546 Initial revision
darius
parents:
diff changeset
291 #define UDP_SEND 4
cafa94d86546 Initial revision
darius
parents:
diff changeset
292 #define UDP_RECV 5
cafa94d86546 Initial revision
darius
parents:
diff changeset
293 #define UDP_DEBUG 6
cafa94d86546 Initial revision
darius
parents:
diff changeset
294 #define UDP_FORCE_RESET 7
cafa94d86546 Initial revision
darius
parents:
diff changeset
295 #define UDP_UPDATE_ALL 8
cafa94d86546 Initial revision
darius
parents:
diff changeset
296 #define UDP_DONE 9
cafa94d86546 Initial revision
darius
parents:
diff changeset
297 #define COMM_TCP 0
cafa94d86546 Initial revision
darius
parents:
diff changeset
298 #define COMM_UDP 1
cafa94d86546 Initial revision
darius
parents:
diff changeset
299 #define COMM_VERIFY 2
cafa94d86546 Initial revision
darius
parents:
diff changeset
300 #define COMM_UPDATE 3
cafa94d86546 Initial revision
darius
parents:
diff changeset
301 #define COMM_MODE 4 /* put this one last */
cafa94d86546 Initial revision
darius
parents:
diff changeset
302 #define SWITCH_TCP_OK 0
cafa94d86546 Initial revision
darius
parents:
diff changeset
303 #define SWITCH_UDP_OK 1
cafa94d86546 Initial revision
darius
parents:
diff changeset
304 #define SWITCH_DENIED 2
cafa94d86546 Initial revision
darius
parents:
diff changeset
305 #define SWITCH_VERIFY 3
cafa94d86546 Initial revision
darius
parents:
diff changeset
306 #define CONNMODE_PORT 0
cafa94d86546 Initial revision
darius
parents:
diff changeset
307 #define CONNMODE_PACKET 1
cafa94d86546 Initial revision
darius
parents:
diff changeset
308 #define STAT_CONNECTED 0
cafa94d86546 Initial revision
darius
parents:
diff changeset
309 #define STAT_SWITCH_UDP 1
cafa94d86546 Initial revision
darius
parents:
diff changeset
310 #define STAT_SWITCH_TCP 2
cafa94d86546 Initial revision
darius
parents:
diff changeset
311 #define STAT_VERIFY_UDP 3
cafa94d86546 Initial revision
darius
parents:
diff changeset
312 #define MODE_TCP 0
cafa94d86546 Initial revision
darius
parents:
diff changeset
313 #define MODE_SIMPLE 1
cafa94d86546 Initial revision
darius
parents:
diff changeset
314 #define MODE_FAT 2
cafa94d86546 Initial revision
darius
parents:
diff changeset
315 #define MODE_DOUBLE 3 /* put this one last */
cafa94d86546 Initial revision
darius
parents:
diff changeset
316
cafa94d86546 Initial revision
darius
parents:
diff changeset
317 #define UDP_RECENT_INTR 300
cafa94d86546 Initial revision
darius
parents:
diff changeset
318 #define UDP_UPDATE_WAIT 5 /* 5 second wait */
cafa94d86546 Initial revision
darius
parents:
diff changeset
319
cafa94d86546 Initial revision
darius
parents:
diff changeset
320 /* server version of UDPDIAG */
cafa94d86546 Initial revision
darius
parents:
diff changeset
321 /* (change these to "#define UDPDIAG(x) <return>" for smaller & faster code) */
cafa94d86546 Initial revision
darius
parents:
diff changeset
322 #define UDPDIAG(x) { if (configvals->udpAllowed > 1) { printf("UDP: "); printf x; }}
cafa94d86546 Initial revision
darius
parents:
diff changeset
323 #define V_UDPDIAG(x) { if (configvals->udpAllowed > 2) { printf("UDP: "); printf x; }}
cafa94d86546 Initial revision
darius
parents:
diff changeset
324
cafa94d86546 Initial revision
darius
parents:
diff changeset
325 #define FAE_RATE 8 /* The Fighter-Army exchange rate */
cafa94d86546 Initial revision
darius
parents:
diff changeset
326 #define FTORP_DAMAGE 50
cafa94d86546 Initial revision
darius
parents:
diff changeset
327 #define FTORP_SPEED 12
cafa94d86546 Initial revision
darius
parents:
diff changeset
328 #define FTORP_FUSE 40
cafa94d86546 Initial revision
darius
parents:
diff changeset
329 #define FTORP_TRACK 1
cafa94d86546 Initial revision
darius
parents:
diff changeset
330
cafa94d86546 Initial revision
darius
parents:
diff changeset
331 #define RSA_VERSION "RSA v2.0 SERVER" /* String must begin with "RSA v" */
cafa94d86546 Initial revision
darius
parents:
diff changeset
332 #define KEY_SIZE 32
cafa94d86546 Initial revision
darius
parents:
diff changeset
333 #define RESERVED_SIZE 16
cafa94d86546 Initial revision
darius
parents:
diff changeset
334 #define MSG_LEN 80
cafa94d86546 Initial revision
darius
parents:
diff changeset
335 #define NAME_LEN 16
cafa94d86546 Initial revision
darius
parents:
diff changeset
336 #define KEYMAP_LEN 96
cafa94d86546 Initial revision
darius
parents:
diff changeset
337
cafa94d86546 Initial revision
darius
parents:
diff changeset
338 struct player;
cafa94d86546 Initial revision
darius
parents:
diff changeset
339
cafa94d86546 Initial revision
darius
parents:
diff changeset
340 void warning( /* char * */ );
cafa94d86546 Initial revision
darius
parents:
diff changeset
341 int in_warp( /**/ );
cafa94d86546 Initial revision
darius
parents:
diff changeset
342 void get_ship_for_player( /* struct player *me, int s_type */ );
cafa94d86546 Initial revision
darius
parents:
diff changeset
343 void switch_special_weapon( /**/ );
cafa94d86546 Initial revision
darius
parents:
diff changeset
344 void declare_war( /* int mask */ );
cafa94d86546 Initial revision
darius
parents:
diff changeset
345 char *twoletters( /* struct player * */ );
cafa94d86546 Initial revision
darius
parents:
diff changeset
346 void updateClient();
cafa94d86546 Initial revision
darius
parents:
diff changeset
347
cafa94d86546 Initial revision
darius
parents:
diff changeset
348
cafa94d86546 Initial revision
darius
parents:
diff changeset
349 /* random number stuff */
cafa94d86546 Initial revision
darius
parents:
diff changeset
350 #include <stdlib.h>
cafa94d86546 Initial revision
darius
parents:
diff changeset
351
cafa94d86546 Initial revision
darius
parents:
diff changeset
352 #ifdef HAVE_RAND48
cafa94d86546 Initial revision
darius
parents:
diff changeset
353
cafa94d86546 Initial revision
darius
parents:
diff changeset
354 #define MAXRAND 2147483648
cafa94d86546 Initial revision
darius
parents:
diff changeset
355 extern long lrand48();
cafa94d86546 Initial revision
darius
parents:
diff changeset
356 extern void srand48();
cafa94d86546 Initial revision
darius
parents:
diff changeset
357 extern double drand48();
cafa94d86546 Initial revision
darius
parents:
diff changeset
358
cafa94d86546 Initial revision
darius
parents:
diff changeset
359 #else /* HAVE_RAND48 */
cafa94d86546 Initial revision
darius
parents:
diff changeset
360
cafa94d86546 Initial revision
darius
parents:
diff changeset
361 #ifdef HAVE_RANDOM
cafa94d86546 Initial revision
darius
parents:
diff changeset
362
cafa94d86546 Initial revision
darius
parents:
diff changeset
363 #define MAXRAND 2147483648
cafa94d86546 Initial revision
darius
parents:
diff changeset
364 extern long random();
cafa94d86546 Initial revision
darius
parents:
diff changeset
365 extern void srandom();
cafa94d86546 Initial revision
darius
parents:
diff changeset
366
cafa94d86546 Initial revision
darius
parents:
diff changeset
367 #else /* HAVE_RANDOM */
cafa94d86546 Initial revision
darius
parents:
diff changeset
368
cafa94d86546 Initial revision
darius
parents:
diff changeset
369 #define MAXRAND (RAND_MAX+1)
cafa94d86546 Initial revision
darius
parents:
diff changeset
370 #define random rand
cafa94d86546 Initial revision
darius
parents:
diff changeset
371 #define srandom srand
cafa94d86546 Initial revision
darius
parents:
diff changeset
372 extern int rand();
cafa94d86546 Initial revision
darius
parents:
diff changeset
373 #ifdef sparc
cafa94d86546 Initial revision
darius
parents:
diff changeset
374 extern srand();
cafa94d86546 Initial revision
darius
parents:
diff changeset
375 #else
cafa94d86546 Initial revision
darius
parents:
diff changeset
376 extern void srand();
cafa94d86546 Initial revision
darius
parents:
diff changeset
377 #endif
cafa94d86546 Initial revision
darius
parents:
diff changeset
378
cafa94d86546 Initial revision
darius
parents:
diff changeset
379 #endif /* HAVE_RANDOM */
cafa94d86546 Initial revision
darius
parents:
diff changeset
380
cafa94d86546 Initial revision
darius
parents:
diff changeset
381 #define lrand48 random
cafa94d86546 Initial revision
darius
parents:
diff changeset
382 #define srand48(s) srandom((int)s)
cafa94d86546 Initial revision
darius
parents:
diff changeset
383 #define drand48() ((double)random() / (double)MAXRAND)
cafa94d86546 Initial revision
darius
parents:
diff changeset
384
cafa94d86546 Initial revision
darius
parents:
diff changeset
385 #endif /* HAVE_RAND48 */
cafa94d86546 Initial revision
darius
parents:
diff changeset
386
cafa94d86546 Initial revision
darius
parents:
diff changeset
387
cafa94d86546 Initial revision
darius
parents:
diff changeset
388 #endif /* defs_h_ */