1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
|
/*
Copyright (C) 1997-2001 Id Software, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package jake2.game;
import jake2.*;
import jake2.util.*;
public class edict_t {
public edict_t(int i) {
s.number = i;
index = i;
}
public void clear() {
}
// integrated entity state
public entity_state_t s = new entity_state_t(this);
public boolean inuse;
public int linkcount;
// FIXME: move these fields to a server private sv_entity_t
public link_t area = new link_t(this); // linked to a division node or leaf
public int num_clusters; // if -1, use headnode instead
public int clusternums[] = new int[Defines.MAX_ENT_CLUSTERS];
public int headnode; // unused if num_clusters != -1
public int areanum, areanum2;
//================================
public int svflags; // SVF_NOCLIENT, SVF_DEADMONSTER, SVF_MONSTER, etc
public float[] mins = { 0, 0, 0 };
public float[] maxs = { 0, 0, 0 };
public float[] absmin = { 0, 0, 0 };
public float[] absmax = { 0, 0, 0 };
public float[] size = { 0, 0, 0 };
public int solid;
public int clipmask;
// the game dll can add anything it wants after
// this point in the structure
// DO NOT MODIFY ANYTHING ABOVE THIS, THE SERVER
// EXPECTS THE FIELDS IN THAT ORDER!
//================================
public int movetype;
public int flags;
public String model = "";
public float freetime; // sv.time when the object was freed
//
// only used locally in game, not by server
//
public String message = "";
public String classname = "";
public int spawnflags;
public float timestamp;
// set in qe3, -1 = up, -2 = down
public float angle;
public String target = null;
public String targetname = null;
public String killtarget = null;
public String team = null;
public String pathtarget = null;
public String deathtarget = null;
public String combattarget = null;
public edict_t target_ent = null;
public float speed, accel, decel;
public float[] movedir = { 0, 0, 0 };
public float[] pos1 = { 0, 0, 0 };
public float[] pos2 = { 0, 0, 0 };
public float[] velocity = { 0, 0, 0 };
public float[] avelocity = { 0, 0, 0 };
public int mass;
public float air_finished;
public float gravity; // per entity gravity multiplier (1.0 is normal)
// use for lowgrav artifact, flares
public edict_t goalentity = null;
public edict_t movetarget = null;
public float yaw_speed;
public float ideal_yaw;
public float nextthink;
public EntThinkAdapter prethink = null;
public EntThinkAdapter think = null;
public EntBlockedAdapter blocked = null;
public EntTouchAdapter touch = null;
public EntUseAdapter use = null;
public EntPainAdapter pain = null;
public EntDieAdapter die = null;
public float touch_debounce_time; // are all these legit? do we need more/less of them?
public float pain_debounce_time;
public float damage_debounce_time;
public float fly_sound_debounce_time; //move to clientinfo
public float last_move_time;
public int health;
public int max_health;
public int gib_health;
public int deadflag;
public int show_hostile;
public float powerarmor_time;
public String map = null;
; // target_changelevel
public int viewheight; // height above origin where eyesight is determined
public int takedamage;
public int dmg;
public int radius_dmg;
public float dmg_radius;
public int sounds; //make this a spawntemp var?
public int count;
public edict_t chain = null;
public edict_t enemy = null;
public edict_t oldenemy = null;
public edict_t activator = null;
public edict_t groundentity = null;
public int groundentity_linkcount;
public edict_t teamchain = null;
public edict_t teammaster = null;
public edict_t mynoise = null; // can go in client only
public edict_t mynoise2 = null;
public int noise_index;
public int noise_index2;
public float volume;
public float attenuation;
// timing variables
public float wait;
public float delay; // before firing targets
public float random;
public float teleport_time;
public int watertype;
public int waterlevel;
public float[] move_origin = { 0, 0, 0 };
public float[] move_angles = { 0, 0, 0 };
// move this to clientinfo?
public int light_level;
public int style; // also used as areaportal number
public gitem_t item; // for bonus items
// common integrated data blocks
public moveinfo_t moveinfo = new moveinfo_t();
public monsterinfo_t monsterinfo = new monsterinfo_t();
public gclient_t client;
public edict_t owner;
public int index; //introduced by rst
/////////////////////////////////////////////////
public boolean set(String key, String value) {
if (key.equals("classname")) {
classname = GameSpawn.ED_NewString(value);
return true;
} // F_LSTRING),
if (key.equals("model")) {
model = GameSpawn.ED_NewString(value);
return true;
} // F_LSTRING),
if (key.equals("spawnflags")) {
spawnflags = Lib.atoi(value);
return true;
} // F_INT),
if (key.equals("speed")) {
speed = Lib.atof(value);
return true;
} // F_FLOAT),
if (key.equals("accel")) {
accel = Lib.atof(value);
return true;
} // F_FLOAT),
if (key.equals("decel")) {
decel = Lib.atof(value);
return true;
} // F_FLOAT),
if (key.equals("target")) {
target = GameSpawn.ED_NewString(value);
return true;
} // F_LSTRING),
if (key.equals("targetname")) {
targetname = GameSpawn.ED_NewString(value);
return true;
} // F_LSTRING),
if (key.equals("pathtarget")) {
pathtarget = GameSpawn.ED_NewString(value);
return true;
} // F_LSTRING),
if (key.equals("deathtarget")) {
deathtarget = GameSpawn.ED_NewString(value);
return true;
} // F_LSTRING),
if (key.equals("killtarget")) {
killtarget = GameSpawn.ED_NewString(value);
return true;
} // F_LSTRING),
if (key.equals("combattarget")) {
combattarget = GameSpawn.ED_NewString(value);
return true;
} // F_LSTRING),
if (key.equals("message")) {
message = GameSpawn.ED_NewString(value);
return true;
} // F_LSTRING),
if (key.equals("team")) {
team = GameSpawn.ED_NewString(value);
return true;
} // F_LSTRING),
if (key.equals("wait")) {
wait = Lib.atof(value);
return true;
} // F_FLOAT),
if (key.equals("delay")) {
delay = Lib.atof(value);
return true;
} // F_FLOAT),
if (key.equals("random")) {
random = Lib.atof(value);
return true;
} // F_FLOAT),
if (key.equals("move_origin")) {
move_origin = Lib.atov(value);
return true;
} // F_VECTOR),
if (key.equals("move_angles")) {
move_angles = Lib.atov(value);
return true;
} // F_VECTOR),
if (key.equals("style")) {
style = Lib.atoi(value);
return true;
} // F_INT),
if (key.equals("count")) {
count = Lib.atoi(value);
return true;
} // F_INT),
if (key.equals("health")) {
health = Lib.atoi(value);
return true;
} // F_INT),
if (key.equals("sounds")) {
sounds = Lib.atoi(value);
return true;
} // F_INT),
if (key.equals("light")) {
return true;
} // F_IGNORE),
if (key.equals("dmg")) {
dmg = Lib.atoi(value);
return true;
} // F_INT),
if (key.equals("mass")) {
mass = Lib.atoi(value);
return true;
} // F_INT),
if (key.equals("volume")) {
volume = Lib.atof(value);
return true;
} // F_FLOAT),
if (key.equals("attenuation")) {
attenuation = Lib.atof(value);
return true;
} // F_FLOAT),
if (key.equals("map")) {
map = GameSpawn.ED_NewString(value);
return true;
} // F_LSTRING),
if (key.equals("origin")) {
s.origin = Lib.atov(value);
return true;
} // F_VECTOR),
if (key.equals("angles")) {
s.angles = Lib.atov(value);
return true;
} // F_VECTOR),
if (key.equals("angle")) {
s.angles = new float[] { 0, Lib.atof(value), 0 };
return true;
} // F_ANGLEHACK),
/* --- NOSPAWN ---
if (key.equals("goalentity")) {
return true;
} // F_EDICT, FFL_NOSPAWN),
if (key.equals("movetarget")) {
return true;
} // F_EDICT, FFL_NOSPAWN),
if (key.equals("enemy")) {
return true;
} // F_EDICT, FFL_NOSPAWN),
if (key.equals("oldenemy")) {
return true;
} // F_EDICT, FFL_NOSPAWN),
if (key.equals("activator")) {
return true;
} // F_EDICT, FFL_NOSPAWN),
if (key.equals("groundentity")) {
return true;
} // F_EDICT, FFL_NOSPAWN),
if (key.equals("teamchain")) {
return true;
} // F_EDICT, FFL_NOSPAWN),
if (key.equals("teammaster")) {
return true;
} // F_EDICT, FFL_NOSPAWN),
if (key.equals("owner")) {
return true;
} // F_EDICT, FFL_NOSPAWN),
if (key.equals("mynoise")) {
return true;
} // F_EDICT, FFL_NOSPAWN),
if (key.equals("mynoise2")) {
return true;
} // F_EDICT, FFL_NOSPAWN),
if (key.equals("target_ent")) {
return true;
} // F_EDICT, FFL_NOSPAWN),
if (key.equals("chain")) {
return true;
} // F_EDICT, FFL_NOSPAWN),
if (key.equals("prethink")) {
return true;
} // F_FUNCTION, FFL_NOSPAWN),
if (key.equals("think")) {
return true;
} // F_FUNCTION, FFL_NOSPAWN),
if (key.equals("blocked")) {
return true;
} // F_FUNCTION, FFL_NOSPAWN),
if (key.equals("touch")) {
return true;
} // F_FUNCTION, FFL_NOSPAWN),
if (key.equals("use")) {
return true;
} // F_FUNCTION, FFL_NOSPAWN),
if (key.equals("pain")) {
return true;
} // F_FUNCTION, FFL_NOSPAWN),
if (key.equals("die")) {
return true;
} // F_FUNCTION, FFL_NOSPAWN),
if (key.equals("stand")) {
return true;
} // F_FUNCTION, FFL_NOSPAWN),
if (key.equals("idle")) {
return true;
} // F_FUNCTION, FFL_NOSPAWN),
if (key.equals("search")) {
return true;
} // F_FUNCTION, FFL_NOSPAWN),
if (key.equals("walk")) {
return true;
} // F_FUNCTION, FFL_NOSPAWN),
if (key.equals("run")) {
return true;
} // F_FUNCTION, FFL_NOSPAWN),
if (key.equals("dodge")) {
return true;
} // F_FUNCTION, FFL_NOSPAWN),
if (key.equals("attack")) {
return true;
} // F_FUNCTION, FFL_NOSPAWN),
if (key.equals("melee")) {
return true;
} // F_FUNCTION, FFL_NOSPAWN),
if (key.equals("sight")) {
return true;
} // F_FUNCTION, FFL_NOSPAWN),
if (key.equals("checkattack")) {
return true;
} // F_FUNCTION, FFL_NOSPAWN),
if (key.equals("currentmove")) {
return true;
} // F_MMOVE, FFL_NOSPAWN),
if (key.equals("endfunc")) {
return true;
} // F_FUNCTION, FFL_NOSPAWN),
*/
if (key.equals("item")) {
Game.gi.error("ent.set(\"item\") called.");
return true;
} // F_ITEM)
return false;
}
}
|