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
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
|
/*
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_Mutant.java,v 1.1 2004-07-07 19:59:17 hzi Exp $
package jake2.game;
import jake2.client.M;
import jake2.util.*;
public class M_Mutant extends Game {
// This file generated by ModelGen - Do NOT Modify
public final static int FRAME_attack01 = 0;
public final static int FRAME_attack02 = 1;
public final static int FRAME_attack03 = 2;
public final static int FRAME_attack04 = 3;
public final static int FRAME_attack05 = 4;
public final static int FRAME_attack06 = 5;
public final static int FRAME_attack07 = 6;
public final static int FRAME_attack08 = 7;
public final static int FRAME_attack09 = 8;
public final static int FRAME_attack10 = 9;
public final static int FRAME_attack11 = 10;
public final static int FRAME_attack12 = 11;
public final static int FRAME_attack13 = 12;
public final static int FRAME_attack14 = 13;
public final static int FRAME_attack15 = 14;
public final static int FRAME_death101 = 15;
public final static int FRAME_death102 = 16;
public final static int FRAME_death103 = 17;
public final static int FRAME_death104 = 18;
public final static int FRAME_death105 = 19;
public final static int FRAME_death106 = 20;
public final static int FRAME_death107 = 21;
public final static int FRAME_death108 = 22;
public final static int FRAME_death109 = 23;
public final static int FRAME_death201 = 24;
public final static int FRAME_death202 = 25;
public final static int FRAME_death203 = 26;
public final static int FRAME_death204 = 27;
public final static int FRAME_death205 = 28;
public final static int FRAME_death206 = 29;
public final static int FRAME_death207 = 30;
public final static int FRAME_death208 = 31;
public final static int FRAME_death209 = 32;
public final static int FRAME_death210 = 33;
public final static int FRAME_pain101 = 34;
public final static int FRAME_pain102 = 35;
public final static int FRAME_pain103 = 36;
public final static int FRAME_pain104 = 37;
public final static int FRAME_pain105 = 38;
public final static int FRAME_pain201 = 39;
public final static int FRAME_pain202 = 40;
public final static int FRAME_pain203 = 41;
public final static int FRAME_pain204 = 42;
public final static int FRAME_pain205 = 43;
public final static int FRAME_pain206 = 44;
public final static int FRAME_pain301 = 45;
public final static int FRAME_pain302 = 46;
public final static int FRAME_pain303 = 47;
public final static int FRAME_pain304 = 48;
public final static int FRAME_pain305 = 49;
public final static int FRAME_pain306 = 50;
public final static int FRAME_pain307 = 51;
public final static int FRAME_pain308 = 52;
public final static int FRAME_pain309 = 53;
public final static int FRAME_pain310 = 54;
public final static int FRAME_pain311 = 55;
public final static int FRAME_run03 = 56;
public final static int FRAME_run04 = 57;
public final static int FRAME_run05 = 58;
public final static int FRAME_run06 = 59;
public final static int FRAME_run07 = 60;
public final static int FRAME_run08 = 61;
public final static int FRAME_stand101 = 62;
public final static int FRAME_stand102 = 63;
public final static int FRAME_stand103 = 64;
public final static int FRAME_stand104 = 65;
public final static int FRAME_stand105 = 66;
public final static int FRAME_stand106 = 67;
public final static int FRAME_stand107 = 68;
public final static int FRAME_stand108 = 69;
public final static int FRAME_stand109 = 70;
public final static int FRAME_stand110 = 71;
public final static int FRAME_stand111 = 72;
public final static int FRAME_stand112 = 73;
public final static int FRAME_stand113 = 74;
public final static int FRAME_stand114 = 75;
public final static int FRAME_stand115 = 76;
public final static int FRAME_stand116 = 77;
public final static int FRAME_stand117 = 78;
public final static int FRAME_stand118 = 79;
public final static int FRAME_stand119 = 80;
public final static int FRAME_stand120 = 81;
public final static int FRAME_stand121 = 82;
public final static int FRAME_stand122 = 83;
public final static int FRAME_stand123 = 84;
public final static int FRAME_stand124 = 85;
public final static int FRAME_stand125 = 86;
public final static int FRAME_stand126 = 87;
public final static int FRAME_stand127 = 88;
public final static int FRAME_stand128 = 89;
public final static int FRAME_stand129 = 90;
public final static int FRAME_stand130 = 91;
public final static int FRAME_stand131 = 92;
public final static int FRAME_stand132 = 93;
public final static int FRAME_stand133 = 94;
public final static int FRAME_stand134 = 95;
public final static int FRAME_stand135 = 96;
public final static int FRAME_stand136 = 97;
public final static int FRAME_stand137 = 98;
public final static int FRAME_stand138 = 99;
public final static int FRAME_stand139 = 100;
public final static int FRAME_stand140 = 101;
public final static int FRAME_stand141 = 102;
public final static int FRAME_stand142 = 103;
public final static int FRAME_stand143 = 104;
public final static int FRAME_stand144 = 105;
public final static int FRAME_stand145 = 106;
public final static int FRAME_stand146 = 107;
public final static int FRAME_stand147 = 108;
public final static int FRAME_stand148 = 109;
public final static int FRAME_stand149 = 110;
public final static int FRAME_stand150 = 111;
public final static int FRAME_stand151 = 112;
public final static int FRAME_stand152 = 113;
public final static int FRAME_stand153 = 114;
public final static int FRAME_stand154 = 115;
public final static int FRAME_stand155 = 116;
public final static int FRAME_stand156 = 117;
public final static int FRAME_stand157 = 118;
public final static int FRAME_stand158 = 119;
public final static int FRAME_stand159 = 120;
public final static int FRAME_stand160 = 121;
public final static int FRAME_stand161 = 122;
public final static int FRAME_stand162 = 123;
public final static int FRAME_stand163 = 124;
public final static int FRAME_stand164 = 125;
public final static int FRAME_walk01 = 126;
public final static int FRAME_walk02 = 127;
public final static int FRAME_walk03 = 128;
public final static int FRAME_walk04 = 129;
public final static int FRAME_walk05 = 130;
public final static int FRAME_walk06 = 131;
public final static int FRAME_walk07 = 132;
public final static int FRAME_walk08 = 133;
public final static int FRAME_walk09 = 134;
public final static int FRAME_walk10 = 135;
public final static int FRAME_walk11 = 136;
public final static int FRAME_walk12 = 137;
public final static int FRAME_walk13 = 138;
public final static int FRAME_walk14 = 139;
public final static int FRAME_walk15 = 140;
public final static int FRAME_walk16 = 141;
public final static int FRAME_walk17 = 142;
public final static int FRAME_walk18 = 143;
public final static int FRAME_walk19 = 144;
public final static int FRAME_walk20 = 145;
public final static int FRAME_walk21 = 146;
public final static int FRAME_walk22 = 147;
public final static int FRAME_walk23 = 148;
public final static float MODEL_SCALE = 1.000000f;
static int sound_swing;
static int sound_hit;
static int sound_hit2;
static int sound_death;
static int sound_idle;
static int sound_pain1;
static int sound_pain2;
static int sound_sight;
static int sound_search;
static int sound_step1;
static int sound_step2;
static int sound_step3;
static int sound_thud;
//
// SOUNDS
//
static EntThinkAdapter mutant_step = new EntThinkAdapter() {
public boolean think(edict_t self) {
int n;
n = (Lib.rand() + 1) % 3;
if (n == 0)
gi.sound(self, CHAN_VOICE, sound_step1, 1, ATTN_NORM, 0);
else if (n == 1)
gi.sound(self, CHAN_VOICE, sound_step2, 1, ATTN_NORM, 0);
else
gi.sound(self, CHAN_VOICE, sound_step3, 1, ATTN_NORM, 0);
return true;
}
};
static EntInteractAdapter mutant_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 mutant_search = new EntThinkAdapter() {
public boolean think(edict_t self) {
gi.sound(self, CHAN_VOICE, sound_search, 1, ATTN_NORM, 0);
return true;
}
};
static EntThinkAdapter mutant_swing = new EntThinkAdapter() {
public boolean think(edict_t self) {
gi.sound(self, CHAN_VOICE, sound_swing, 1, ATTN_NORM, 0);
return true;
}
};
//
// STAND
//
static mframe_t mutant_frames_stand[] =
new mframe_t[] {
new mframe_t(ai_stand, 0, null),
new mframe_t(ai_stand, 0, null),
new mframe_t(ai_stand, 0, null),
new mframe_t(ai_stand, 0, null),
new mframe_t(ai_stand, 0, null),
new mframe_t(ai_stand, 0, null),
new mframe_t(ai_stand, 0, null),
new mframe_t(ai_stand, 0, null),
new mframe_t(ai_stand, 0, null),
new mframe_t(ai_stand, 0, null),
// 10)
new mframe_t(ai_stand, 0, null),
new mframe_t(ai_stand, 0, null),
new mframe_t(ai_stand, 0, null),
new mframe_t(ai_stand, 0, null),
new mframe_t(ai_stand, 0, null),
new mframe_t(ai_stand, 0, null),
new mframe_t(ai_stand, 0, null),
new mframe_t(ai_stand, 0, null),
new mframe_t(ai_stand, 0, null),
new mframe_t(ai_stand, 0, null),
// 20)
new mframe_t(ai_stand, 0, null),
new mframe_t(ai_stand, 0, null),
new mframe_t(ai_stand, 0, null),
new mframe_t(ai_stand, 0, null),
new mframe_t(ai_stand, 0, null),
new mframe_t(ai_stand, 0, null),
new mframe_t(ai_stand, 0, null),
new mframe_t(ai_stand, 0, null),
new mframe_t(ai_stand, 0, null),
new mframe_t(ai_stand, 0, null),
// 30)
new mframe_t(ai_stand, 0, null),
new mframe_t(ai_stand, 0, null),
new mframe_t(ai_stand, 0, null),
new mframe_t(ai_stand, 0, null),
new mframe_t(ai_stand, 0, null),
new mframe_t(ai_stand, 0, null),
new mframe_t(ai_stand, 0, null),
new mframe_t(ai_stand, 0, null),
new mframe_t(ai_stand, 0, null),
new mframe_t(ai_stand, 0, null),
// 40)
new mframe_t(ai_stand, 0, null),
new mframe_t(ai_stand, 0, null),
new mframe_t(ai_stand, 0, null),
new mframe_t(ai_stand, 0, null),
new mframe_t(ai_stand, 0, null),
new mframe_t(ai_stand, 0, null),
new mframe_t(ai_stand, 0, null),
new mframe_t(ai_stand, 0, null),
new mframe_t(ai_stand, 0, null),
new mframe_t(ai_stand, 0, null),
// 50)
new mframe_t(ai_stand, 0, null)};
static mmove_t mutant_move_stand = new mmove_t(FRAME_stand101, FRAME_stand151, mutant_frames_stand, null);
static EntThinkAdapter mutant_stand = new EntThinkAdapter() {
public boolean think(edict_t self) {
self.monsterinfo.currentmove = mutant_move_stand;
return true;
}
};
//
// IDLE
//
static EntThinkAdapter mutant_idle_loop = new EntThinkAdapter() {
public boolean think(edict_t self) {
if (Lib.random() < 0.75)
self.monsterinfo.nextframe = FRAME_stand155;
return true;
}
};
static mframe_t mutant_frames_idle[] =
new mframe_t[] {
new mframe_t(ai_stand, 0, null),
new mframe_t(ai_stand, 0, null),
new mframe_t(ai_stand, 0, null),
new mframe_t(ai_stand, 0, null),
// scratch loop start
new mframe_t(ai_stand, 0, null), new mframe_t(ai_stand, 0, null), new mframe_t(ai_stand, 0, mutant_idle_loop),
// scratch loop end
new mframe_t(ai_stand, 0, null),
new mframe_t(ai_stand, 0, null),
new mframe_t(ai_stand, 0, null),
new mframe_t(ai_stand, 0, null),
new mframe_t(ai_stand, 0, null),
new mframe_t(ai_stand, 0, null)};
static mmove_t mutant_move_idle = new mmove_t(FRAME_stand152, FRAME_stand164, mutant_frames_idle, mutant_stand);
static EntThinkAdapter mutant_idle = new EntThinkAdapter() {
public boolean think(edict_t self) {
self.monsterinfo.currentmove = mutant_move_idle;
gi.sound(self, CHAN_VOICE, sound_idle, 1, ATTN_IDLE, 0);
return true;
}
};
//
// WALK
//
static mframe_t mutant_frames_walk[] =
new mframe_t[] {
new mframe_t(ai_walk, 3, null),
new mframe_t(ai_walk, 1, null),
new mframe_t(ai_walk, 5, null),
new mframe_t(ai_walk, 10, null),
new mframe_t(ai_walk, 13, null),
new mframe_t(ai_walk, 10, null),
new mframe_t(ai_walk, 0, null),
new mframe_t(ai_walk, 5, null),
new mframe_t(ai_walk, 6, null),
new mframe_t(ai_walk, 16, null),
new mframe_t(ai_walk, 15, null),
new mframe_t(ai_walk, 6, null)};
static mmove_t mutant_move_walk = new mmove_t(FRAME_walk05, FRAME_walk16, mutant_frames_walk, null);
static EntThinkAdapter mutant_walk_loop = new EntThinkAdapter() {
public boolean think(edict_t self) {
self.monsterinfo.currentmove = mutant_move_walk;
return true;
}
};
static mframe_t mutant_frames_start_walk[] =
new mframe_t[] {
new mframe_t(ai_walk, 5, null),
new mframe_t(ai_walk, 5, null),
new mframe_t(ai_walk, -2, null),
new mframe_t(ai_walk, 1, null)};
static mmove_t mutant_move_start_walk = new mmove_t(FRAME_walk01, FRAME_walk04, mutant_frames_start_walk, mutant_walk_loop);
static EntThinkAdapter mutant_walk = new EntThinkAdapter() {
public boolean think(edict_t self) {
self.monsterinfo.currentmove = mutant_move_start_walk;
return true;
}
};
//
// RUN
//
static mframe_t mutant_frames_run[] =
new mframe_t[] {
new mframe_t(ai_run, 40, null),
new mframe_t(ai_run, 40, mutant_step),
new mframe_t(ai_run, 24, null),
new mframe_t(ai_run, 5, mutant_step),
new mframe_t(ai_run, 17, null),
new mframe_t(ai_run, 10, null)};
static mmove_t mutant_move_run = new mmove_t(FRAME_run03, FRAME_run08, mutant_frames_run, null);
static EntThinkAdapter mutant_run = new EntThinkAdapter() {
public boolean think(edict_t self) {
if ((self.monsterinfo.aiflags & AI_STAND_GROUND)!=0)
self.monsterinfo.currentmove = mutant_move_stand;
else
self.monsterinfo.currentmove = mutant_move_run;
return true;
}
};
//
// MELEE
//
static EntThinkAdapter mutant_hit_left = new EntThinkAdapter() {
public boolean think(edict_t self) {
float[] aim={0,0,0};
Math3D.VectorSet(aim, MELEE_DISTANCE, self.mins[0], 8);
if (Fire.fire_hit(self, aim, (10 + (Lib.rand() % 5)), 100))
gi.sound(self, CHAN_WEAPON, sound_hit, 1, ATTN_NORM, 0);
else
gi.sound(self, CHAN_WEAPON, sound_swing, 1, ATTN_NORM, 0);
return true;
}
};
static EntThinkAdapter mutant_hit_right = new EntThinkAdapter() {
public boolean think(edict_t self) {
float[] aim={0,0,0};
Math3D.VectorSet(aim, MELEE_DISTANCE, self.maxs[0], 8);
if (Fire.fire_hit(self, aim, (10 + (Lib.rand() % 5)), 100))
gi.sound(self, CHAN_WEAPON, sound_hit2, 1, ATTN_NORM, 0);
else
gi.sound(self, CHAN_WEAPON, sound_swing, 1, ATTN_NORM, 0);
return true;
}
};
static EntThinkAdapter mutant_check_refire = new EntThinkAdapter() {
public boolean think(edict_t self) {
if (null == self.enemy || !self.enemy.inuse || self.enemy.health <= 0)
return true;
if (((skill.value == 3) && (Lib.random() < 0.5)) || (range(self, self.enemy) == RANGE_MELEE))
self.monsterinfo.nextframe = FRAME_attack09;
return true;
}
};
static mframe_t mutant_frames_attack[] =
new mframe_t[] {
new mframe_t(ai_charge, 0, null),
new mframe_t(ai_charge, 0, null),
new mframe_t(ai_charge, 0, mutant_hit_left),
new mframe_t(ai_charge, 0, null),
new mframe_t(ai_charge, 0, null),
new mframe_t(ai_charge, 0, mutant_hit_right),
new mframe_t(ai_charge, 0, mutant_check_refire)};
static mmove_t mutant_move_attack = new mmove_t(FRAME_attack09, FRAME_attack15, mutant_frames_attack, mutant_run);
static EntThinkAdapter mutant_melee = new EntThinkAdapter() {
public boolean think(edict_t self) {
self.monsterinfo.currentmove = mutant_move_attack;
return true;
}
};
//
// ATTACK
//
static EntTouchAdapter mutant_jump_touch = new EntTouchAdapter() {
public void touch(edict_t self, edict_t other, cplane_t plane, csurface_t surf) {
if (self.health <= 0) {
self.touch = null;
return;
}
if (other.takedamage!=0) {
if (Math3D.VectorLength(self.velocity) > 400) {
float[] point={0,0,0};
float[] normal={0,0,0};
int damage;
Math3D.VectorCopy(self.velocity, normal);
Math3D.VectorNormalize(normal);
Math3D.VectorMA(self.s.origin, self.maxs[0], normal, point);
damage = (int) (40 + 10 * Lib.random());
T_Damage(other, self, self, self.velocity, point, normal, damage, damage, 0, MOD_UNKNOWN);
}
}
if (!M.M_CheckBottom(self)) {
if (self.groundentity != null) {
self.monsterinfo.nextframe = FRAME_attack02;
self.touch = null;
}
return;
}
self.touch = null;
}
};
static EntThinkAdapter mutant_jump_takeoff = new EntThinkAdapter() {
public boolean think(edict_t self) {
float[] forward={0,0,0};
gi.sound(self, CHAN_VOICE, sound_sight, 1, ATTN_NORM, 0);
Math3D.AngleVectors(self.s.angles, forward, null, null);
self.s.origin[2] += 1;
Math3D.VectorScale(forward, 600, self.velocity);
self.velocity[2] = 250;
self.groundentity = null;
self.monsterinfo.aiflags |= AI_DUCKED;
self.monsterinfo.attack_finished = level.time + 3;
self.touch = mutant_jump_touch;
return true;
}
};
static EntThinkAdapter mutant_check_landing = new EntThinkAdapter() {
public boolean think(edict_t self) {
if (self.groundentity != null) {
gi.sound(self, CHAN_WEAPON, sound_thud, 1, ATTN_NORM, 0);
self.monsterinfo.attack_finished = 0;
self.monsterinfo.aiflags &= ~AI_DUCKED;
return true;
}
if (level.time > self.monsterinfo.attack_finished)
self.monsterinfo.nextframe = FRAME_attack02;
else
self.monsterinfo.nextframe = FRAME_attack05;
return true;
}
};
static mframe_t mutant_frames_jump[] =
new mframe_t[] {
new mframe_t(ai_charge, 0, null),
new mframe_t(ai_charge, 17, null),
new mframe_t(ai_charge, 15, mutant_jump_takeoff),
new mframe_t(ai_charge, 15, null),
new mframe_t(ai_charge, 15, mutant_check_landing),
new mframe_t(ai_charge, 0, null),
new mframe_t(ai_charge, 3, null),
new mframe_t(ai_charge, 0, null)};
static mmove_t mutant_move_jump = new mmove_t(FRAME_attack01, FRAME_attack08, mutant_frames_jump, mutant_run);
static EntThinkAdapter mutant_jump = new EntThinkAdapter() {
public boolean think(edict_t self) {
self.monsterinfo.currentmove = mutant_move_jump;
return true;
}
};
//
// CHECKATTACK
//
static EntThinkAdapter mutant_check_melee = new EntThinkAdapter() {
public boolean think(edict_t self) {
if (range(self, self.enemy) == RANGE_MELEE)
return true;
return false;
}
};
static EntThinkAdapter mutant_check_jump = new EntThinkAdapter() {
public boolean think(edict_t self) {
float[] v={0,0,0};
float distance;
if (self.absmin[2] > (self.enemy.absmin[2] + 0.75 * self.enemy.size[2]))
return false;
if (self.absmax[2] < (self.enemy.absmin[2] + 0.25 * self.enemy.size[2]))
return false;
v[0] = self.s.origin[0] - self.enemy.s.origin[0];
v[1] = self.s.origin[1] - self.enemy.s.origin[1];
v[2] = 0;
distance = Math3D.VectorLength(v);
if (distance < 100)
return false;
if (distance > 100) {
if (Lib.random() < 0.9)
return false;
}
return true;
}
};
static EntThinkAdapter mutant_checkattack = new EntThinkAdapter() {
public boolean think(edict_t self) {
if (null==self.enemy || self.enemy.health <= 0)
return false;
if (mutant_check_melee.think(self)) {
self.monsterinfo.attack_state = AS_MELEE;
return true;
}
if (mutant_check_jump.think(self)) {
self.monsterinfo.attack_state = AS_MISSILE;
// FIXME play a jump sound here
return true;
}
return false;
}
};
//
// PAIN
//
static mframe_t mutant_frames_pain1[] =
new mframe_t[] {
new mframe_t(ai_move, 4, null),
new mframe_t(ai_move, -3, null),
new mframe_t(ai_move, -8, null),
new mframe_t(ai_move, 2, null),
new mframe_t(ai_move, 5, null)};
static mmove_t mutant_move_pain1 = new mmove_t(FRAME_pain101, FRAME_pain105, mutant_frames_pain1, mutant_run);
static mframe_t mutant_frames_pain2[] =
new mframe_t[] {
new mframe_t(ai_move, -24, null),
new mframe_t(ai_move, 11, null),
new mframe_t(ai_move, 5, null),
new mframe_t(ai_move, -2, null),
new mframe_t(ai_move, 6, null),
new mframe_t(ai_move, 4, null)};
static mmove_t mutant_move_pain2 = new mmove_t(FRAME_pain201, FRAME_pain206, mutant_frames_pain2, mutant_run);
static mframe_t mutant_frames_pain3[] =
new mframe_t[] {
new mframe_t(ai_move, -22, null),
new mframe_t(ai_move, 3, null),
new mframe_t(ai_move, 3, null),
new mframe_t(ai_move, 2, null),
new mframe_t(ai_move, 1, null),
new mframe_t(ai_move, 1, null),
new mframe_t(ai_move, 6, null),
new mframe_t(ai_move, 3, null),
new mframe_t(ai_move, 2, null),
new mframe_t(ai_move, 0, null),
new mframe_t(ai_move, 1, null)};
static mmove_t mutant_move_pain3 = new mmove_t(FRAME_pain301, FRAME_pain311, mutant_frames_pain3, mutant_run);
static EntPainAdapter mutant_pain = new EntPainAdapter() {
public void pain(edict_t self, edict_t other, float kick, int damage) {
float r;
if (self.health < (self.max_health / 2))
self.s.skinnum = 1;
if (level.time < self.pain_debounce_time)
return;
self.pain_debounce_time = level.time + 3;
if (skill.value == 3)
return; // no pain anims in nightmare
r = Lib.random();
if (r < 0.33) {
gi.sound(self, CHAN_VOICE, sound_pain1, 1, ATTN_NORM, 0);
self.monsterinfo.currentmove = mutant_move_pain1;
} else if (r < 0.66) {
gi.sound(self, CHAN_VOICE, sound_pain2, 1, ATTN_NORM, 0);
self.monsterinfo.currentmove = mutant_move_pain2;
} else {
gi.sound(self, CHAN_VOICE, sound_pain1, 1, ATTN_NORM, 0);
self.monsterinfo.currentmove = mutant_move_pain3;
}
}
};
//
// DEATH
//
static EntThinkAdapter mutant_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;
gi.linkentity(self);
M.M_FlyCheck.think(self);
return true;
}
};
static mframe_t mutant_frames_death1[] =
new mframe_t[] {
new mframe_t(ai_move, 0, null),
new mframe_t(ai_move, 0, null),
new mframe_t(ai_move, 0, null),
new mframe_t(ai_move, 0, null),
new mframe_t(ai_move, 0, null),
new mframe_t(ai_move, 0, null),
new mframe_t(ai_move, 0, null),
new mframe_t(ai_move, 0, null),
new mframe_t(ai_move, 0, null)};
static mmove_t mutant_move_death1 = new mmove_t(FRAME_death101, FRAME_death109, mutant_frames_death1, mutant_dead);
static mframe_t mutant_frames_death2[] =
new mframe_t[] {
new mframe_t(ai_move, 0, null),
new mframe_t(ai_move, 0, null),
new mframe_t(ai_move, 0, null),
new mframe_t(ai_move, 0, null),
new mframe_t(ai_move, 0, null),
new mframe_t(ai_move, 0, null),
new mframe_t(ai_move, 0, null),
new mframe_t(ai_move, 0, null),
new mframe_t(ai_move, 0, null),
new mframe_t(ai_move, 0, null)};
static mmove_t mutant_move_death2 = new mmove_t(FRAME_death201, FRAME_death210, mutant_frames_death2, mutant_dead);
static EntDieAdapter mutant_die = new EntDieAdapter() {
public void die(edict_t self, edict_t inflictor, edict_t attacker, int damage, float[] point) {
int n;
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;
gi.sound(self, CHAN_VOICE, sound_death, 1, ATTN_NORM, 0);
self.deadflag = DEAD_DEAD;
self.takedamage = DAMAGE_YES;
self.s.skinnum = 1;
if (Lib.random() < 0.5)
self.monsterinfo.currentmove = mutant_move_death1;
else
self.monsterinfo.currentmove = mutant_move_death2;
}
};
//
// SPAWN
//
/*QUAKED monster_mutant (1 .5 0) (-32 -32 -24) (32 32 32) Ambush Trigger_Spawn Sight
*/
static EntThinkAdapter SP_monster_mutant = new EntThinkAdapter() {
public boolean think(edict_t self) {
if (deathmatch.value!=0) {
G_FreeEdict(self);
return false;
}
sound_swing = gi.soundindex("mutant/mutatck1.wav");
sound_hit = gi.soundindex("mutant/mutatck2.wav");
sound_hit2 = gi.soundindex("mutant/mutatck3.wav");
sound_death = gi.soundindex("mutant/mutdeth1.wav");
sound_idle = gi.soundindex("mutant/mutidle1.wav");
sound_pain1 = gi.soundindex("mutant/mutpain1.wav");
sound_pain2 = gi.soundindex("mutant/mutpain2.wav");
sound_sight = gi.soundindex("mutant/mutsght1.wav");
sound_search = gi.soundindex("mutant/mutsrch1.wav");
sound_step1 = gi.soundindex("mutant/step1.wav");
sound_step2 = gi.soundindex("mutant/step2.wav");
sound_step3 = gi.soundindex("mutant/step3.wav");
sound_thud = gi.soundindex("mutant/thud1.wav");
self.movetype = MOVETYPE_STEP;
self.solid = SOLID_BBOX;
self.s.modelindex = gi.modelindex("models/monsters/mutant/tris.md2");
Math3D.VectorSet(self.mins, -32, -32, -24);
Math3D.VectorSet(self.maxs, 32, 32, 48);
self.health = 300;
self.gib_health = -120;
self.mass = 300;
self.pain = mutant_pain;
self.die = mutant_die;
self.monsterinfo.stand = mutant_stand;
self.monsterinfo.walk = mutant_walk;
self.monsterinfo.run = mutant_run;
self.monsterinfo.dodge = null;
self.monsterinfo.attack = mutant_jump;
self.monsterinfo.melee = mutant_melee;
self.monsterinfo.sight = mutant_sight;
self.monsterinfo.search = mutant_search;
self.monsterinfo.idle = mutant_idle;
self.monsterinfo.checkattack = mutant_checkattack;
gi.linkentity(self);
self.monsterinfo.currentmove = mutant_move_stand;
self.monsterinfo.scale = MODEL_SCALE;
walkmonster_start.think(self);
return true;
}
};
}
|