-
Notifications
You must be signed in to change notification settings - Fork 2
/
infantry.qc
792 lines (691 loc) · 18.8 KB
/
infantry.qc
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
#ifdef SINGLE_PLAYER
#include "m_infantry.h"
static int sound_pain1;
static int sound_pain2;
static int sound_die1;
static int sound_die2;
static int sound_gunshot;
static int sound_weapon_cock;
static int sound_punch_swing;
static int sound_punch_hit;
static int sound_sight;
static int sound_search;
static int sound_idle;
static const mframe_t infantry_frames_stand [] = {
{ ai_stand },
{ ai_stand },
{ ai_stand },
{ ai_stand },
{ ai_stand },
{ ai_stand },
{ ai_stand },
{ ai_stand },
{ ai_stand },
{ ai_stand },
{ ai_stand },
{ ai_stand },
{ ai_stand },
{ ai_stand },
{ ai_stand },
{ ai_stand },
{ ai_stand },
{ ai_stand },
{ ai_stand },
{ ai_stand },
{ ai_stand },
{ ai_stand }
};
static var mmove_t infantry_move_stand = { FRAME_stand50, FRAME_stand71 };
void(entity self) infantry_stand =
{
self.monsterinfo.currentmove = &infantry_move_stand;
}
static const mframe_t infantry_frames_fidget [] = {
{ ai_stand, 1 },
{ ai_stand, 0 },
{ ai_stand, 1 },
{ ai_stand, 3 },
{ ai_stand, 6 },
{ ai_stand, 3 },
{ ai_stand, 0 },
{ ai_stand, 0 },
{ ai_stand, 0 },
{ ai_stand, 0 },
{ ai_stand, 1 },
{ ai_stand, 0 },
{ ai_stand, 0 },
{ ai_stand, 0 },
{ ai_stand, 0 },
{ ai_stand, 1 },
{ ai_stand, 0 },
{ ai_stand, -1 },
{ ai_stand, 0 },
{ ai_stand, 0 },
{ ai_stand, 1 },
{ ai_stand, 0 },
{ ai_stand, -2 },
{ ai_stand, 1 },
{ ai_stand, 1 },
{ ai_stand, 1 },
{ ai_stand, -1 },
{ ai_stand, 0 },
{ ai_stand, 0 },
{ ai_stand, -1 },
{ ai_stand, 0 },
{ ai_stand, 0 },
{ ai_stand, 0 },
{ ai_stand, 0 },
{ ai_stand, 0 },
{ ai_stand, -1 },
{ ai_stand, 0 },
{ ai_stand, 0 },
{ ai_stand, 1 },
{ ai_stand, 0 },
{ ai_stand, 0 },
{ ai_stand, -1 },
{ ai_stand, -1 },
{ ai_stand, 0 },
{ ai_stand, -3 },
{ ai_stand, -2 },
{ ai_stand, -3 },
{ ai_stand, -3 },
{ ai_stand, -2 }
};
static var mmove_t infantry_move_fidget = { FRAME_stand01, FRAME_stand49, infantry_stand };
static void(entity self) infantry_fidget =
{
self.monsterinfo.currentmove = &infantry_move_fidget;
gi.sound(self, CHAN_VOICE, sound_idle, 1, ATTN_IDLE, 0);
}
static const mframe_t infantry_frames_walk [] = {
{ ai_walk, 5 },
{ ai_walk, 4 },
{ ai_walk, 4 },
{ ai_walk, 5 },
{ ai_walk, 4 },
{ ai_walk, 5 },
{ ai_walk, 6 },
{ ai_walk, 4 },
{ ai_walk, 4 },
{ ai_walk, 4 },
{ ai_walk, 4 },
{ ai_walk, 5 }
};
static var mmove_t infantry_move_walk = { FRAME_walk03, FRAME_walk14 };
static void(entity self) infantry_walk =
{
self.monsterinfo.currentmove = &infantry_move_walk;
}
static const mframe_t infantry_frames_run [] = {
{ ai_run, 10 },
{ ai_run, 20 },
{ ai_run, 5 },
{ ai_run, 7
#ifdef GROUND_ZERO
, monster_done_dodge
#endif
},
{ ai_run, 30 },
{ ai_run, 35 },
{ ai_run, 2 },
{ ai_run, 6 }
};
static var mmove_t infantry_move_run = { FRAME_run01, FRAME_run08 };
static void(entity self) infantry_run =
{
#ifdef GROUND_ZERO
monster_done_dodge(self);
#endif
if (self.monsterinfo.aiflags & AI_STAND_GROUND)
self.monsterinfo.currentmove = &infantry_move_stand;
else
self.monsterinfo.currentmove = &infantry_move_run;
}
static const mframe_t infantry_frames_pain1 [] = {
{ ai_move, -3 },
{ ai_move, -2 },
{ ai_move, -1 },
{ ai_move, -2 },
{ ai_move, -1 },
{ ai_move, 1 },
{ ai_move, -1 },
{ ai_move, 1 },
{ ai_move, 6 },
{ ai_move, 2 }
};
static var mmove_t infantry_move_pain1 = { FRAME_pain101, FRAME_pain110, infantry_run };
static const mframe_t infantry_frames_pain2 [] = {
{ ai_move, -3 },
{ ai_move, -3 },
{ ai_move, 0 },
{ ai_move, -1 },
{ ai_move, -2 },
{ ai_move, 0 },
{ ai_move, 0 },
{ ai_move, 2 },
{ ai_move, 5 },
{ ai_move, 2 }
};
static var mmove_t infantry_move_pain2 = { FRAME_pain201, FRAME_pain210, infantry_run };
static void(entity self, entity other, float kick, int damage) infantry_pain =
{
int n;
if (self.health < (self.max_health / 2))
self.s.skinnum = 1;
#ifdef GROUND_ZERO
monster_done_dodge (self);
#endif
if (level.framenum < self.pain_debounce_framenum)
return;
self.pain_debounce_framenum = level.framenum + 3 * BASE_FRAMERATE;
if (skill.intVal == 3)
return; // no pain anims in nightmare
n = Q_rand() % 2;
if (n == 0) {
self.monsterinfo.currentmove = &infantry_move_pain1;
gi.sound(self, CHAN_VOICE, sound_pain1, 1, ATTN_NORM, 0);
} else {
self.monsterinfo.currentmove = &infantry_move_pain2;
gi.sound(self, CHAN_VOICE, sound_pain2, 1, ATTN_NORM, 0);
}
#ifdef GROUND_ZERO
// PMM - clear duck flag
if (self.monsterinfo.aiflags & AI_DUCKED)
monster_duck_up(self);
#endif
}
static const vector aimangles[] = {
{ 0.0, 5.0, 0.0 },
{ 10.0, 15.0, 0.0 },
{ 20.0, 25.0, 0.0 },
{ 25.0, 35.0, 0.0 },
{ 30.0, 40.0, 0.0 },
{ 30.0, 45.0, 0.0 },
{ 25.0, 50.0, 0.0 },
{ 20.0, 40.0, 0.0 },
{ 15.0, 35.0, 0.0 },
{ 40.0, 35.0, 0.0 },
{ 70.0, 35.0, 0.0 },
{ 90.0, 35.0, 0.0 }
};
static void(entity self) InfantryMachineGun =
{
vector start = vec3_origin, target;
vector forward, right;
vector vec;
int flash_number;
#if defined(THE_RECKONING) || defined(GROUND_ZERO)
if (self.s.frame == FRAME_attak103) {
#else
if (self.s.frame == FRAME_attak111) {
#endif
flash_number = MZ2_INFANTRY_MACHINEGUN_1;
AngleVectors(self.s.angles, &forward, &right, 0);
start = G_ProjectSource(self.s.origin, monster_flash_offset[MZ2_INFANTRY_MACHINEGUN_1], forward, right);
if (self.enemy) {
target = self.enemy.s.origin + (-0.2f * self.enemy.velocity);
target.z += self.enemy.viewheight;
forward = target - start;
VectorNormalize(forward);
} else {
AngleVectors(self.s.angles, &forward, &right, 0);
}
} else {
flash_number = MZ2_INFANTRY_MACHINEGUN_2 + (self.s.frame - FRAME_death211);
AngleVectors(self.s.angles, &forward, &right, 0);
start = G_ProjectSource(self.s.origin, monster_flash_offset[flash_number], forward, right);
vec = self.s.angles - aimangles[(flash_number - MZ2_INFANTRY_MACHINEGUN_2)];
AngleVectors(vec, &forward, 0, 0);
}
monster_fire_bullet(self, start, forward, 3, 4, DEFAULT_BULLET_HSPREAD, DEFAULT_BULLET_VSPREAD, flash_number);
}
static void(entity self, entity other) infantry_sight =
{
gi.sound(self, CHAN_BODY, sound_sight, 1, ATTN_NORM, 0);
}
static void(entity self) infantry_dead =
{
self.mins = '-16 -16 -24';
self.maxs = '16 16 -8';
self.movetype = MOVETYPE_TOSS;
self.svflags |= SVF_DEADMONSTER;
gi.linkentity(self);
M_FlyCheck(self);
}
static const mframe_t infantry_frames_death1 [] = {
{ ai_move, -4 },
{ ai_move, 0, },
{ ai_move, 0, },
{ ai_move, -1 },
{ ai_move, -4 },
{ ai_move, 0 },
{ ai_move, 0 },
{ ai_move, 0 },
{ ai_move, -1 },
{ ai_move, 3 },
{ ai_move, 1 },
{ ai_move, 1 },
{ ai_move, -2 },
{ ai_move, 2 },
{ ai_move, 2 },
{ ai_move, 9 },
{ ai_move, 9 },
{ ai_move, 5 },
{ ai_move, -3 },
{ ai_move, -3 }
};
static var mmove_t infantry_move_death1 = { FRAME_death101, FRAME_death120, infantry_dead };
// Off with his head
static const mframe_t infantry_frames_death2 [] = {
{ ai_move, 0 },
{ ai_move, 1 },
{ ai_move, 5 },
{ ai_move, -1 },
{ ai_move, 0 },
{ ai_move, 1 },
{ ai_move, 1 },
{ ai_move, 4 },
{ ai_move, 3 },
{ ai_move, 0 },
{ ai_move, -2, InfantryMachineGun },
{ ai_move, -2, InfantryMachineGun },
{ ai_move, -3, InfantryMachineGun },
{ ai_move, -1, InfantryMachineGun },
{ ai_move, -2, InfantryMachineGun },
{ ai_move, 0, InfantryMachineGun },
{ ai_move, 2, InfantryMachineGun },
{ ai_move, 2, InfantryMachineGun },
{ ai_move, 3, InfantryMachineGun },
{ ai_move, -10, InfantryMachineGun },
{ ai_move, -7, InfantryMachineGun },
{ ai_move, -8, InfantryMachineGun },
{ ai_move, -6 },
{ ai_move, 4 },
{ ai_move, 0 }
};
static var mmove_t infantry_move_death2 = { FRAME_death201, FRAME_death225, infantry_dead };
static const mframe_t infantry_frames_death3 [] = {
{ ai_move, 0 },
{ ai_move, 0 },
{ ai_move, 0 },
{ ai_move, -6 },
{ ai_move, -11 },
{ ai_move, -3 },
{ ai_move, -11 },
{ ai_move, 0 },
{ ai_move, 0 }
};
static var mmove_t infantry_move_death3 = { FRAME_death301, FRAME_death309, infantry_dead };
void(entity self, entity inflictor, entity attacker, int damage, vector point) infantry_die =
{
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
self.deadflag = DEAD_DEAD;
self.takedamage = true;
n = Q_rand() % 3;
if (n == 0) {
self.monsterinfo.currentmove = &infantry_move_death1;
gi.sound(self, CHAN_VOICE, sound_die2, 1, ATTN_NORM, 0);
} else if (n == 1) {
self.monsterinfo.currentmove = &infantry_move_death2;
gi.sound(self, CHAN_VOICE, sound_die1, 1, ATTN_NORM, 0);
} else {
self.monsterinfo.currentmove = &infantry_move_death3;
gi.sound(self, CHAN_VOICE, sound_die2, 1, ATTN_NORM, 0);
}
}
#ifdef GROUND_ZERO
#define infantry_duck_down monster_duck_down
#define infantry_duck_hold monster_duck_hold
#define infantry_duck_up monster_duck_up
#else
static void(entity self) infantry_duck_down =
{
if (self.monsterinfo.aiflags & AI_DUCKED)
return;
self.monsterinfo.aiflags |= AI_DUCKED;
self.maxs.z -= 32;
self.takedamage = true;
self.monsterinfo.pause_framenum = level.framenum + 1 * BASE_FRAMERATE;
gi.linkentity(self);
}
static void(entity self) infantry_duck_hold =
{
if (level.framenum >= self.monsterinfo.pause_framenum)
self.monsterinfo.aiflags &= ~AI_HOLD_FRAME;
else
self.monsterinfo.aiflags |= AI_HOLD_FRAME;
}
static void(entity self) infantry_duck_up =
{
self.monsterinfo.aiflags &= ~AI_DUCKED;
self.maxs.z += 32;
self.takedamage = true;
gi.linkentity(self);
}
#endif
static mframe_t infantry_frames_duck [] = {
{ ai_move, -2, infantry_duck_down },
{ ai_move, -5, infantry_duck_hold },
{ ai_move, 3 },
{ ai_move, 4, infantry_duck_up },
{ ai_move, 0 }
};
static var mmove_t infantry_move_duck = { FRAME_duck01, FRAME_duck05, infantry_run };
#ifndef GROUND_ZERO
static void(entity self, entity attacker, float eta) infantry_dodge =
{
if (random() > 0.25f)
return;
if (!self.enemy)
self.enemy = attacker;
self.monsterinfo.currentmove = &infantry_move_duck;
}
#endif
#if defined(THE_RECKONING) || defined(GROUND_ZERO)
static void(entity self) infantry_set_firetime =
{
int n;
n = (Q_rand() & 15) + 5;
self.monsterinfo.pause_framenum = level.framenum + n;
}
static void(entity self) infantry_cock_gun =
{
gi.sound (self, CHAN_WEAPON, sound_weapon_cock, 1, ATTN_NORM, 0);
}
#else
static void(entity self) infantry_cock_gun =
{
int n;
gi.sound(self, CHAN_WEAPON, sound_weapon_cock, 1, ATTN_NORM, 0);
n = (Q_rand() & 15) + 3 + 7;
self.monsterinfo.pause_framenum = level.framenum + n;
}
#endif
static void(entity self) infantry_fire =
{
InfantryMachineGun(self);
if (level.framenum >= self.monsterinfo.pause_framenum)
self.monsterinfo.aiflags &= ~AI_HOLD_FRAME;
else
self.monsterinfo.aiflags |= AI_HOLD_FRAME;
}
static mframe_t infantry_frames_attack1 [] = {
#if defined(THE_RECKONING) || defined(GROUND_ZERO)
{ ai_charge, 10, infantry_set_firetime },
{ ai_charge, 6 },
{ ai_charge, 0, infantry_fire },
{ ai_charge, 0 },
{ ai_charge, 1 },
{ ai_charge, -7 },
{ ai_charge, -6 },
{ ai_charge, -1 },
{ ai_charge, 0, infantry_cock_gun },
{ ai_charge },
{ ai_charge },
{ ai_charge },
{ ai_charge },
{ ai_charge, -1 },
{ ai_charge, -1 }
#else
{ ai_charge, 4 },
{ ai_charge, -1 },
{ ai_charge, -1 },
{ ai_charge, 0, infantry_cock_gun },
{ ai_charge, -1 },
{ ai_charge, 1 },
{ ai_charge, 1 },
{ ai_charge, 2 },
{ ai_charge, -2 },
{ ai_charge, -3 },
{ ai_charge, 1, infantry_fire },
{ ai_charge, 5 },
{ ai_charge, -1 },
{ ai_charge, -2 },
{ ai_charge, -3 }
#endif
};
static var mmove_t infantry_move_attack1 = { FRAME_attak101, FRAME_attak115, infantry_run };
static void(entity self) infantry_swing =
{
gi.sound(self, CHAN_WEAPON, sound_punch_swing, 1, ATTN_NORM, 0);
}
static void(entity self) infantry_smack =
{
static const vector aim = [ MELEE_DISTANCE, 0, 0 ];
if (fire_hit(self, aim, (5 + (Q_rand() % 5)), 50))
gi.sound(self, CHAN_WEAPON, sound_punch_hit, 1, ATTN_NORM, 0);
}
static mframe_t infantry_frames_attack2 [] = {
{ ai_charge, 3 },
{ ai_charge, 6 },
{ ai_charge, 0, infantry_swing },
{ ai_charge, 8 },
{ ai_charge, 5 },
{ ai_charge, 8, infantry_smack },
{ ai_charge, 6 },
{ ai_charge, 3 },
};
static var mmove_t infantry_move_attack2 = { FRAME_attak201, FRAME_attak208, infantry_run };
static void(entity self) infantry_attack =
{
#ifdef GROUND_ZERO
monster_done_dodge (self);
#endif
if (range(self, self.enemy) == RANGE_MELEE)
self.monsterinfo.currentmove = &infantry_move_attack2;
else
self.monsterinfo.currentmove = &infantry_move_attack1;
}
#ifdef GROUND_ZERO
static void infantry_jump_now (entity self)
{
vector forward,up;
monster_jump_start (self);
AngleVectors (self.s.angles, &forward, 0, &up);
self.velocity += forward * 100;
self.velocity += up * 300;
}
static void infantry_jump2_now (entity self)
{
vector forward,up;
monster_jump_start (self);
AngleVectors (self.s.angles, &forward, 0, &up);
self.velocity += forward * 150;
self.velocity += up * 400;
}
static void infantry_jump_wait_land (entity self)
{
if(self.groundentity == null_entity)
{
self.monsterinfo.nextframe = self.s.frame;
if (monster_jump_finished (self))
self.monsterinfo.nextframe = self.s.frame + 1;
}
else
self.monsterinfo.nextframe = self.s.frame + 1;
}
static mframe_t infantry_frames_jump [] =
{
{ ai_move },
{ ai_move },
{ ai_move },
{ ai_move, 0, infantry_jump_now },
{ ai_move },
{ ai_move },
{ ai_move },
{ ai_move, 0, infantry_jump_wait_land },
{ ai_move },
{ ai_move }
};
static var mmove_t infantry_move_jump = { FRAME_jump01, FRAME_jump10, infantry_run };
static mframe_t infantry_frames_jump2 [] =
{
{ ai_move, -8 },
{ ai_move, -4 },
{ ai_move, -4 },
{ ai_move, 0, infantry_jump_now },
{ ai_move },
{ ai_move },
{ ai_move },
{ ai_move, 0, infantry_jump_wait_land },
{ ai_move },
{ ai_move }
};
static var mmove_t infantry_move_jump2 = { FRAME_jump01, FRAME_jump10, infantry_run };
static void infantry_jump (entity self)
{
if(!self.enemy)
return;
monster_done_dodge(self);
if(self.enemy.s.origin[2] > self.s.origin[2])
self.monsterinfo.currentmove = &infantry_move_jump2;
else
self.monsterinfo.currentmove = &infantry_move_jump;
}
static bool infantry_blocked (entity self, float dist)
{
if (blocked_checkshot (self, 0.25 + (0.05 * skill.intVal)))
return true;
if (blocked_checkjump (self, dist, 192, 40))
{
infantry_jump(self);
return true;
}
if (blocked_checkplat (self, dist))
return true;
return false;
}
static void infantry_duck (entity self, float eta)
{
// if we're jumping, don't dodge
if ((self.monsterinfo.currentmove == &infantry_move_jump) ||
(self.monsterinfo.currentmove == &infantry_move_jump2))
{
return;
}
if ((self.monsterinfo.currentmove == &infantry_move_attack1) ||
(self.monsterinfo.currentmove == &infantry_move_attack2))
{
// if we're shooting, and not on easy, don't dodge
if (skill.intVal)
{
self.monsterinfo.aiflags &= ~AI_DUCKED;
return;
}
}
if (skill.intVal == 0)
// PMM - stupid dodge
self.monsterinfo.duck_wait_framenum = level.framenum + (int)((eta + 1) * BASE_FRAMERATE);
else
self.monsterinfo.duck_wait_framenum = level.framenum + (int)((eta + (0.1 * (3 - skill.intVal))) * BASE_FRAMERATE);
// has to be done immediately otherwise he can get stuck
monster_duck_down(self);
self.monsterinfo.nextframe = FRAME_duck01;
self.monsterinfo.currentmove = &infantry_move_duck;
}
static void infantry_sidestep (entity self)
{
// if we're jumping, don't dodge
if ((self.monsterinfo.currentmove == &infantry_move_jump) ||
(self.monsterinfo.currentmove == &infantry_move_jump2))
{
return;
}
if ((self.monsterinfo.currentmove == &infantry_move_attack1) ||
(self.monsterinfo.currentmove == &infantry_move_attack2))
{
// if we're shooting, and not on easy, don't dodge
if (skill.intVal)
{
self.monsterinfo.aiflags &= ~AI_DODGING;
return;
}
}
if (self.monsterinfo.currentmove != &infantry_move_run)
self.monsterinfo.currentmove = &infantry_move_run;
}
#endif
/*QUAKED monster_infantry (1 .5 0) (-16 -16 -24) (16 16 32) Ambush Trigger_Spawn Sight
*/
API_FUNC static void(entity self) SP_monster_infantry =
{
if (deathmatch.intVal) {
G_FreeEdict(self);
return;
}
if (!infantry_move_stand.frame)
{
infantry_move_stand.frame = &infantry_frames_stand;
infantry_move_fidget.frame = &infantry_frames_fidget;
infantry_move_walk.frame = &infantry_frames_walk;
infantry_move_run.frame = &infantry_frames_run;
infantry_move_pain1.frame = &infantry_frames_pain1;
infantry_move_pain2.frame = &infantry_frames_pain2;
infantry_move_death1.frame = &infantry_frames_death1;
infantry_move_death2.frame = &infantry_frames_death2;
infantry_move_death3.frame = &infantry_frames_death3;
infantry_move_duck.frame = &infantry_frames_duck;
infantry_move_attack1.frame = &infantry_frames_attack1;
infantry_move_attack2.frame = &infantry_frames_attack2;
#ifdef GROUND_ZERO
infantry_move_jump.frame = &infantry_frames_jump;
infantry_move_jump2.frame = &infantry_frames_jump2;
#endif
}
sound_pain1 = gi.soundindex("infantry/infpain1.wav");
sound_pain2 = gi.soundindex("infantry/infpain2.wav");
sound_die1 = gi.soundindex("infantry/infdeth1.wav");
sound_die2 = gi.soundindex("infantry/infdeth2.wav");
sound_gunshot = gi.soundindex("infantry/infatck1.wav");
sound_weapon_cock = gi.soundindex("infantry/infatck3.wav");
sound_punch_swing = gi.soundindex("infantry/infatck2.wav");
sound_punch_hit = gi.soundindex("infantry/melee2.wav");
sound_sight = gi.soundindex("infantry/infsght1.wav");
sound_search = gi.soundindex("infantry/infsrch1.wav");
sound_idle = gi.soundindex("infantry/infidle1.wav");
self.movetype = MOVETYPE_STEP;
self.solid = SOLID_BBOX;
self.s.modelindex = gi.modelindex("models/monsters/infantry/tris.md2");
self.mins = '-16 -16 -24';
self.maxs = '16 16 32';
self.health = 100;
self.gib_health = -40;
self.mass = 200;
self.pain = infantry_pain;
self.die = infantry_die;
self.monsterinfo.stand = infantry_stand;
self.monsterinfo.walk = infantry_walk;
self.monsterinfo.run = infantry_run;
#ifdef GROUND_ZERO
self.monsterinfo.dodge = M_MonsterDodge;
self.monsterinfo.duck = infantry_duck;
self.monsterinfo.unduck = monster_duck_up;
self.monsterinfo.sidestep = infantry_sidestep;
self.monsterinfo.blocked = infantry_blocked;
#else
self.monsterinfo.dodge = infantry_dodge;
#endif
self.monsterinfo.attack = infantry_attack;
self.monsterinfo.melee = 0;
self.monsterinfo.sight = infantry_sight;
self.monsterinfo.idle = infantry_fidget;
gi.linkentity(self);
self.monsterinfo.currentmove = &infantry_move_stand;
self.monsterinfo.scale = MODEL_SCALE;
walkmonster_start(self);
}
#endif