forked from EmeraldTiger/Re-Mobilize
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ogre.qc
1573 lines (1352 loc) · 45.8 KB
/
ogre.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
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
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
float MONSTER_FLAK_OGRE = 4;
float FL_NOSELECT = 8192; //ignored by entity selector
.float spikecount; //bdw - saves up flak hits to do a single damage next frame - currently only used for flak ogre
/*
==============================================================================
OGRE
==============================================================================
*/
$cd id1/models/ogre_c
$origin 0 0 24
$base base
$skin base
$frame stand1 stand2 stand3 stand4 stand5 stand6 stand7 stand8 stand9
$frame walk1 walk2 walk3 walk4 walk5 walk6 walk7
$frame walk8 walk9 walk10 walk11 walk12 walk13 walk14 walk15 walk16
$frame run1 run2 run3 run4 run5 run6 run7 run8
$frame swing1 swing2 swing3 swing4 swing5 swing6 swing7
$frame swing8 swing9 swing10 swing11 swing12 swing13 swing14
$frame smash1 smash2 smash3 smash4 smash5 smash6 smash7
$frame smash8 smash9 smash10 smash11 smash12 smash13 smash14
$frame shoot1 shoot2 shoot3 shoot4 shoot5 shoot6
$frame pain1 pain2 pain3 pain4 pain5
$frame painb1 painb2 painb3
$frame painc1 painc2 painc3 painc4 painc5 painc6
$frame paind1 paind2 paind3 paind4 paind5 paind6 paind7 paind8 paind9 paind10
$frame paind11 paind12 paind13 paind14 paind15 paind16
$frame paine1 paine2 paine3 paine4 paine5 paine6 paine7 paine8 paine9 paine10
$frame paine11 paine12 paine13 paine14 paine15
$frame death1 death2 death3 death4 death5 death6
$frame death7 death8 death9 death10 death11 death12
$frame death13 death14
$frame bdeath1 bdeath2 bdeath3 bdeath4 bdeath5 bdeath6
$frame bdeath7 bdeath8 bdeath9 bdeath10
$frame pull1 pull2 pull3 pull4 pull5 pull6 pull7 pull8 pull9 pull10 pull11
//=============================================================================
void() OgreGrenadeExplode =
{
T_RadiusDamage (self, self.owner, 40, world);
sound (self, CHAN_VOICE, "weapons/r_exp3.wav", 1, ATTN_NORM);
WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
WriteByte (MSG_BROADCAST, TE_EXPLOSION);
WriteCoord (MSG_BROADCAST, self.origin_x);
WriteCoord (MSG_BROADCAST, self.origin_y);
WriteCoord (MSG_BROADCAST, self.origin_z);
self.velocity = '0 0 0';
self.touch = SUB_Null;
setmodel (self, "progs/s_explod.spr");
self.solid = SOLID_NOT;
s_explode1 ();
};
void() OgreGrenadeTouch =
{
if (other == self.owner)
return; // don't explode on owner
if (other.takedamage == DAMAGE_AIM)
{
OgreGrenadeExplode();
return;
}
if (self.count < time) {
sound (self, CHAN_VOICE, "weapons/bounce.wav", 1, ATTN_NORM); // bounce sound
}
self.count = time + .02;
if (self.velocity == '0 0 0')
self.avelocity = '0 0 0';
};
//BDW 31/08/00 - evil, nasty red-hot nail cluster-bomb attack... from Marcher -- dumptruck_ds
void() FlakDoDamage =
{
self.origin = self.oldenemy.origin + self.oldorigin; //get correct gib direction
T_Damage(self.oldenemy, self, self.owner, self.oldenemy.spikecount);
self.oldenemy.spikecount = 0;
remove(self);
};
void() FlakTouch =
{
if (other.solid == SOLID_TRIGGER)
return;
if (pointcontents(self.origin) == CONTENT_SKY)
{
remove(self);
return;
}
// hit something that bleeds
if (other.takedamage)
{
spawn_touchblood(self.dmg);
sound(self, CHAN_VOICE, "fish/bite.wav", 1, ATTN_NORM);
if (other.spikecount) //not the first one
{
other.spikecount = other.spikecount + self.dmg;
remove(self);
return;
}
// the first one...
other.spikecount = self.dmg;
// stick around for a little while...
self.velocity = '0 0 0';
self.solid = SOLID_NOT;
self.touch = SUB_Null;
self.model = string_null;
self.oldorigin = self.origin - other.origin; //displacement from enemy origin (its gonna move next frame)
self.oldenemy = other;
self.think = FlakDoDamage;
self.nextthink = time + 0.05;
return;
}
WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
WriteByte (MSG_BROADCAST, TE_SUPERSPIKE);
WriteCoord (MSG_BROADCAST, self.origin_x);
WriteCoord (MSG_BROADCAST, self.origin_y);
WriteCoord (MSG_BROADCAST, self.origin_z);
if (self.spawnflags & MONSTER_FLAK_OGRE) //bit of a hack
{
remove(self);
return;
}
self.dmg = self.dmg - 5; //gets weaker with each bounce. also stops them getting stuck in world.
if (self.dmg <= 0)
{
remove(self);
return;
}
self.velocity = self.velocity * 0.5; //reduce crazy ricochets
self.movetype = MOVETYPE_BOUNCE;
};
void() BDW_OgreFireFlak =
{
local float flakcount;
local vector dir, ang;
local entity flak;
local float projspeed = 800 * self.proj_speed_mod;
flakcount = 8;
self.effects = self.effects | EF_MUZZLEFLASH;
sound(self, CHAN_WEAPON, "weapons/spike2.wav", 1, ATTN_NORM);
// make angles out of the current displacement vector...
ang = vectoangles(self.enemy.origin - self.origin);
// then get the required components...
makevectors(ang);
while (flakcount > 0)
{
//tighter spread...
dir = v_forward*10 + crandom()*v_right + crandom()*v_up;
dir = normalize(dir);
// f*cking hack...is this a v_forward problem?
dir_z = dir_z * -1;
//dir = dir*1000;
//dir = dir*800;
flak = spawn();
flak.owner = self;
//flymissile is a bit too all-seeing for this gun...
flak.movetype = MOVETYPE_FLY;
//flak.movetype = MOVETYPE_FLYMISSILE;
flak.solid = SOLID_BBOX;
flak.flags = FL_NOSELECT;
flak.touch = FlakTouch;
flak.angles = vectoangles(dir);
SetSpeed(flak, dir, projspeed);
if (self.homing > 0)
{
SetupHoming(flak, projspeed);
}
else
{
flak.nextthink = time + 6;
flak.think = SUB_Remove;
}
flak.dmg = 4;
flak.spawnflags = MONSTER_FLAK_OGRE; //this is a hack to tell FlakTouch that it came from an ogre
// setmodel(flak, "progs/spike.mdl");
flak.skin = self.skin_proj; //dumptruck_ds
if (self.mdl_proj != "") // dumptruck_ds
{
setmodel (flak, self.mdl_proj);
}
else
{
setmodel (flak, "progs/spike.mdl");
}
if (!flak.skin_proj) // dumptruck_ds
{
flak.skin = self.skin_proj;
}
else
{
flak.skin = 0;
}
// dumptruck_ds - end
setsize(flak, '0 0 0', '0 0 0');
setorigin(flak, self.origin + '0 0 16');
flakcount = flakcount - 1;
}
};
/////////////////////////////////////////////////////////////
/* start Preach Ogre Marksman tutorial here -- dumptruck_ds*/
/////////////////////////////////////////////////////////////
//speed an ogre grenade is fired at
float OGRE_G_VEL = 600;
//fixme: get the correct gravity strength for the level
float pgrav = 800;
//a default angle to fire at if the enemy is too far away
float OGRE_DEFAULT_ELEVATION = 30;
//uses QuakeC builtins to calculate tan of angle
//WARNING: uses makevectors! This overwrites the v_forward... globals
float(float theta) tan =
{
local vector ang; //temporary used to calculate trig values
ang = '0 0 0';
ang_y = theta; //assign theta to the yaw to simplify reasoning
makevectors(ang);
return v_forward_y / v_forward_x;
}
//inverse tan function
//takes two parameters, numerator and denominator
//this copes better with denominator 0 and gets quadrant correct
float(float y, float x) atan2 =
{
local vector ang; //temporary used to calculate trig values
ang = '0 0 0';
ang_x = x;
ang_y = y;
return vectoyaw(ang);
}
float(float theta, vector dest) IterateElevation =
{
local float a, b, c; //constants in the equation to be solved
local vector ofs; //displacement we wish the projectile to travel
local float y, z; //horizontal and vertical components of ofs
local float tan_theta; //trig values of the angle theta
//calculate how far we are firing
ofs = dest - self.origin;
z = ofs_z;
ofs_z = 0;
y = vlen(ofs);
//find the coefficients of the quadratic in tan(theta)
a = 0.5 * pgrav * y * y / (OGRE_G_VEL * OGRE_G_VEL);
b = -y;
c = a + z;
//check if the destination is too far to reach
if(b*b < 4*a*c)
return OGRE_DEFAULT_ELEVATION;
//calculate the tan value of the given theta
tan_theta = tan(theta);
//reuse ang to create the improved firing direction
theta = atan2(a*tan_theta*tan_theta - c,
2*a*tan_theta + b);
//constrain the values to stop anything too mad happening
while(theta > 90)
theta = theta - 180;
return theta;
}
/*
================
PreachFireGrenade
================
*/
void(float elevation) PreachFireGrenade =
{
local entity missile;
local vector ang;
self.effects = self.effects | EF_MUZZLEFLASH;
sound (self, CHAN_WEAPON, "weapons/grenade.wav", 1, ATTN_NORM);
missile = spawn ();
missile.owner = self;
missile.movetype = MOVETYPE_BOUNCE;
missile.solid = SOLID_BBOX;
// set missile speed
ang = self.angles;
ang_x = -elevation;
makevectors (ang);
missile.velocity = v_forward * OGRE_G_VEL;
missile.avelocity = '300 300 300';
missile.angles = vectoangles(missile.velocity);
missile.touch = OgreGrenadeTouch;
// set missile duration
missile.nextthink = time + 2.5;
missile.think = OgreGrenadeExplode;
// setmodel (missile, "progs/grenade.mdl");
if (self.mdl_proj != "") // dumptruck_ds
{
setmodel (missile, self.mdl_proj);
}
else
{
setmodel (missile, "progs/grenade.mdl");
}
if (!missile.skin_proj) // dumptruck_ds
{
missile.skin = self.skin_proj;
}
else
{
missile.skin = 0;
}
setsize (missile, '0 0 0', '0 0 0');
setorigin (missile, self.origin);
};
// end Preach tutorial
/*
================
PreachFireZombie
for Z-Aware Zombies in Turret Mode only
================
*/
void(float elevation) PreachFireZombie =
{
local entity missile;
local vector ang;
// self.effects = self.effects | EF_MUZZLEFLASH;
sound_attack (self, CHAN_WEAPON, "zombie/z_shot1.wav", 1, ATTN_NORM);
missile = spawn ();
missile.owner = self;
missile.movetype = MOVETYPE_BOUNCE;
missile.solid = SOLID_BBOX;
// set missile speed
ang = self.angles;
ang_x = -elevation;
makevectors (ang);
missile.velocity = v_forward * OGRE_G_VEL;
missile.avelocity = '3000 1000 2000';
missile.angles = vectoangles(missile.velocity);
missile.touch = ZombieGrenadeTouch;
// set missile duration
missile.nextthink = time + 2.5;
missile.think = SUB_Remove;
// setmodel (missile, "progs/grenade.mdl");
if (self.mdl_proj != "") // dumptruck_ds
{
setmodel (missile, self.mdl_proj);
}
else
{
setmodel (missile, "progs/zom_gib.mdl");
}
if (!missile.skin_proj) // dumptruck_ds
{
missile.skin = self.skin_proj;
}
else
{
missile.skin = 0;
}
setsize (missile, '0 0 0', '0 0 0');
setorigin (missile, self.origin);
};
// end Preach tutorial
/*
================
OgreFireGrenade
================
*/
void() MultiGrenadeTouch;
void() MultiGrenadeExplode;
void() OgreFireGrenade =
{
local entity missile;
self.effects = self.effects | EF_MUZZLEFLASH;
sound (self, CHAN_WEAPON, "weapons/grenade.wav", 1, ATTN_NORM);
missile = spawn ();
missile.owner = self;
missile.movetype = MOVETYPE_BOUNCE;
missile.solid = SOLID_BBOX;
missile.skin = self.skin_proj; //dumptruck_ds
if (self.mdl_proj != "") // dumptruck_ds
{
setmodel (missile, self.mdl_proj);
}
else
{
setmodel (missile, "progs/grenade.mdl");
}
if (!missile.skin_proj) // dumptruck_ds
{
missile.skin = self.skin_proj;
}
else
{
missile.skin = 0;
}
// dumptruck_ds - end
// set missile speed
makevectors (self.angles);
missile.velocity = normalize(self.enemy.origin - self.origin);
missile.velocity = missile.velocity * 600;
missile.velocity_z = 200;
missile.avelocity = '300 300 300';
missile.angles = vectoangles(missile.velocity);
// set missile duration
if(self.style == 3)
{
missile.touch = MultiGrenadeTouch;
missile.nextthink = time + 2.5;
missile.think = MultiGrenadeExplode;
setmodel (missile, "progs/mervup.mdl");
setsize (missile, '0 0 0', '0 0 0');
setorigin (missile, self.origin);
missile.classname = "MultiGrenade";
}
else
{
missile.touch = OgreGrenadeTouch;
missile.nextthink = time + 2.5;
missile.think = OgreGrenadeExplode;
// setmodel (missile, "progs/grenade.mdl");
setsize (missile, '0 0 0', '0 0 0');
setorigin (missile, self.origin);
}
};
// missile.touch = OgreGrenadeTouch;
// // set missile duration
// missile.nextthink = time + 2.5;
// missile.think = OgreGrenadeExplode;
//
// setmodel (missile, "progs/grenade.mdl");
// setsize (missile, '0 0 0', '0 0 0');
// setorigin (missile, self.origin);
// };
/*
================
OgreFireSpike from insideqc tutorial here: http://www.insideqc.com/qctut/lesson-33.shtml
================
*/
void() OgreFireSpike =
{
local vector dir;
// local entity old;
sound (self, CHAN_WEAPON, "weapons/spike2.wav", 1, ATTN_NORM);
self.attack_finished = time + .7;
// self.attack_finished = time + 0.2;
self.effects = self.effects | EF_MUZZLEFLASH; // -- dumptruck_ds
dir = normalize (self.enemy.origin - self.origin);
launch_spike (self.origin + v_right * 4 + '0 0 16', dir);
newmis.touch = superduperspike_touch; //dumptruck_ds found in client.qc
// setmodel (newmis, "progs/lspike.mdl");
newmis.skin = self.skin_proj; //dumptruck_ds
if (self.mdl_proj != "") // dumptruck_ds
{
setmodel (newmis, self.mdl_proj);
}
else
{
setmodel (newmis, "progs/lspike.mdl");
}
if (!newmis.skin_proj) // dumptruck_ds
{
newmis.skin = self.skin_proj;
}
else
{
newmis.skin = 0;
}
// dumptruck_ds - end
setsize (newmis, VEC_ORIGIN, VEC_ORIGIN);
};
//=============================================================================
// Multi Grenade Code from doe progs MULT_WPN.QC -- dumptruck_ds
//=============================================================================
void() MultiGrenadeTouch;
//================================
//================================
void() MiniGrenadeExplode =
{
if ( self.owner.classname == "player")
T_RadiusDamage (self, self.owner, 90, world);
else
T_RadiusDamage (self, self.owner, 60, world);
WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
WriteByte (MSG_BROADCAST, TE_EXPLOSION2);
WriteCoord (MSG_BROADCAST, self.origin_x);
WriteCoord (MSG_BROADCAST, self.origin_y);
WriteCoord (MSG_BROADCAST, self.origin_z);
WriteByte (MSG_BROADCAST, 230);
WriteByte (MSG_BROADCAST, 5);
BecomeExplosion ();
};
//================================
//================================
void(float offsetAngle) MiniGrenadeLaunch =
{
local entity missile/*, mpuff*/;
local float tempRand;
missile = spawn ();
missile.owner = self.owner;
missile.movetype = MOVETYPE_BOUNCE;
missile.solid = SOLID_BBOX;
missile.classname = "MiniGrenade";
// set missile speed
missile.v_angle = self.v_angle;
missile.v_angle_y = missile.v_angle_y + offsetAngle;
makevectors (missile.v_angle);
missile.velocity = v_forward*100 + v_up*400;
tempRand = (crandom()*60) - 30;
missile.velocity = missile.velocity + tempRand * v_forward;
tempRand = (crandom()*40) - 20;
missile.velocity = missile.velocity + tempRand * v_right;
tempRand = (crandom()*60) - 30;
missile.velocity = missile.velocity + tempRand * v_up;
missile.avelocity = '300 300 300';
missile.angles = vectoangles(missile.velocity);
missile.touch = MultiGrenadeTouch;
setmodel (missile, "progs/mervup.mdl");
setsize (missile, '0 0 0', '0 0 0');
setorigin (missile, self.origin);
// set missile duration
missile.nextthink = time + 1 + (crandom() * 0.5);
missile.think = MiniGrenadeExplode;
};
//================================
//================================
void() MultiGrenadeExplode =
{
MiniGrenadeLaunch(0);
MiniGrenadeLaunch(72);
MiniGrenadeLaunch(144);
MiniGrenadeLaunch(216);
MiniGrenadeLaunch(288);
remove (self);
};
//================================
//================================
void() MultiGrenadeTouch =
{
if (other == self.owner)
return; // don't explode on owner
if (other.takedamage == DAMAGE_AIM)
{
if (self.classname == "MiniGrenade")
MiniGrenadeExplode();
else
{
if (self.owner.classname == "player")
GrenadeExplode();
else
MiniGrenadeExplode();
}
return;
}
// bounce sound
sound (self, CHAN_WEAPON, "weapons/bounce.wav", 1, ATTN_NORM);
if (self.velocity == '0 0 0')
self.avelocity = '0 0 0';
};
//================================
//================================
void() W_FireMultiGrenade =
{
local entity missile/*, mpuff*/;
// self.currentammo = self.ammo_multi_rockets = self.ammo_multi_rockets - 1;
// UpdateAmmoCounts (self);
sound (self, CHAN_WEAPON, "weapons/grenade.wav", 1, ATTN_NORM);
// self.punchangle_x = -2;
missile = spawn ();
missile.owner = self;
missile.movetype = MOVETYPE_BOUNCE;
missile.solid = SOLID_BBOX;
missile.classname = "MultiGrenade";
makevectors (self.angles);
missile.velocity = normalize(self.enemy.origin - self.origin);
missile.velocity = missile.velocity * 600;
missile.velocity_z = 200;
missile.avelocity = '300 300 300';
missile.angles = vectoangles(missile.velocity);
// set missile speed
// makevectors (self.v_angle);
// if (self.v_angle_x)
// missile.velocity = v_forward*600 + v_up * 200 + crandom()*v_right*10 + crandom()*v_up*10;
// else
// {
// missile.velocity = aim(self, 10000);
// missile.velocity = missile.velocity * 600;
// missile.velocity_z = 200;
// }
//
// missile.avelocity = '300 300 300';
// missile.angles = vectoangles(missile.velocity);
missile.touch = MultiGrenadeTouch;
// set missile duration
missile.nextthink = time + 1;
missile.think = MultiGrenadeExplode;
setmodel (missile, "progs/mervup.mdl");
missile.skin = self.skin_proj; //dumptruck_ds
setsize (missile, '0 0 0', '0 0 0');
setorigin (missile, self.origin + '0 0 16');
};
//=============================================================================
//end doe qc -- dumptruck_ds
//=============================================================================
/*
================
OgreFireLavaBall by jaycie erysdren 2021-09-14
================
*/
void() OgreFireLavaBall =
{
local vector offang;
local vector org, vec, d;
// local float t;
offang = vectoangles (self.enemy.origin - self.origin);
makevectors (offang);
org = self.origin; // + p_x*v_forward + p_y*v_right + p_z*'0 0 1';
// lead the player on hard mode
// if (skill > 1)
// {
// t = vlen(self.enemy.origin - org) / 300;
// vec = self.enemy.velocity;
// vec_z = 0;
// d = self.enemy.origin + t * vec;
// }
// else
// {
d = self.enemy.origin;
// }
vec = normalize (d - org);
// launch_spike (org, vec);
launch_spike2 (self.origin + v_right * 4 + '0 0 16', vec, 600);
self.effects = self.effects | EF_MUZZLEFLASH;
if (self.mdl_proj != "") // dumptruck_ds custom_mdls
{
setmodel (newmis, self.mdl_proj);
}
else
{
setmodel (newmis, "progs/lavaball.mdl");
}
if (!newmis.skin_proj) // dumptruck_ds
{
newmis.skin = self.skin_proj;
}
else
{
newmis.skin = 0;
}
newmis.avelocity = self.cust_avelocity;
if !(newmis.avelocity)
newmis.avelocity = '200 100 300';
setsize (newmis, VEC_ORIGIN, VEC_ORIGIN);
// newmis.touch = T_MissileTouch; // rocket explosion
newmis.touch = OgreGrenadeExplode;
sound_attack (self, CHAN_AUTO, "boss1/throw.wav", 1, ATTN_NORM);
};
/*
================
chainsaw
FIXME
================
*/
void(float side) chainsaw =
{
local vector delta;
local float ldmg;
if (!self.enemy)
return;
if (!CanDamage (self.enemy, self))
return;
ai_charge(10);
delta = self.enemy.origin - self.origin;
if (vlen(delta) > 100)
return;
ldmg = (random() + random() + random()) * 4;
T_Damage (self.enemy, self, self, ldmg);
if (side)
{
makevectors (self.angles);
if (side == 1)
SpawnMeatSpray (self.origin + v_forward*16, crandom() * 100 * v_right);
else
SpawnMeatSpray (self.origin + v_forward*16, side * v_right);
}
};
void() ogre_stand1 =[ $stand1, ogre_stand2 ] {ai_stand();};
void() ogre_stand2 =[ $stand2, ogre_stand3 ] {ai_stand();};
void() ogre_stand3 =[ $stand3, ogre_stand4 ] {ai_stand();};
void() ogre_stand4 =[ $stand4, ogre_stand5 ] {ai_stand();};
void() ogre_stand5 =[ $stand5, ogre_stand6 ] {
if (random() < 0.2)
sound_idle (self, CHAN_VOICE, "ogre/ogidle.wav", 1, ATTN_IDLE);
ai_stand();
};
void() ogre_stand6 =[ $stand6, ogre_stand7 ] {ai_stand();};
void() ogre_stand7 =[ $stand7, ogre_stand8 ] {ai_stand();};
void() ogre_stand8 =[ $stand8, ogre_stand9 ] {ai_stand();};
void() ogre_stand9 =[ $stand9, ogre_stand1 ] {ai_stand();};
void() ogre_walk1 =[ $walk1, ogre_walk2 ] {ai_walk(3);};
void() ogre_walk2 =[ $walk2, ogre_walk3 ] {ai_walk(2);};
void() ogre_walk3 =[ $walk3, ogre_walk4 ] {
ai_walk(2);
if (random() < 0.2)
sound_idle (self, CHAN_VOICE, "ogre/ogidle.wav", 1, ATTN_IDLE);
};
void() ogre_walk4 =[ $walk4, ogre_walk5 ] {ai_walk(2);};
void() ogre_walk5 =[ $walk5, ogre_walk6 ] {ai_walk(2);};
void() ogre_walk6 =[ $walk6, ogre_walk7 ] {
ai_walk(5);
if (random() < 0.1)
sound_misc (self, CHAN_VOICE, "ogre/ogdrag.wav", 1, ATTN_IDLE);
};
void() ogre_walk7 =[ $walk7, ogre_walk8 ] {ai_walk(3);};
void() ogre_walk8 =[ $walk8, ogre_walk9 ] {ai_walk(2);};
void() ogre_walk9 =[ $walk9, ogre_walk10 ] {ai_walk(3);};
void() ogre_walk10 =[ $walk10, ogre_walk11 ] {ai_walk(1);};
void() ogre_walk11 =[ $walk11, ogre_walk12 ] {ai_walk(2);};
void() ogre_walk12 =[ $walk12, ogre_walk13 ] {ai_walk(3);};
void() ogre_walk13 =[ $walk13, ogre_walk14 ] {ai_walk(3);};
void() ogre_walk14 =[ $walk14, ogre_walk15 ] {ai_walk(3);};
void() ogre_walk15 =[ $walk15, ogre_walk16 ] {ai_walk(3);};
void() ogre_walk16 =[ $walk16, ogre_walk1 ] {ai_walk(4);};
void() ogre_run1 =[ $run1, ogre_run2 ] {ai_run(9);
if (random() < 0.2)
sound_misc1 (self, CHAN_VOICE, "ogre/ogidle2.wav", 1, ATTN_IDLE);
};
void() ogre_run2 =[ $run2, ogre_run3 ] {ai_run(12);};
void() ogre_run3 =[ $run3, ogre_run4 ] {ai_run(8);};
void() ogre_run4 =[ $run4, ogre_run5 ] {ai_run(22);};
void() ogre_run5 =[ $run5, ogre_run6 ] {ai_run(16);};
void() ogre_run6 =[ $run6, ogre_run7 ] {ai_run(4);};
void() ogre_run7 =[ $run7, ogre_run8 ] {ai_run(13);};
void() ogre_run8 =[ $run8, ogre_run1 ] {ai_run(24);};
void() ogre_swing1 =[ $swing1, ogre_swing2 ] {ai_charge(11);
sound_attack (self, CHAN_WEAPON, "ogre/ogsawatk.wav", 1, ATTN_NORM);
};
void() ogre_swing2 =[ $swing2, ogre_swing3 ] {ai_charge(1);};
void() ogre_swing3 =[ $swing3, ogre_swing4 ] {ai_charge(4);};
void() ogre_swing4 =[ $swing4, ogre_swing5 ] {ai_charge(13);};
void() ogre_swing5 =[ $swing5, ogre_swing6 ] {ai_charge(9); chainsaw(0);self.angles_y = self.angles_y + random()*25;};
void() ogre_swing6 =[ $swing6, ogre_swing7 ] {chainsaw(200);self.angles_y = self.angles_y + random()* 25;};
void() ogre_swing7 =[ $swing7, ogre_swing8 ] {chainsaw(0);self.angles_y = self.angles_y + random()* 25;};
void() ogre_swing8 =[ $swing8, ogre_swing9 ] {chainsaw(0);self.angles_y = self.angles_y + random()* 25;};
void() ogre_swing9 =[ $swing9, ogre_swing10 ] {chainsaw(0);self.angles_y = self.angles_y + random()* 25;};
void() ogre_swing10 =[ $swing10, ogre_swing11 ] {chainsaw(-200);self.angles_y = self.angles_y + random()* 25;};
void() ogre_swing11 =[ $swing11, ogre_swing12 ] {chainsaw(0);self.angles_y = self.angles_y + random()* 25;};
void() ogre_swing12 =[ $swing12, ogre_swing13 ] {ai_charge(3);};
void() ogre_swing13 =[ $swing13, ogre_swing14 ] {ai_charge(8);};
void() ogre_swing14 =[ $swing14, ogre_run1 ] {ai_charge(9);};
void() ogre_smash1 =[ $smash1, ogre_smash2 ] {ai_charge(6);
sound_attack (self, CHAN_WEAPON, "ogre/ogsawatk.wav", 1, ATTN_NORM);
};
void() ogre_smash2 =[ $smash2, ogre_smash3 ] {ai_charge(0);};
void() ogre_smash3 =[ $smash3, ogre_smash4 ] {ai_charge(0);};
void() ogre_smash4 =[ $smash4, ogre_smash5 ] {ai_charge(1);};
void() ogre_smash5 =[ $smash5, ogre_smash6 ] {ai_charge(4);};
void() ogre_smash6 =[ $smash6, ogre_smash7 ] {ai_charge(4); chainsaw(0);};
void() ogre_smash7 =[ $smash7, ogre_smash8 ] {ai_charge(4); chainsaw(0);};
void() ogre_smash8 =[ $smash8, ogre_smash9 ] {ai_charge(10); chainsaw(0);};
void() ogre_smash9 =[ $smash9, ogre_smash10 ] {ai_charge(13); chainsaw(0);};
void() ogre_smash10 =[ $smash10, ogre_smash11 ] {chainsaw(1);};
void() ogre_smash11 =[ $smash11, ogre_smash12 ] {ai_charge(2); chainsaw(0);
// self.nextthink = self.nextthink + random()*0.2;}; // slight variation
self.nextthink = time + 0.1 + random()*0.2;}; // 1998-08-14 Incorrect setting of nextthink fix by Maddes/Lord Sméagol
void() ogre_smash12 =[ $smash12, ogre_smash13 ] {ai_charge(0);};
void() ogre_smash13 =[ $smash13, ogre_smash14 ] {ai_charge(4);};
void() ogre_smash14 =[ $smash14, ogre_run1 ] {ai_charge(12);};
// Preach tutorial alternate animation frames for monster_ogre_marksman -- dumptruck_ds
.float attack_elevation;
void() ogre2_nail1 =[ $shoot1, ogre2_nail2 ] {ai_face();
self.attack_elevation = IterateElevation(OGRE_DEFAULT_ELEVATION, self.enemy.origin);};
void() ogre2_nail2 =[ $shoot2, ogre2_nail3 ] {ai_face();
self.attack_elevation = IterateElevation(self.attack_elevation, self.enemy.origin);};
void() ogre2_nail3 =[ $shoot2, ogre2_nail4 ] {ai_face();
self.attack_elevation = IterateElevation(self.attack_elevation, self.enemy.origin);};
void() ogre2_nail4 =[ $shoot3, ogre_nail5 ] {ai_face();
PreachFireGrenade(self.attack_elevation);
};
// Preach tutorial alternate animation frames for monster_ogre_marksman -- dumptruck_ds
// these are for the turret version of monster_ogre_marksman
.float attack_elevation;
void() ogre2_turret_attack1 =[ $shoot1, ogre2_turret_attack2 ] {ai_face();
self.attack_elevation = IterateElevation(OGRE_DEFAULT_ELEVATION, self.enemy.origin);};
void() ogre2_turret_attack2 =[ $shoot2, ogre2_turret_attack3 ] {ai_face();
self.attack_elevation = IterateElevation(self.attack_elevation, self.enemy.origin);};
void() ogre2_turret_attack3 =[ $shoot2, ogre2_turret_attack4 ] {ai_face();
self.attack_elevation = IterateElevation(self.attack_elevation, self.enemy.origin);};
void() ogre2_turret_attack4 =[ $shoot3, ogre2_turret_attack5 ] {ai_face();
PreachFireGrenade(self.attack_elevation);};
void() ogre2_turret_attack5 =[ $shoot4, ogre2_turret_attack6 ] {ai_face();};
void() ogre2_turret_attack6 =[ $shoot5, ogre2_turret_attack7 ] {ai_face();};
void() ogre2_turret_attack7 =[ $shoot5, ogre2_turret_attack8 ] {ai_face();};
void() ogre2_turret_attack8 =[ $shoot6, ogre2_turret_attack9 ] {ai_face();};
void() ogre2_turret_attack9 =[ $shoot6, ogre2_turret_seek1 ] {ai_face();};
void() ogre2_turret_seek1 =[ $stand1, ogre2_turret_seek2 ] {ai_run(0);};
void() ogre2_turret_seek2 =[ $stand2, ogre2_turret_seek3 ] {ai_run(0);};
void() ogre2_turret_seek3 =[ $stand3, ogre2_turret_seek4 ] {ai_run(0);};
void() ogre2_turret_seek4 =[ $stand4, ogre2_turret_seek5 ] {ai_run(0);};
void() ogre2_turret_seek5 =[ $stand5, ogre2_turret_seek6 ] {
if (random() < 0.2)
sound_idle (self, CHAN_VOICE, "ogre/ogidle.wav", 1, ATTN_IDLE);
ai_run(0);
};
void() ogre2_turret_seek6 =[ $stand6, ogre2_turret_seek7 ] {ai_run(0);};
void() ogre2_turret_seek7 =[ $stand7, ogre2_turret_seek8 ] {ai_run(0);};
void() ogre2_turret_seek8 =[ $stand8, ogre2_turret_seek9 ] {ai_run(0);};
void() ogre2_turret_seek9 =[ $stand9, ogre2_turret_seek1 ] {ai_run(0);};
//end Preach -- dumptruck_ds
void() ogre_nail1 =[ $shoot1, ogre_nail2 ] {ai_face();};
void() ogre_nail2 =[ $shoot2, ogre_nail3 ] {ai_face();};
void() ogre_nail3 =[ $shoot2, ogre_nail4 ] {ai_face();};
void() ogre_nail4 =[ $shoot3, ogre_nail5 ] {ai_face();
if (self.style == 0)
{
OgreFireGrenade();
}
if (self.style == 1)
{
BDW_OgreFireFlak();
// OgreFireSpike();
}
else if (self.style == 2)
{
OgreFireSpike();
}
if (self.style == 3)
{
W_FireMultiGrenade();
}
if (self.style == 4) // jaycie erysdren 2021-09-14
{
OgreFireLavaBall();
sound_misc2 (self, CHAN_WEAPON, "shalrath/attack2.wav", 1, ATTN_NORM); // used for initial attack sound dumptruck_ds
}
};
void() ogre_nail5 =[ $shoot4, ogre_nail6 ] {ai_face();};
void() ogre_nail6 =[ $shoot5, ogre_nail7 ] {ai_face();};
void() ogre_nail7 =[ $shoot6, ogre_run1 ] {ai_face();};
//
////////////////////////
// turret frames START
////////////////////////
//
void() ogre_turret_attack1 =[ $shoot1, ogre_turret_attack2 ] {ai_face();};
void() ogre_turret_attack2 =[ $shoot2, ogre_turret_attack3 ] {ai_face();};
void() ogre_turret_attack3 =[ $shoot2, ogre_turret_attack4 ] {ai_face();};
void() ogre_turret_attack4 =[ $shoot3, ogre_turret_attack5 ] {ai_face();
if (self.style == 0)
{
OgreFireGrenade();
}
if (self.style == 1)
{
BDW_OgreFireFlak();
// OgreFireSpike();
}
else if (self.style == 2)
{
OgreFireSpike();
}
if (self.style == 3)
{