annotate src/defs.h @ 19:de685799a432

Made torps wobbly when going through nebulous terrain. Only happens if nebula_effect contains photon.
author darius
date Wed, 24 Dec 1997 12:40:04 +0000
parents b7fe2e0e4b86
children
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 */
14
b7fe2e0e4b86 Added #defines which hold the chance of nebulous terrain affecting
darius
parents: 3
diff changeset
99 #define DETDIST 1800 /* At this range a torp can be detonated
b7fe2e0e4b86 Added #defines which hold the chance of nebulous terrain affecting
darius
parents: 3
diff changeset
100 was 1600. 6/29/92 TC
b7fe2e0e4b86 Added #defines which hold the chance of nebulous terrain affecting
darius
parents: 3
diff changeset
101 was 1800 8/1/92 TC */
3
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
14
b7fe2e0e4b86 Added #defines which hold the chance of nebulous terrain affecting
darius
parents: 3
diff changeset
105 * phasers -- outdated */
3
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
14
b7fe2e0e4b86 Added #defines which hold the chance of nebulous terrain affecting
darius
parents: 3
diff changeset
110 * orbit */
3
cafa94d86546 Initial revision
darius
parents:
diff changeset
111 #define PFIREDIST 1500 /* At this range a planet will shoot at a
14
b7fe2e0e4b86 Added #defines which hold the chance of nebulous terrain affecting
darius
parents: 3
diff changeset
112 * player */
3
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
14
b7fe2e0e4b86 Added #defines which hold the chance of nebulous terrain affecting
darius
parents: 3
diff changeset
116 * asteroid per speed factor */
3
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
14
b7fe2e0e4b86 Added #defines which hold the chance of nebulous terrain affecting
darius
parents: 3
diff changeset
119 #define TORP_NEB_EFF 40 /* percent for nebulous terrain to screw up tracking */
b7fe2e0e4b86 Added #defines which hold the chance of nebulous terrain affecting
darius
parents: 3
diff changeset
120 #define PLASMA_NEB_EFF 30
b7fe2e0e4b86 Added #defines which hold the chance of nebulous terrain affecting
darius
parents: 3
diff changeset
121 #define FIGHTER_NEB_EFF 20
b7fe2e0e4b86 Added #defines which hold the chance of nebulous terrain affecting
darius
parents: 3
diff changeset
122 #define MISSILE_NEB_EFF 30
b7fe2e0e4b86 Added #defines which hold the chance of nebulous terrain affecting
darius
parents: 3
diff changeset
123
3
cafa94d86546 Initial revision
darius
parents:
diff changeset
124 #define TORP_HIT_AST 8
cafa94d86546 Initial revision
darius
parents:
diff changeset
125 #define PLASMA_HIT_AST 12 /* percent for asteroid collisions. */
cafa94d86546 Initial revision
darius
parents:
diff changeset
126 #define FIGHTER_HIT_AST 3
cafa94d86546 Initial revision
darius
parents:
diff changeset
127 #define MISSILE_HIT_AST 5
cafa94d86546 Initial revision
darius
parents:
diff changeset
128
cafa94d86546 Initial revision
darius
parents:
diff changeset
129 #define VACANT -1 /* indicates vacant port on a starbase */
cafa94d86546 Initial revision
darius
parents:
diff changeset
130 #define PDAMAGE -2 /* indicates damaged port on a starbase */
cafa94d86546 Initial revision
darius
parents:
diff changeset
131 #define DOCKDIST 600
cafa94d86546 Initial revision
darius
parents:
diff changeset
132
cafa94d86546 Initial revision
darius
parents:
diff changeset
133 #define TRACTDIST 6000 /* maximum effective tractor beam range */
cafa94d86546 Initial revision
darius
parents:
diff changeset
134
cafa94d86546 Initial revision
darius
parents:
diff changeset
135 #define TICKSPERSEC 10 /* clock ticks per second */
cafa94d86546 Initial revision
darius
parents:
diff changeset
136 #define UPDATE (1000000/TICKSPERSEC) /* Update time is 100000
cafa94d86546 Initial revision
darius
parents:
diff changeset
137 * micro-seconds */
cafa94d86546 Initial revision
darius
parents:
diff changeset
138 #define AUTOQUIT 60 /* auto logout in 60 secs */
cafa94d86546 Initial revision
darius
parents:
diff changeset
139 #define SECONDS(s) (TICKSPERSEC*s)
cafa94d86546 Initial revision
darius
parents:
diff changeset
140 #define MINUTES(s) (60*SECONDS(s))
cafa94d86546 Initial revision
darius
parents:
diff changeset
141
cafa94d86546 Initial revision
darius
parents:
diff changeset
142 /* These are memory sections */
cafa94d86546 Initial revision
darius
parents:
diff changeset
143 #define PLAYER 1
cafa94d86546 Initial revision
darius
parents:
diff changeset
144 #define MAXMESSAGE 50
cafa94d86546 Initial revision
darius
parents:
diff changeset
145 #define MAXREVIEWMESSAGE 20
cafa94d86546 Initial revision
darius
parents:
diff changeset
146
cafa94d86546 Initial revision
darius
parents:
diff changeset
147 #define rosette(x) ((((x) + 8) / 16) & 15)
cafa94d86546 Initial revision
darius
parents:
diff changeset
148 /* #define rosette(x) ((((x) + 256/VIEWS/2) / (256/VIEWS) + VIEWS) % VIEWS) */
cafa94d86546 Initial revision
darius
parents:
diff changeset
149 /* (((x + 8) / 16 + 16) % 16) */
cafa94d86546 Initial revision
darius
parents:
diff changeset
150
cafa94d86546 Initial revision
darius
parents:
diff changeset
151 /* These are the teams */
cafa94d86546 Initial revision
darius
parents:
diff changeset
152 /*
cafa94d86546 Initial revision
darius
parents:
diff changeset
153 * Note that I used bit types for these mostly for messages and war status.
cafa94d86546 Initial revision
darius
parents:
diff changeset
154 * This was probably a mistake. It meant that Ed had to add the 'remap' area
cafa94d86546 Initial revision
darius
parents:
diff changeset
155 * to map these (which are used throughout the code as the proper team
cafa94d86546 Initial revision
darius
parents:
diff changeset
156 * variable) into a nice four team deep array for his color stuff. Oh well.
cafa94d86546 Initial revision
darius
parents:
diff changeset
157 */
cafa94d86546 Initial revision
darius
parents:
diff changeset
158 #define NOBODY 0x0
cafa94d86546 Initial revision
darius
parents:
diff changeset
159 #define FED 0x1
cafa94d86546 Initial revision
darius
parents:
diff changeset
160 #define ROM 0x2
cafa94d86546 Initial revision
darius
parents:
diff changeset
161 #define KLI 0x4
cafa94d86546 Initial revision
darius
parents:
diff changeset
162 #define ORI 0x8
cafa94d86546 Initial revision
darius
parents:
diff changeset
163 #define ALLTEAM (FED|ROM|KLI|ORI)
cafa94d86546 Initial revision
darius
parents:
diff changeset
164 #define MAXTEAM (ORI) /* was ALLTEAM (overkill?) 6/22/92 TMC */
cafa94d86546 Initial revision
darius
parents:
diff changeset
165 #define NUMTEAM 4
cafa94d86546 Initial revision
darius
parents:
diff changeset
166 /*
cafa94d86546 Initial revision
darius
parents:
diff changeset
167 * * These are random configuration variables
cafa94d86546 Initial revision
darius
parents:
diff changeset
168 */
cafa94d86546 Initial revision
darius
parents:
diff changeset
169 #define VICTORY 3 /* Number of systems needed to conquer the
cafa94d86546 Initial revision
darius
parents:
diff changeset
170 * galaxy */
cafa94d86546 Initial revision
darius
parents:
diff changeset
171 #define WARNTIME 30 /* Number of updates to have a warning on the
cafa94d86546 Initial revision
darius
parents:
diff changeset
172 * screen */
cafa94d86546 Initial revision
darius
parents:
diff changeset
173 #define MESSTIME 30 /* Number of updates to have a message on the
cafa94d86546 Initial revision
darius
parents:
diff changeset
174 * screen */
cafa94d86546 Initial revision
darius
parents:
diff changeset
175
cafa94d86546 Initial revision
darius
parents:
diff changeset
176 #define BUILD_SB_TIME 30 /* Minutes to rebuild an SB */
cafa94d86546 Initial revision
darius
parents:
diff changeset
177 #define BUILD_JS_TIME 15 /* Minutes to rebuild an JS 1-24 bjg */
cafa94d86546 Initial revision
darius
parents:
diff changeset
178 #define BUILD_WA_TIME 45 /* Minutes to rebuild an WA 1-24 bjg */
cafa94d86546 Initial revision
darius
parents:
diff changeset
179
cafa94d86546 Initial revision
darius
parents:
diff changeset
180 #define TARG_PLAYER 0x1 /* Flags for gettarget */
cafa94d86546 Initial revision
darius
parents:
diff changeset
181 #define TARG_PLANET 0x2
cafa94d86546 Initial revision
darius
parents:
diff changeset
182 #define TARG_CLOAK 0x4 /* Include cloaked ships in search */
cafa94d86546 Initial revision
darius
parents:
diff changeset
183 #define TARG_SELF 0x8
cafa94d86546 Initial revision
darius
parents:
diff changeset
184
cafa94d86546 Initial revision
darius
parents:
diff changeset
185 /* Data files to make the game play across daemon restarts. */
cafa94d86546 Initial revision
darius
parents:
diff changeset
186
cafa94d86546 Initial revision
darius
parents:
diff changeset
187 #ifdef LEAGUE_SUPPORT
cafa94d86546 Initial revision
darius
parents:
diff changeset
188 #define PLAYERFILE (status2->league ? "/tmp/tourney.players":"etc/db.players")
cafa94d86546 Initial revision
darius
parents:
diff changeset
189 #else
cafa94d86546 Initial revision
darius
parents:
diff changeset
190 #define PLAYERFILE "etc/db.players"
cafa94d86546 Initial revision
darius
parents:
diff changeset
191 #endif
cafa94d86546 Initial revision
darius
parents:
diff changeset
192 #define GLOBAL "etc/db.global"
cafa94d86546 Initial revision
darius
parents:
diff changeset
193 #define PLFILE "etc/planets"
cafa94d86546 Initial revision
darius
parents:
diff changeset
194 #define MOTD "etc/motd"
cafa94d86546 Initial revision
darius
parents:
diff changeset
195 #define WCMOTD "etc/motd.wc" /* wrong client message */
cafa94d86546 Initial revision
darius
parents:
diff changeset
196 #define CLOSEDMOTD "etc/motd.closed" /* if doesn't exist, MOTD is
cafa94d86546 Initial revision
darius
parents:
diff changeset
197 * used. */
cafa94d86546 Initial revision
darius
parents:
diff changeset
198 #define PICS "etc/conf.pics"
cafa94d86546 Initial revision
darius
parents:
diff changeset
199 #define NTSERV "bin/ntserv"
cafa94d86546 Initial revision
darius
parents:
diff changeset
200 #define DAEMON "bin/daemonII"
cafa94d86546 Initial revision
darius
parents:
diff changeset
201 #define ROBOT "bin/robotII"
cafa94d86546 Initial revision
darius
parents:
diff changeset
202 #define LOGFILENAME "logs/server.log"
cafa94d86546 Initial revision
darius
parents:
diff changeset
203 #define CONQFILE "logs/conquer"
cafa94d86546 Initial revision
darius
parents:
diff changeset
204 #define SYSDEF_FILE "etc/conf.sysdef"
cafa94d86546 Initial revision
darius
parents:
diff changeset
205 #define RSA_KEY_FILE "etc/rsa.keys"
cafa94d86546 Initial revision
darius
parents:
diff changeset
206 #define GODLOGFILE "logs/god.log"
cafa94d86546 Initial revision
darius
parents:
diff changeset
207 #define CLUEPHRASEFILE "etc/cluephrases"
cafa94d86546 Initial revision
darius
parents:
diff changeset
208 #define MAILCLUECHECK "bin/mailcluecheck"
cafa94d86546 Initial revision
darius
parents:
diff changeset
209
cafa94d86546 Initial revision
darius
parents:
diff changeset
210 /*
cafa94d86546 Initial revision
darius
parents:
diff changeset
211 * If this isn't defined, the "Count: n players" messages will go into
cafa94d86546 Initial revision
darius
parents:
diff changeset
212 * logfile, as before. Otherwise, they'll go into this file:
cafa94d86546 Initial revision
darius
parents:
diff changeset
213 */
cafa94d86546 Initial revision
darius
parents:
diff changeset
214 /* #define COUNTFILENAME "logs/countfile" */
cafa94d86546 Initial revision
darius
parents:
diff changeset
215
cafa94d86546 Initial revision
darius
parents:
diff changeset
216 /* Listen stuff */
cafa94d86546 Initial revision
darius
parents:
diff changeset
217 #define METASERVER "metaserver.ecst.csuchico.edu"
cafa94d86546 Initial revision
darius
parents:
diff changeset
218 #define PORT 2592 /* port to listen on */
cafa94d86546 Initial revision
darius
parents:
diff changeset
219
cafa94d86546 Initial revision
darius
parents:
diff changeset
220 /* Other stuff that Ed added */
cafa94d86546 Initial revision
darius
parents:
diff changeset
221
cafa94d86546 Initial revision
darius
parents:
diff changeset
222 #define ABS(a) /* abs(a) */ (((a) < 0) ? -(a) : (a))
cafa94d86546 Initial revision
darius
parents:
diff changeset
223 #ifndef MAX
cafa94d86546 Initial revision
darius
parents:
diff changeset
224 #define MAX(a,b) ((a) > (b) ? (a) : (b))
cafa94d86546 Initial revision
darius
parents:
diff changeset
225 #endif
cafa94d86546 Initial revision
darius
parents:
diff changeset
226 #ifndef MIN
cafa94d86546 Initial revision
darius
parents:
diff changeset
227 #define MIN(a,b) ((a) < (b) ? (a) : (b))
cafa94d86546 Initial revision
darius
parents:
diff changeset
228 #endif
cafa94d86546 Initial revision
darius
parents:
diff changeset
229
cafa94d86546 Initial revision
darius
parents:
diff changeset
230 #define myPlasmaTorp(t) (me->p_no == (t)->pt_owner)
cafa94d86546 Initial revision
darius
parents:
diff changeset
231 #define myTorp(t) (me->p_no == (t)->t_owner)
cafa94d86546 Initial revision
darius
parents:
diff changeset
232 #define myMissile(t) (me->p_no == (t)->ms_owner)
cafa94d86546 Initial revision
darius
parents:
diff changeset
233 #define friendlyPlasmaTorp(t) ((!(me->p_team & (t)->pt_war)) || (myPlasmaTorp(t)))
cafa94d86546 Initial revision
darius
parents:
diff changeset
234 #define friendlyTorp(t) (((!(me->p_team & (t)->t_war)) && \
cafa94d86546 Initial revision
darius
parents:
diff changeset
235 (!(t->t_team & (me->p_swar | me->p_hostile)))) || \
cafa94d86546 Initial revision
darius
parents:
diff changeset
236 (myTorp(t)))
cafa94d86546 Initial revision
darius
parents:
diff changeset
237 #define friendlyMissile(t) (((!(me->p_team & (t)->ms_war)) && \
cafa94d86546 Initial revision
darius
parents:
diff changeset
238 (!(t->ms_team & (me->p_swar | me->p_hostile)))) || \
cafa94d86546 Initial revision
darius
parents:
diff changeset
239 (myMissile(t)))
cafa94d86546 Initial revision
darius
parents:
diff changeset
240 #define myPhaser(p) (&phasers[me->p_no] == (p))
cafa94d86546 Initial revision
darius
parents:
diff changeset
241 #define friendlyPhaser(p) (me->p_team == players[(p) - phasers].p_team)
cafa94d86546 Initial revision
darius
parents:
diff changeset
242 #define myPlayer(p) (me == (p))
cafa94d86546 Initial revision
darius
parents:
diff changeset
243 #define myPlanet(p) (me->p_team == (p)->pl_owner)
cafa94d86546 Initial revision
darius
parents:
diff changeset
244 #define friendlyPlayer(p) ((!(me->p_team & \
cafa94d86546 Initial revision
darius
parents:
diff changeset
245 ((p)->p_swar | (p)->p_hostile))) && \
cafa94d86546 Initial revision
darius
parents:
diff changeset
246 (!((p)->p_team & \
cafa94d86546 Initial revision
darius
parents:
diff changeset
247 (me->p_swar | me->p_hostile))))
cafa94d86546 Initial revision
darius
parents:
diff changeset
248 #define isAlive(p) ((p)->p_status == PALIVE)
cafa94d86546 Initial revision
darius
parents:
diff changeset
249 #define friendlyPlanet(p) ((p)->pl_info & me->p_team && \
cafa94d86546 Initial revision
darius
parents:
diff changeset
250 !((p)->pl_owner & (me->p_swar | me->p_hostile)))
cafa94d86546 Initial revision
darius
parents:
diff changeset
251
cafa94d86546 Initial revision
darius
parents:
diff changeset
252 #if 0
cafa94d86546 Initial revision
darius
parents:
diff changeset
253 #define torpColor(t) \
cafa94d86546 Initial revision
darius
parents:
diff changeset
254 (myTorp(t) ? myColor : shipCol[remap[players[(t)->t_owner].p_team]])
cafa94d86546 Initial revision
darius
parents:
diff changeset
255 #define plasmatorpColor(t) \
cafa94d86546 Initial revision
darius
parents:
diff changeset
256 (myPlasmaTorp(t) ? myColor : shipCol[remap[players[(t)->pt_owner].p_team]])
cafa94d86546 Initial revision
darius
parents:
diff changeset
257 #define phaserColor(p) \
cafa94d86546 Initial revision
darius
parents:
diff changeset
258 (myPhaser(p) ? myColor : shipCol[remap[players[(p) - phasers].p_team]])
cafa94d86546 Initial revision
darius
parents:
diff changeset
259 /*
cafa94d86546 Initial revision
darius
parents:
diff changeset
260 * Cloaking phase (and not the cloaking flag) is the factor in determining
cafa94d86546 Initial revision
darius
parents:
diff changeset
261 * the color of the ship. Color 0 is white (same as 'myColor' used to be).
cafa94d86546 Initial revision
darius
parents:
diff changeset
262 */
cafa94d86546 Initial revision
darius
parents:
diff changeset
263 #define playerColor(p) \
cafa94d86546 Initial revision
darius
parents:
diff changeset
264 (myPlayer(p) ? \
cafa94d86546 Initial revision
darius
parents:
diff changeset
265 (cloak_pixels[0][me->p_cloakphase]) \
cafa94d86546 Initial revision
darius
parents:
diff changeset
266 : (cloak_pixels[remap[(p)->p_team]][(p)->p_cloakphase]))
cafa94d86546 Initial revision
darius
parents:
diff changeset
267 #define planetColor(p) \
cafa94d86546 Initial revision
darius
parents:
diff changeset
268 (((p)->pl_info & me->p_team) ? shipCol[remap[(p)->pl_owner]] : unColor)
cafa94d86546 Initial revision
darius
parents:
diff changeset
269
cafa94d86546 Initial revision
darius
parents:
diff changeset
270 #define planetFont(p) \
cafa94d86546 Initial revision
darius
parents:
diff changeset
271 (myPlanet(p) ? bfont : friendlyPlanet(p) ? ifont : dfont)
cafa94d86546 Initial revision
darius
parents:
diff changeset
272 #define shipFont(p) \
cafa94d86546 Initial revision
darius
parents:
diff changeset
273 (myPlayer(p) ? bfont : friendlyPlayer(p) ? ifont : dfont)
cafa94d86546 Initial revision
darius
parents:
diff changeset
274 #endif
cafa94d86546 Initial revision
darius
parents:
diff changeset
275
cafa94d86546 Initial revision
darius
parents:
diff changeset
276 /*
cafa94d86546 Initial revision
darius
parents:
diff changeset
277 * This macro allows us to time things based upon the SIGALRM signal. Given a
cafa94d86546 Initial revision
darius
parents:
diff changeset
278 * number of 1/5 seconds, it will return the number of SIGALRMs we will
cafa94d86546 Initial revision
darius
parents:
diff changeset
279 * receive in that period.
cafa94d86546 Initial revision
darius
parents:
diff changeset
280 */
cafa94d86546 Initial revision
darius
parents:
diff changeset
281 #define efticks(x) ((x)*200000/timerDelay)
cafa94d86546 Initial revision
darius
parents:
diff changeset
282
cafa94d86546 Initial revision
darius
parents:
diff changeset
283 /*
cafa94d86546 Initial revision
darius
parents:
diff changeset
284 * UDP control stuff
cafa94d86546 Initial revision
darius
parents:
diff changeset
285 */
cafa94d86546 Initial revision
darius
parents:
diff changeset
286 #ifdef GATEWAY
cafa94d86546 Initial revision
darius
parents:
diff changeset
287 #define UDP_NUMOPTS 11
cafa94d86546 Initial revision
darius
parents:
diff changeset
288 #define UDP_GW UDP_NUMOPTS-1
cafa94d86546 Initial revision
darius
parents:
diff changeset
289 #else
cafa94d86546 Initial revision
darius
parents:
diff changeset
290 #define UDP_NUMOPTS 10
cafa94d86546 Initial revision
darius
parents:
diff changeset
291 #endif
cafa94d86546 Initial revision
darius
parents:
diff changeset
292 #define UDP_CURRENT 0
cafa94d86546 Initial revision
darius
parents:
diff changeset
293 #define UDP_STATUS 1
cafa94d86546 Initial revision
darius
parents:
diff changeset
294 #define UDP_DROPPED 2
cafa94d86546 Initial revision
darius
parents:
diff changeset
295 #define UDP_SEQUENCE 3
cafa94d86546 Initial revision
darius
parents:
diff changeset
296 #define UDP_SEND 4
cafa94d86546 Initial revision
darius
parents:
diff changeset
297 #define UDP_RECV 5
cafa94d86546 Initial revision
darius
parents:
diff changeset
298 #define UDP_DEBUG 6
cafa94d86546 Initial revision
darius
parents:
diff changeset
299 #define UDP_FORCE_RESET 7
cafa94d86546 Initial revision
darius
parents:
diff changeset
300 #define UDP_UPDATE_ALL 8
cafa94d86546 Initial revision
darius
parents:
diff changeset
301 #define UDP_DONE 9
cafa94d86546 Initial revision
darius
parents:
diff changeset
302 #define COMM_TCP 0
cafa94d86546 Initial revision
darius
parents:
diff changeset
303 #define COMM_UDP 1
cafa94d86546 Initial revision
darius
parents:
diff changeset
304 #define COMM_VERIFY 2
cafa94d86546 Initial revision
darius
parents:
diff changeset
305 #define COMM_UPDATE 3
cafa94d86546 Initial revision
darius
parents:
diff changeset
306 #define COMM_MODE 4 /* put this one last */
cafa94d86546 Initial revision
darius
parents:
diff changeset
307 #define SWITCH_TCP_OK 0
cafa94d86546 Initial revision
darius
parents:
diff changeset
308 #define SWITCH_UDP_OK 1
cafa94d86546 Initial revision
darius
parents:
diff changeset
309 #define SWITCH_DENIED 2
cafa94d86546 Initial revision
darius
parents:
diff changeset
310 #define SWITCH_VERIFY 3
cafa94d86546 Initial revision
darius
parents:
diff changeset
311 #define CONNMODE_PORT 0
cafa94d86546 Initial revision
darius
parents:
diff changeset
312 #define CONNMODE_PACKET 1
cafa94d86546 Initial revision
darius
parents:
diff changeset
313 #define STAT_CONNECTED 0
cafa94d86546 Initial revision
darius
parents:
diff changeset
314 #define STAT_SWITCH_UDP 1
cafa94d86546 Initial revision
darius
parents:
diff changeset
315 #define STAT_SWITCH_TCP 2
cafa94d86546 Initial revision
darius
parents:
diff changeset
316 #define STAT_VERIFY_UDP 3
cafa94d86546 Initial revision
darius
parents:
diff changeset
317 #define MODE_TCP 0
cafa94d86546 Initial revision
darius
parents:
diff changeset
318 #define MODE_SIMPLE 1
cafa94d86546 Initial revision
darius
parents:
diff changeset
319 #define MODE_FAT 2
cafa94d86546 Initial revision
darius
parents:
diff changeset
320 #define MODE_DOUBLE 3 /* put this one last */
cafa94d86546 Initial revision
darius
parents:
diff changeset
321
cafa94d86546 Initial revision
darius
parents:
diff changeset
322 #define UDP_RECENT_INTR 300
cafa94d86546 Initial revision
darius
parents:
diff changeset
323 #define UDP_UPDATE_WAIT 5 /* 5 second wait */
cafa94d86546 Initial revision
darius
parents:
diff changeset
324
cafa94d86546 Initial revision
darius
parents:
diff changeset
325 /* server version of UDPDIAG */
cafa94d86546 Initial revision
darius
parents:
diff changeset
326 /* (change these to "#define UDPDIAG(x) <return>" for smaller & faster code) */
cafa94d86546 Initial revision
darius
parents:
diff changeset
327 #define UDPDIAG(x) { if (configvals->udpAllowed > 1) { printf("UDP: "); printf x; }}
cafa94d86546 Initial revision
darius
parents:
diff changeset
328 #define V_UDPDIAG(x) { if (configvals->udpAllowed > 2) { printf("UDP: "); printf x; }}
cafa94d86546 Initial revision
darius
parents:
diff changeset
329
cafa94d86546 Initial revision
darius
parents:
diff changeset
330 #define FAE_RATE 8 /* The Fighter-Army exchange rate */
cafa94d86546 Initial revision
darius
parents:
diff changeset
331 #define FTORP_DAMAGE 50
cafa94d86546 Initial revision
darius
parents:
diff changeset
332 #define FTORP_SPEED 12
cafa94d86546 Initial revision
darius
parents:
diff changeset
333 #define FTORP_FUSE 40
cafa94d86546 Initial revision
darius
parents:
diff changeset
334 #define FTORP_TRACK 1
cafa94d86546 Initial revision
darius
parents:
diff changeset
335
cafa94d86546 Initial revision
darius
parents:
diff changeset
336 #define RSA_VERSION "RSA v2.0 SERVER" /* String must begin with "RSA v" */
cafa94d86546 Initial revision
darius
parents:
diff changeset
337 #define KEY_SIZE 32
cafa94d86546 Initial revision
darius
parents:
diff changeset
338 #define RESERVED_SIZE 16
cafa94d86546 Initial revision
darius
parents:
diff changeset
339 #define MSG_LEN 80
cafa94d86546 Initial revision
darius
parents:
diff changeset
340 #define NAME_LEN 16
cafa94d86546 Initial revision
darius
parents:
diff changeset
341 #define KEYMAP_LEN 96
cafa94d86546 Initial revision
darius
parents:
diff changeset
342
cafa94d86546 Initial revision
darius
parents:
diff changeset
343 struct player;
cafa94d86546 Initial revision
darius
parents:
diff changeset
344
cafa94d86546 Initial revision
darius
parents:
diff changeset
345 void warning( /* char * */ );
cafa94d86546 Initial revision
darius
parents:
diff changeset
346 int in_warp( /**/ );
cafa94d86546 Initial revision
darius
parents:
diff changeset
347 void get_ship_for_player( /* struct player *me, int s_type */ );
cafa94d86546 Initial revision
darius
parents:
diff changeset
348 void switch_special_weapon( /**/ );
cafa94d86546 Initial revision
darius
parents:
diff changeset
349 void declare_war( /* int mask */ );
cafa94d86546 Initial revision
darius
parents:
diff changeset
350 char *twoletters( /* struct player * */ );
cafa94d86546 Initial revision
darius
parents:
diff changeset
351 void updateClient();
cafa94d86546 Initial revision
darius
parents:
diff changeset
352
cafa94d86546 Initial revision
darius
parents:
diff changeset
353
cafa94d86546 Initial revision
darius
parents:
diff changeset
354 /* random number stuff */
cafa94d86546 Initial revision
darius
parents:
diff changeset
355 #include <stdlib.h>
cafa94d86546 Initial revision
darius
parents:
diff changeset
356
cafa94d86546 Initial revision
darius
parents:
diff changeset
357 #ifdef HAVE_RAND48
cafa94d86546 Initial revision
darius
parents:
diff changeset
358
cafa94d86546 Initial revision
darius
parents:
diff changeset
359 #define MAXRAND 2147483648
cafa94d86546 Initial revision
darius
parents:
diff changeset
360 extern long lrand48();
cafa94d86546 Initial revision
darius
parents:
diff changeset
361 extern void srand48();
cafa94d86546 Initial revision
darius
parents:
diff changeset
362 extern double drand48();
cafa94d86546 Initial revision
darius
parents:
diff changeset
363
cafa94d86546 Initial revision
darius
parents:
diff changeset
364 #else /* HAVE_RAND48 */
cafa94d86546 Initial revision
darius
parents:
diff changeset
365
cafa94d86546 Initial revision
darius
parents:
diff changeset
366 #ifdef HAVE_RANDOM
cafa94d86546 Initial revision
darius
parents:
diff changeset
367
cafa94d86546 Initial revision
darius
parents:
diff changeset
368 #define MAXRAND 2147483648
cafa94d86546 Initial revision
darius
parents:
diff changeset
369 extern long random();
cafa94d86546 Initial revision
darius
parents:
diff changeset
370 extern void srandom();
cafa94d86546 Initial revision
darius
parents:
diff changeset
371
cafa94d86546 Initial revision
darius
parents:
diff changeset
372 #else /* HAVE_RANDOM */
cafa94d86546 Initial revision
darius
parents:
diff changeset
373
cafa94d86546 Initial revision
darius
parents:
diff changeset
374 #define MAXRAND (RAND_MAX+1)
cafa94d86546 Initial revision
darius
parents:
diff changeset
375 #define random rand
cafa94d86546 Initial revision
darius
parents:
diff changeset
376 #define srandom srand
cafa94d86546 Initial revision
darius
parents:
diff changeset
377 extern int rand();
cafa94d86546 Initial revision
darius
parents:
diff changeset
378 #ifdef sparc
cafa94d86546 Initial revision
darius
parents:
diff changeset
379 extern srand();
cafa94d86546 Initial revision
darius
parents:
diff changeset
380 #else
cafa94d86546 Initial revision
darius
parents:
diff changeset
381 extern void srand();
cafa94d86546 Initial revision
darius
parents:
diff changeset
382 #endif
cafa94d86546 Initial revision
darius
parents:
diff changeset
383
cafa94d86546 Initial revision
darius
parents:
diff changeset
384 #endif /* HAVE_RANDOM */
cafa94d86546 Initial revision
darius
parents:
diff changeset
385
cafa94d86546 Initial revision
darius
parents:
diff changeset
386 #define lrand48 random
cafa94d86546 Initial revision
darius
parents:
diff changeset
387 #define srand48(s) srandom((int)s)
cafa94d86546 Initial revision
darius
parents:
diff changeset
388 #define drand48() ((double)random() / (double)MAXRAND)
cafa94d86546 Initial revision
darius
parents:
diff changeset
389
cafa94d86546 Initial revision
darius
parents:
diff changeset
390 #endif /* HAVE_RAND48 */
cafa94d86546 Initial revision
darius
parents:
diff changeset
391
cafa94d86546 Initial revision
darius
parents:
diff changeset
392
cafa94d86546 Initial revision
darius
parents:
diff changeset
393 #endif /* defs_h_ */