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
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
|
/*
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.
*/
// Created on 13.11.2003 by RST.
// $Id: M_Gladiator.java,v 1.2 2004-07-08 15:58:44 hzi Exp $
package jake2.game;
import jake2.util.*;
import jake2.util.*;
public class M_Gladiator extends Game {
// This file generated by ModelGen - Do NOT Modify
public final static int FRAME_stand1= 0;
public final static int FRAME_stand2= 1;
public final static int FRAME_stand3= 2;
public final static int FRAME_stand4= 3;
public final static int FRAME_stand5= 4;
public final static int FRAME_stand6= 5;
public final static int FRAME_stand7= 6;
public final static int FRAME_walk1= 7;
public final static int FRAME_walk2= 8;
public final static int FRAME_walk3= 9;
public final static int FRAME_walk4= 10;
public final static int FRAME_walk5= 11;
public final static int FRAME_walk6= 12;
public final static int FRAME_walk7= 13;
public final static int FRAME_walk8= 14;
public final static int FRAME_walk9= 15;
public final static int FRAME_walk10= 16;
public final static int FRAME_walk11= 17;
public final static int FRAME_walk12= 18;
public final static int FRAME_walk13= 19;
public final static int FRAME_walk14= 20;
public final static int FRAME_walk15= 21;
public final static int FRAME_walk16= 22;
public final static int FRAME_run1= 23;
public final static int FRAME_run2= 24;
public final static int FRAME_run3= 25;
public final static int FRAME_run4= 26;
public final static int FRAME_run5= 27;
public final static int FRAME_run6= 28;
public final static int FRAME_melee1= 29;
public final static int FRAME_melee2= 30;
public final static int FRAME_melee3= 31;
public final static int FRAME_melee4= 32;
public final static int FRAME_melee5= 33;
public final static int FRAME_melee6= 34;
public final static int FRAME_melee7= 35;
public final static int FRAME_melee8= 36;
public final static int FRAME_melee9= 37;
public final static int FRAME_melee10= 38;
public final static int FRAME_melee11= 39;
public final static int FRAME_melee12= 40;
public final static int FRAME_melee13= 41;
public final static int FRAME_melee14= 42;
public final static int FRAME_melee15= 43;
public final static int FRAME_melee16= 44;
public final static int FRAME_melee17= 45;
public final static int FRAME_attack1= 46;
public final static int FRAME_attack2= 47;
public final static int FRAME_attack3= 48;
public final static int FRAME_attack4= 49;
public final static int FRAME_attack5= 50;
public final static int FRAME_attack6= 51;
public final static int FRAME_attack7= 52;
public final static int FRAME_attack8= 53;
public final static int FRAME_attack9= 54;
public final static int FRAME_pain1= 55;
public final static int FRAME_pain2= 56;
public final static int FRAME_pain3= 57;
public final static int FRAME_pain4= 58;
public final static int FRAME_pain5= 59;
public final static int FRAME_pain6= 60;
public final static int FRAME_death1= 61;
public final static int FRAME_death2= 62;
public final static int FRAME_death3= 63;
public final static int FRAME_death4= 64;
public final static int FRAME_death5= 65;
public final static int FRAME_death6= 66;
public final static int FRAME_death7= 67;
public final static int FRAME_death8= 68;
public final static int FRAME_death9= 69;
public final static int FRAME_death10= 70;
public final static int FRAME_death11= 71;
public final static int FRAME_death12= 72;
public final static int FRAME_death13= 73;
public final static int FRAME_death14= 74;
public final static int FRAME_death15= 75;
public final static int FRAME_death16= 76;
public final static int FRAME_death17= 77;
public final static int FRAME_death18= 78;
public final static int FRAME_death19= 79;
public final static int FRAME_death20= 80;
public final static int FRAME_death21= 81;
public final static int FRAME_death22= 82;
public final static int FRAME_painup1= 83;
public final static int FRAME_painup2= 84;
public final static int FRAME_painup3= 85;
public final static int FRAME_painup4= 86;
public final static int FRAME_painup5= 87;
public final static int FRAME_painup6= 88;
public final static int FRAME_painup7= 89;
public final static float MODEL_SCALE= 1.000000f;
static int sound_pain1;
static int sound_pain2;
static int sound_die;
static int sound_gun;
static int sound_cleaver_swing;
static int sound_cleaver_hit;
static int sound_cleaver_miss;
static int sound_idle;
static int sound_search;
static int sound_sight;
static EntThinkAdapter gladiator_idle= new EntThinkAdapter() {
public boolean think(edict_t self) {
gi.sound(self, CHAN_VOICE, sound_idle, 1, ATTN_IDLE, 0);
return true;
}
};
static EntInteractAdapter gladiator_sight= new EntInteractAdapter() {
public boolean interact(edict_t self, edict_t other) {
gi.sound(self, CHAN_VOICE, sound_sight, 1, ATTN_NORM, 0);
return true;
}
};
static EntThinkAdapter gladiator_search= new EntThinkAdapter() {
public boolean think(edict_t self) {
gi.sound(self, CHAN_VOICE, sound_search, 1, ATTN_NORM, 0);
return true;
}
};
static EntThinkAdapter gladiator_cleaver_swing= new EntThinkAdapter() {
public boolean think(edict_t self) {
gi.sound(self, CHAN_WEAPON, sound_cleaver_swing, 1, ATTN_NORM, 0);
return true;
}
};
static mframe_t gladiator_frames_stand[]=
new mframe_t[] {
new mframe_t(GameAIAdapters.ai_stand, 0, null),
new mframe_t(GameAIAdapters.ai_stand, 0, null),
new mframe_t(GameAIAdapters.ai_stand, 0, null),
new mframe_t(GameAIAdapters.ai_stand, 0, null),
new mframe_t(GameAIAdapters.ai_stand, 0, null),
new mframe_t(GameAIAdapters.ai_stand, 0, null),
new mframe_t(GameAIAdapters.ai_stand, 0, null)};
static mmove_t gladiator_move_stand=
new mmove_t(FRAME_stand1, FRAME_stand7, gladiator_frames_stand, null);
static EntThinkAdapter gladiator_stand= new EntThinkAdapter() {
public boolean think(edict_t self) {
self.monsterinfo.currentmove= gladiator_move_stand;
return true;
}
};
static mframe_t gladiator_frames_walk[]=
new mframe_t[] {
new mframe_t(GameAIAdapters.ai_walk, 15, null),
new mframe_t(GameAIAdapters.ai_walk, 7, null),
new mframe_t(GameAIAdapters.ai_walk, 6, null),
new mframe_t(GameAIAdapters.ai_walk, 5, null),
new mframe_t(GameAIAdapters.ai_walk, 2, null),
new mframe_t(GameAIAdapters.ai_walk, 0, null),
new mframe_t(GameAIAdapters.ai_walk, 2, null),
new mframe_t(GameAIAdapters.ai_walk, 8, null),
new mframe_t(GameAIAdapters.ai_walk, 12, null),
new mframe_t(GameAIAdapters.ai_walk, 8, null),
new mframe_t(GameAIAdapters.ai_walk, 5, null),
new mframe_t(GameAIAdapters.ai_walk, 5, null),
new mframe_t(GameAIAdapters.ai_walk, 2, null),
new mframe_t(GameAIAdapters.ai_walk, 2, null),
new mframe_t(GameAIAdapters.ai_walk, 1, null),
new mframe_t(GameAIAdapters.ai_walk, 8, null)};
static mmove_t gladiator_move_walk=
new mmove_t(FRAME_walk1, FRAME_walk16, gladiator_frames_walk, null);
static EntThinkAdapter gladiator_walk= new EntThinkAdapter() {
public boolean think(edict_t self) {
self.monsterinfo.currentmove= gladiator_move_walk;
return true;
}
};
static mframe_t gladiator_frames_run[]=
new mframe_t[] {
new mframe_t(GameAIAdapters.ai_run, 23, null),
new mframe_t(GameAIAdapters.ai_run, 14, null),
new mframe_t(GameAIAdapters.ai_run, 14, null),
new mframe_t(GameAIAdapters.ai_run, 21, null),
new mframe_t(GameAIAdapters.ai_run, 12, null),
new mframe_t(GameAIAdapters.ai_run, 13, null)};
static mmove_t gladiator_move_run=
new mmove_t(FRAME_run1, FRAME_run6, gladiator_frames_run, null);
static EntThinkAdapter gladiator_run= new EntThinkAdapter() {
public boolean think(edict_t self) {
if ((self.monsterinfo.aiflags & AI_STAND_GROUND) != 0)
self.monsterinfo.currentmove= gladiator_move_stand;
else
self.monsterinfo.currentmove= gladiator_move_run;
return true;
}
};
static EntThinkAdapter GaldiatorMelee= new EntThinkAdapter() {
public boolean think(edict_t self) {
float[] aim= { 0, 0, 0 };
Math3D.VectorSet(aim, MELEE_DISTANCE, self.mins[0], -4);
if (Fire.fire_hit(self, aim, (20 + (Lib.rand() % 5)), 300))
gi.sound(self, CHAN_AUTO, sound_cleaver_hit, 1, ATTN_NORM, 0);
else
gi.sound(self, CHAN_AUTO, sound_cleaver_miss, 1, ATTN_NORM, 0);
return true;
}
};
static mframe_t gladiator_frames_attack_melee[]=
new mframe_t[] {
new mframe_t(GameAIAdapters.ai_charge, 0, null),
new mframe_t(GameAIAdapters.ai_charge, 0, null),
new mframe_t(GameAIAdapters.ai_charge, 0, null),
new mframe_t(GameAIAdapters.ai_charge, 0, null),
new mframe_t(GameAIAdapters.ai_charge, 0, gladiator_cleaver_swing),
new mframe_t(GameAIAdapters.ai_charge, 0, null),
new mframe_t(GameAIAdapters.ai_charge, 0, GaldiatorMelee),
new mframe_t(GameAIAdapters.ai_charge, 0, null),
new mframe_t(GameAIAdapters.ai_charge, 0, null),
new mframe_t(GameAIAdapters.ai_charge, 0, null),
new mframe_t(GameAIAdapters.ai_charge, 0, gladiator_cleaver_swing),
new mframe_t(GameAIAdapters.ai_charge, 0, null),
new mframe_t(GameAIAdapters.ai_charge, 0, null),
new mframe_t(GameAIAdapters.ai_charge, 0, GaldiatorMelee),
new mframe_t(GameAIAdapters.ai_charge, 0, null),
new mframe_t(GameAIAdapters.ai_charge, 0, null),
new mframe_t(GameAIAdapters.ai_charge, 0, null)};
static mmove_t gladiator_move_attack_melee=
new mmove_t(
FRAME_melee1,
FRAME_melee17,
gladiator_frames_attack_melee,
gladiator_run);
static EntThinkAdapter gladiator_melee= new EntThinkAdapter() {
public boolean think(edict_t self) {
self.monsterinfo.currentmove= gladiator_move_attack_melee;
return true;
}
};
static EntThinkAdapter GladiatorGun= new EntThinkAdapter() {
public boolean think(edict_t self) {
float[] start= { 0, 0, 0 };
float[] dir= { 0, 0, 0 };
float[] forward= { 0, 0, 0 }, right= { 0, 0, 0 };
Math3D.AngleVectors(self.s.angles, forward, right, null);
Math3D.G_ProjectSource(
self.s.origin,
monster_flash_offset[MZ2_GLADIATOR_RAILGUN_1],
forward,
right,
start);
// calc direction to where we targted
Math3D.VectorSubtract(self.pos1, start, dir);
Math3D.VectorNormalize(dir);
Monster.monster_fire_railgun(
self,
start,
dir,
50,
100,
MZ2_GLADIATOR_RAILGUN_1);
return true;
}
};
static mframe_t gladiator_frames_attack_gun[]=
new mframe_t[] {
new mframe_t(GameAIAdapters.ai_charge, 0, null),
new mframe_t(GameAIAdapters.ai_charge, 0, null),
new mframe_t(GameAIAdapters.ai_charge, 0, null),
new mframe_t(GameAIAdapters.ai_charge, 0, GladiatorGun),
new mframe_t(GameAIAdapters.ai_charge, 0, null),
new mframe_t(GameAIAdapters.ai_charge, 0, null),
new mframe_t(GameAIAdapters.ai_charge, 0, null),
new mframe_t(GameAIAdapters.ai_charge, 0, null),
new mframe_t(GameAIAdapters.ai_charge, 0, null)};
static mmove_t gladiator_move_attack_gun=
new mmove_t(
FRAME_attack1,
FRAME_attack9,
gladiator_frames_attack_gun,
gladiator_run);
static EntThinkAdapter gladiator_attack= new EntThinkAdapter() {
public boolean think(edict_t self) {
float range;
float[] v={0,0,0};
// a small safe zone
Math3D.VectorSubtract(self.s.origin, self.enemy.s.origin, v);
range= Math3D.VectorLength(v);
if (range <= (MELEE_DISTANCE + 32))
return true;
// charge up the railgun
gi.sound(self, CHAN_WEAPON, sound_gun, 1, ATTN_NORM, 0);
Math3D.VectorCopy(self.enemy.s.origin, self.pos1);
//save for aiming the shot
self.pos1[2] += self.enemy.viewheight;
self.monsterinfo.currentmove= gladiator_move_attack_gun;
return true;
}
};
static mframe_t gladiator_frames_pain[]=
new mframe_t[] {
new mframe_t(GameAIAdapters.ai_move, 0, null),
new mframe_t(GameAIAdapters.ai_move, 0, null),
new mframe_t(GameAIAdapters.ai_move, 0, null),
new mframe_t(GameAIAdapters.ai_move, 0, null),
new mframe_t(GameAIAdapters.ai_move, 0, null),
new mframe_t(GameAIAdapters.ai_move, 0, null)};
static mmove_t gladiator_move_pain=
new mmove_t(
FRAME_pain1,
FRAME_pain6,
gladiator_frames_pain,
gladiator_run);
static mframe_t gladiator_frames_pain_air[]=
new mframe_t[] {
new mframe_t(GameAIAdapters.ai_move, 0, null),
new mframe_t(GameAIAdapters.ai_move, 0, null),
new mframe_t(GameAIAdapters.ai_move, 0, null),
new mframe_t(GameAIAdapters.ai_move, 0, null),
new mframe_t(GameAIAdapters.ai_move, 0, null),
new mframe_t(GameAIAdapters.ai_move, 0, null),
new mframe_t(GameAIAdapters.ai_move, 0, null)};
static mmove_t gladiator_move_pain_air=
new mmove_t(
FRAME_painup1,
FRAME_painup7,
gladiator_frames_pain_air,
gladiator_run);
static EntPainAdapter gladiator_pain= new EntPainAdapter() {
public void pain(edict_t self, edict_t other, float kick, int damage) {
if (self.health < (self.max_health / 2))
self.s.skinnum= 1;
if (level.time < self.pain_debounce_time) {
if ((self.velocity[2] > 100)
&& (self.monsterinfo.currentmove == gladiator_move_pain))
self.monsterinfo.currentmove= gladiator_move_pain_air;
return;
}
self.pain_debounce_time= level.time + 3;
if (Lib.random() < 0.5)
gi.sound(self, CHAN_VOICE, sound_pain1, 1, ATTN_NORM, 0);
else
gi.sound(self, CHAN_VOICE, sound_pain2, 1, ATTN_NORM, 0);
if (skill.value == 3)
return; // no pain anims in nightmare
if (self.velocity[2] > 100)
self.monsterinfo.currentmove= gladiator_move_pain_air;
else
self.monsterinfo.currentmove= gladiator_move_pain;
}
};
static EntThinkAdapter gladiator_dead= new EntThinkAdapter() {
public boolean think(edict_t self) {
Math3D.VectorSet(self.mins, -16, -16, -24);
Math3D.VectorSet(self.maxs, 16, 16, -8);
self.movetype= MOVETYPE_TOSS;
self.svflags |= SVF_DEADMONSTER;
self.nextthink= 0;
gi.linkentity(self);
return true;
}
};
static mframe_t gladiator_frames_death[]=
new mframe_t[] {
new mframe_t(GameAIAdapters.ai_move, 0, null),
new mframe_t(GameAIAdapters.ai_move, 0, null),
new mframe_t(GameAIAdapters.ai_move, 0, null),
new mframe_t(GameAIAdapters.ai_move, 0, null),
new mframe_t(GameAIAdapters.ai_move, 0, null),
new mframe_t(GameAIAdapters.ai_move, 0, null),
new mframe_t(GameAIAdapters.ai_move, 0, null),
new mframe_t(GameAIAdapters.ai_move, 0, null),
new mframe_t(GameAIAdapters.ai_move, 0, null),
new mframe_t(GameAIAdapters.ai_move, 0, null),
new mframe_t(GameAIAdapters.ai_move, 0, null),
new mframe_t(GameAIAdapters.ai_move, 0, null),
new mframe_t(GameAIAdapters.ai_move, 0, null),
new mframe_t(GameAIAdapters.ai_move, 0, null),
new mframe_t(GameAIAdapters.ai_move, 0, null),
new mframe_t(GameAIAdapters.ai_move, 0, null),
new mframe_t(GameAIAdapters.ai_move, 0, null),
new mframe_t(GameAIAdapters.ai_move, 0, null),
new mframe_t(GameAIAdapters.ai_move, 0, null),
new mframe_t(GameAIAdapters.ai_move, 0, null),
new mframe_t(GameAIAdapters.ai_move, 0, null),
new mframe_t(GameAIAdapters.ai_move, 0, null)};
static mmove_t gladiator_move_death=
new mmove_t(
FRAME_death1,
FRAME_death22,
gladiator_frames_death,
gladiator_dead);
static EntDieAdapter gladiator_die= new EntDieAdapter() {
public void die(
edict_t self,
edict_t inflictor,
edict_t attacker,
int damage,
float[] point) {
int n;
// check for gib
if (self.health <= self.gib_health) {
gi.sound(
self,
CHAN_VOICE,
gi.soundindex("misc/udeath.wav"),
1,
ATTN_NORM,
0);
for (n= 0; n < 2; n++)
ThrowGib(
self,
"models/objects/gibs/bone/tris.md2",
damage,
GIB_ORGANIC);
for (n= 0; n < 4; n++)
ThrowGib(
self,
"models/objects/gibs/sm_meat/tris.md2",
damage,
GIB_ORGANIC);
ThrowHead(
self,
"models/objects/gibs/head2/tris.md2",
damage,
GIB_ORGANIC);
self.deadflag= DEAD_DEAD;
return;
}
if (self.deadflag == DEAD_DEAD)
return;
// regular death
gi.sound(self, CHAN_VOICE, sound_die, 1, ATTN_NORM, 0);
self.deadflag= DEAD_DEAD;
self.takedamage= DAMAGE_YES;
self.monsterinfo.currentmove= gladiator_move_death;
}
};
/*QUAKED monster_gladiator (1 .5 0) (-32 -32 -24) (32 32 64) Ambush Trigger_Spawn Sight
*/
static void SP_monster_gladiator(edict_t self) {
if (deathmatch.value != 0) {
G_FreeEdict(self);
return;
}
sound_pain1= gi.soundindex("gladiator/pain.wav");
sound_pain2= gi.soundindex("gladiator/gldpain2.wav");
sound_die= gi.soundindex("gladiator/glddeth2.wav");
sound_gun= gi.soundindex("gladiator/railgun.wav");
sound_cleaver_swing= gi.soundindex("gladiator/melee1.wav");
sound_cleaver_hit= gi.soundindex("gladiator/melee2.wav");
sound_cleaver_miss= gi.soundindex("gladiator/melee3.wav");
sound_idle= gi.soundindex("gladiator/gldidle1.wav");
sound_search= gi.soundindex("gladiator/gldsrch1.wav");
sound_sight= gi.soundindex("gladiator/sight.wav");
self.movetype= MOVETYPE_STEP;
self.solid= SOLID_BBOX;
self.s.modelindex= gi.modelindex("models/monsters/gladiatr/tris.md2");
Math3D.VectorSet(self.mins, -32, -32, -24);
Math3D.VectorSet(self.maxs, 32, 32, 64);
self.health= 400;
self.gib_health= -175;
self.mass= 400;
self.pain= gladiator_pain;
self.die= gladiator_die;
self.monsterinfo.stand= gladiator_stand;
self.monsterinfo.walk= gladiator_walk;
self.monsterinfo.run= gladiator_run;
self.monsterinfo.dodge= null;
self.monsterinfo.attack= gladiator_attack;
self.monsterinfo.melee= gladiator_melee;
self.monsterinfo.sight= gladiator_sight;
self.monsterinfo.idle= gladiator_idle;
self.monsterinfo.search= gladiator_search;
gi.linkentity(self);
self.monsterinfo.currentmove= gladiator_move_stand;
self.monsterinfo.scale= MODEL_SCALE;
GameAIAdapters.walkmonster_start.think(self);
}
}
|