f17e075dd74c7a25df4127000afbe4d1a2521113
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / w_crylink.qc
1 #ifdef REGISTER_WEAPON
2 REGISTER_WEAPON(CRYLINK, w_crylink, IT_CELLS, 6, WEP_FLAG_NORMAL | WEP_TYPE_SPLASH, BOT_PICKUP_RATING_MID, "crylink", "crylink", "Crylink");
3 #else
4 #ifdef SVQC
5 .float gravity;
6 .float crylink_waitrelease;
7 .entity crylink_lastgroup;
8
9 .entity queuenext;
10 .entity queueprev;
11
12 void W_Crylink_Dequeue_Raw(entity own, entity prev, entity me, entity next)
13 {
14         if(me == own.crylink_lastgroup)
15                 own.crylink_lastgroup = ((me == next) ? world : next);
16         prev.queuenext = next;
17         next.queueprev = prev;
18 }
19
20 void W_Crylink_Dequeue(entity e)
21 {
22         W_Crylink_Dequeue_Raw(e.realowner, e.queueprev, e, e.queuenext);
23 }
24
25 // force projectile to explode
26 void W_Crylink_LinkExplode (entity e, entity e2)
27 {
28         float a;
29         a = bound(0, 1 - (time - e.fade_time) * e.fade_rate, 1);
30
31         if(e == e.realowner.crylink_lastgroup)
32                 e.realowner.crylink_lastgroup = world;
33
34         RadiusDamage (e, e.realowner, cvar("g_balance_crylink_primary_damage") * a, cvar("g_balance_crylink_primary_edgedamage") * a, cvar("g_balance_crylink_primary_radius"), world, cvar("g_balance_crylink_primary_force") * a, e.projectiledeathtype, other);
35
36         if(e.queuenext != e2)
37                 W_Crylink_LinkExplode(e.queuenext, e2);
38
39         remove (e);
40 }
41
42 // adjust towards center
43 // returns the origin where they will meet... and the time till the meeting is
44 // stored in w_crylink_linkjoin_time.
45 // could possibly network this origin and time, and display a special particle
46 // effect when projectiles meet there :P
47 // jspeed: MINIMUM jing speed
48 // jtime: MAXIMUM jing time (0: none)
49 float w_crylink_linkjoin_time;
50 vector W_Crylink_LinkJoin(entity e, float jspeed, float jtime)
51 {
52         vector avg_origin, avg_velocity;
53         vector targ_origin;
54         float avg_dist, n;
55         entity p;
56
57         w_crylink_linkjoin_time = 0;
58
59         avg_origin = e.origin;
60         avg_velocity = e.velocity;
61         n = 1;
62         for(p = e; (p = p.queuenext) != e; )
63         {
64                 avg_origin += WarpZone_RefSys_TransformOrigin(p, e, p.origin);
65                 avg_velocity += WarpZone_RefSys_TransformVelocity(p, e, p.velocity);
66                 ++n;
67         }
68         avg_origin *= (1.0 / n);
69         avg_velocity *= (1.0 / n);
70
71         if(n < 2)
72                 return avg_origin; // nothing to do
73
74         // yes, mathematically we can do this in ONE step, but beware of 32bit floats...
75         avg_dist = pow(vlen(e.origin - avg_origin), 2);
76         for(p = e; (p = p.queuenext) != e; )
77                 avg_dist += pow(vlen(WarpZone_RefSys_TransformOrigin(p, e, p.origin) - avg_origin), 2);
78         avg_dist *= (1.0 / n);
79         avg_dist = sqrt(avg_dist);
80
81         if(avg_dist == 0)
82                 return avg_origin; // no change needed
83
84         if(jspeed == 0 && jtime == 0)
85         {
86                 e.velocity = avg_velocity;
87                 UpdateCSQCProjectile(e);
88                 for(p = e; (p = p.queuenext) != e; )
89                 {
90                         p.velocity = WarpZone_RefSys_TransformVelocity(e, p, avg_velocity);
91                         UpdateCSQCProjectile(p);
92                 }
93         }
94         else
95         {
96                 if(jtime)
97                 {
98                         if(jspeed)
99                                 w_crylink_linkjoin_time = min(jtime, avg_dist / jspeed);
100                         else
101                                 w_crylink_linkjoin_time = jtime;
102                 }
103                 else
104                         w_crylink_linkjoin_time = avg_dist / jspeed;
105                 targ_origin = avg_origin + w_crylink_linkjoin_time * avg_velocity;
106
107                 e.velocity = (targ_origin - e.origin) * (1.0 / w_crylink_linkjoin_time);
108                 UpdateCSQCProjectile(e);
109                 for(p = e; (p = p.queuenext) != e; )
110                 {
111                         p.velocity = WarpZone_RefSys_TransformVelocity(e, p, (targ_origin - WarpZone_RefSys_TransformOrigin(p, e, p.origin)) * (1.0 / w_crylink_linkjoin_time));
112                         UpdateCSQCProjectile(p);
113                 }
114
115                 // analysis:
116                 //   jspeed -> +infinity:
117                 //      w_crylink_linkjoin_time -> +0
118                 //      targ_origin -> avg_origin
119                 //      p->velocity -> HUEG towards center
120                 //   jspeed -> 0:
121                 //      w_crylink_linkjoin_time -> +/- infinity
122                 //      targ_origin -> avg_velocity * +/- infinity
123                 //      p->velocity -> avg_velocity
124                 //   jspeed -> -infinity:
125                 //      w_crylink_linkjoin_time -> -0
126                 //      targ_origin -> avg_origin
127                 //      p->velocity -> HUEG away from center
128         }
129
130         return targ_origin;
131 }
132
133 void W_Crylink_LinkJoinEffect_Think()
134 {
135         // is there at least 2 projectiles very close?
136         entity e, p;
137         float n;
138         e = self.owner.crylink_lastgroup;
139         n = 0;
140         if(e)
141         {
142                 if(vlen(e.origin - self.origin) < vlen(e.velocity) * frametime)
143                         ++n;
144                 for(p = e; (p = p.queuenext) != e; )
145                 {
146                         if(vlen(p.origin - self.origin) < vlen(p.velocity) * frametime)
147                                 ++n;
148                 }
149                 if(n >= 2)
150                 {
151                         if(e.projectiledeathtype & HITTYPE_SECONDARY)
152                         {
153                                 if(cvar("g_balance_crylink_secondary_joinexplode"))
154                                 {
155                                         n = n / cvar("g_balance_crylink_secondary_shots");
156                                         RadiusDamage (e, e.realowner, cvar("g_balance_crylink_secondary_joinexplode_damage") * n, 
157                                                                         cvar("g_balance_crylink_secondary_joinexplode_edgedamage") * n, 
158                                                                         cvar("g_balance_crylink_secondary_joinexplode_radius") * n, world, 
159                                                                         cvar("g_balance_crylink_secondary_joinexplode_force") * n, e.projectiledeathtype, other);
160
161                                         pointparticles(particleeffectnum("crylink_joinexplode"), self.origin, '0 0 0', n);
162                                 }                               
163                         }
164                         else
165                         {
166                                 if(cvar("g_balance_crylink_primary_joinexplode"))
167                                 {
168                                         n = n / cvar("g_balance_crylink_primary_shots");
169                                         RadiusDamage (e, e.realowner, cvar("g_balance_crylink_primary_joinexplode_damage") * n, 
170                                                                         cvar("g_balance_crylink_primary_joinexplode_edgedamage") * n, 
171                                                                         cvar("g_balance_crylink_primary_joinexplode_radius") * n, world, 
172                                                                         cvar("g_balance_crylink_primary_joinexplode_force") * n, e.projectiledeathtype, other);
173
174                                         pointparticles(particleeffectnum("crylink_joinexplode"), self.origin, '0 0 0', n);
175                                 }                               
176                         }                       
177                 }
178         }
179         remove(self);
180 }
181
182
183 // NO bounce protection, as bounces are limited!
184 void W_Crylink_Touch (void)
185 {
186         float finalhit;
187         float f;
188         //PROJECTILE_TOUCH;
189         local entity savenext, saveprev, saveown;
190         saveown = self.realowner;
191         savenext = self.queuenext;
192         saveprev = self.queueprev;
193         if(WarpZone_Projectile_Touch())
194         {
195                 if(wasfreed(self))
196                         W_Crylink_Dequeue_Raw(saveown, saveprev, self, savenext);
197                 return;
198         }
199
200         float a;
201         a = bound(0, 1 - (time - self.fade_time) * self.fade_rate, 1);
202
203         finalhit = ((self.cnt <= 0) || (other.takedamage != DAMAGE_NO));
204         if(finalhit)
205                 f = 1;
206         else
207                 f = cvar("g_balance_crylink_primary_bouncedamagefactor");
208         if(a)
209                 f *= a;
210         if (RadiusDamage (self, self.realowner, cvar("g_balance_crylink_primary_damage") * f, cvar("g_balance_crylink_primary_edgedamage") * f, cvar("g_balance_crylink_primary_radius"), world, cvar("g_balance_crylink_primary_force") * f, self.projectiledeathtype, other) && cvar("g_balance_crylink_primary_linkexplode"))
211         {
212                 W_Crylink_LinkExplode(self.queuenext, self);
213                 remove (self);
214                 return;
215         }
216         else if(finalhit)
217         {
218                 // just unlink
219                 W_Crylink_Dequeue(self);
220                 remove(self);
221                 return;
222         }
223         self.cnt = self.cnt - 1;
224         self.angles = vectoangles(self.velocity);
225         self.owner = world;
226         self.projectiledeathtype |= HITTYPE_BOUNCE;
227         // commented out as it causes a little hitch...
228         //if(proj.cnt == 0)
229         //      CSQCProjectile(proj, TRUE, PROJECTILE_CRYLINK, TRUE);
230 }
231
232 void W_Crylink_Touch2 (void)
233 {
234         float finalhit;
235         float f;
236         //PROJECTILE_TOUCH;
237         local entity savenext, saveprev, saveown;
238         savenext = self.queuenext;
239         saveprev = self.queueprev;
240         saveown = self.realowner;
241         if(WarpZone_Projectile_Touch())
242         {
243                 if(wasfreed(self))
244                         W_Crylink_Dequeue_Raw(saveown, saveprev, self, savenext);
245                 return;
246         }
247
248         float a;
249         a = 1 - (time - self.fade_time) * self.fade_rate;
250
251         finalhit = ((self.cnt <= 0) || (other.takedamage != DAMAGE_NO));
252         if(finalhit)
253                 f = 1;
254         else
255                 f = cvar("g_balance_crylink_secondary_bouncedamagefactor");
256         if(a)
257                 f *= a;
258         if (RadiusDamage (self, self.realowner, cvar("g_balance_crylink_secondary_damage") * f, cvar("g_balance_crylink_secondary_edgedamage") * f, cvar("g_balance_crylink_secondary_radius"), world, cvar("g_balance_crylink_secondary_force") * f, self.projectiledeathtype, other) && cvar("g_balance_crylink_secondary_linkexplode"))
259         {
260                 W_Crylink_LinkExplode(self.queuenext, self);
261                 remove (self);
262                 return;
263         }
264         else if(finalhit)
265         {
266                 // just unlink
267                 W_Crylink_Dequeue(self);
268                 remove(self);
269                 return;
270         }
271         self.cnt = self.cnt - 1;
272         self.angles = vectoangles(self.velocity);
273         self.owner = world;
274         self.projectiledeathtype |= HITTYPE_BOUNCE;
275         // commented out as it causes a little hitch...
276         //if(proj.cnt == 0)
277         //      CSQCProjectile(proj, TRUE, PROJECTILE_CRYLINK, TRUE);
278 }
279
280 void W_Crylink_Fadethink (void)
281 {
282         W_Crylink_Dequeue(self);
283         remove(self);
284 }
285
286 void W_Crylink_Attack (void)
287 {
288         local float counter, shots;
289         local entity proj, prevproj, firstproj;
290         local vector s;
291         vector forward, right, up;
292
293         if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
294                 self.ammo_cells = self.ammo_cells - cvar("g_balance_crylink_primary_ammo");
295
296         W_SetupShot (self, FALSE, 2, "weapons/crylink_fire.wav", (cvar("g_balance_crylink_primary_damage")*cvar("g_balance_crylink_primary_shots")));
297         forward = v_forward;
298         right = v_right;
299         up = v_up;
300
301         shots = cvar("g_balance_crylink_primary_shots");
302         pointparticles(particleeffectnum("crylink_muzzleflash"), w_shotorg, w_shotdir * 1000, shots);
303         proj = world;
304         while (counter < shots)
305         {
306                 proj = spawn ();
307                 proj.realowner = proj.owner = self;
308                 proj.classname = "spike";
309                 proj.bot_dodge = TRUE;
310                 proj.bot_dodgerating = cvar("g_balance_crylink_primary_damage");
311                 if(shots == 1) {
312                         proj.queuenext = proj;
313                         proj.queueprev = proj;
314                 }
315                 else if(counter == 0) { // first projectile, store in firstproj for now
316                         firstproj = proj;
317                 }
318                 else if(counter == shots - 1) { // last projectile, link up with first projectile
319                         prevproj.queuenext = proj;
320                         firstproj.queueprev = proj;
321                         proj.queuenext = firstproj;
322                         proj.queueprev = prevproj;
323                 }
324                 else { // else link up with previous projectile
325                         prevproj.queuenext = proj;
326                         proj.queueprev = prevproj;
327                 }
328
329                 prevproj = proj;
330
331                 proj.movetype = MOVETYPE_BOUNCEMISSILE;
332                 PROJECTILE_MAKETRIGGER(proj);
333                 proj.projectiledeathtype = WEP_CRYLINK;
334                 //proj.gravity = 0.001;
335
336                 setorigin (proj, w_shotorg);
337                 setsize(proj, '0 0 0', '0 0 0');
338
339
340                 s = '0 0 0';
341                 if (counter == 0)
342                         s = '0 0 0';
343                 else
344                 {
345                         makevectors('0 360 0' * (0.75 + (counter - 0.5) / (shots - 1)));
346                         s_y = v_forward_x;
347                         s_z = v_forward_y;
348                 }
349                 s = s * cvar("g_balance_crylink_primary_spread") * g_weaponspreadfactor;
350                 W_SetupProjectileVelocityEx(proj, w_shotdir + right * s_y + up * s_z, v_up, cvar("g_balance_crylink_primary_speed"), 0, 0, 0);
351                 proj.touch = W_Crylink_Touch;
352
353                 proj.think = W_Crylink_Fadethink;
354                 if(counter == 0)
355                 {
356                         proj.fade_time = time + cvar("g_balance_crylink_primary_middle_lifetime");
357                         proj.fade_rate = 1 / cvar("g_balance_crylink_primary_middle_fadetime");
358                         proj.nextthink = time + cvar("g_balance_crylink_primary_middle_lifetime") + cvar("g_balance_crylink_primary_middle_fadetime");
359                 }
360                 else
361                 {
362                         proj.fade_time = time + cvar("g_balance_crylink_primary_other_lifetime");
363                         proj.fade_rate = 1 / cvar("g_balance_crylink_primary_other_fadetime");
364                         proj.nextthink = time + cvar("g_balance_crylink_primary_other_lifetime") + cvar("g_balance_crylink_primary_other_fadetime");
365                 }
366                 proj.cnt = cvar("g_balance_crylink_primary_bounces");
367                 //proj.scale = 1 + 1 * proj.cnt;
368
369                 proj.angles = vectoangles (proj.velocity);
370
371                 //proj.glow_size = 20;
372
373                 proj.flags = FL_PROJECTILE;
374
375                 CSQCProjectile(proj, TRUE, (proj.cnt ? PROJECTILE_CRYLINK_BOUNCING : PROJECTILE_CRYLINK), TRUE);
376
377                 other = proj; MUTATOR_CALLHOOK(EditProjectile);
378
379                 counter = counter + 1;
380         }
381         self.crylink_lastgroup = proj;
382 }
383
384 void W_Crylink_Attack2 (void)
385 {
386         local float counter, shots;
387         local entity proj, prevproj, firstproj;
388
389         if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
390                 self.ammo_cells = self.ammo_cells - cvar("g_balance_crylink_secondary_ammo");
391
392         W_SetupShot (self, FALSE, 2, "weapons/crylink_fire2.wav", (cvar("g_balance_crylink_secondary_damage")*cvar("g_balance_crylink_secondary_shots")));
393
394         shots = cvar("g_balance_crylink_secondary_shots");
395         pointparticles(particleeffectnum("crylink_muzzleflash"), w_shotorg, w_shotdir * 1000, shots);
396         proj = world;
397         while (counter < shots)
398         {
399                 proj = spawn ();
400                 proj.realowner = proj.owner = self;
401                 proj.classname = "spike";
402                 proj.bot_dodge = TRUE;
403                 proj.bot_dodgerating = cvar("g_balance_crylink_secondary_damage");
404                 if(shots == 1) {
405                         proj.queuenext = proj;
406                         proj.queueprev = proj;
407                 }
408                 else if(counter == 0) { // first projectile, store in firstproj for now
409                         firstproj = proj;
410                 }
411                 else if(counter == shots - 1) { // last projectile, link up with first projectile
412                         prevproj.queuenext = proj;
413                         firstproj.queueprev = proj;
414                         proj.queuenext = firstproj;
415                         proj.queueprev = prevproj;
416                 }
417                 else { // else link up with previous projectile
418                         prevproj.queuenext = proj;
419                         proj.queueprev = prevproj;
420                 }
421
422                 prevproj = proj;
423
424                 proj.movetype = MOVETYPE_BOUNCEMISSILE;
425                 PROJECTILE_MAKETRIGGER(proj);
426                 proj.projectiledeathtype = WEP_CRYLINK | HITTYPE_SECONDARY;
427                 //proj.gravity = 0.001;
428
429                 setorigin (proj, w_shotorg);
430                 setsize(proj, '0 0 0', '0 0 0');
431
432                 W_SetupProjectileVelocityEx(proj, (w_shotdir + (((counter + 0.5) / shots) * 2 - 1) * v_right * cvar("g_balance_crylink_secondary_spread") * g_weaponspreadfactor), v_up, cvar("g_balance_crylink_secondary_speed"), 0, 0, 0);
433                 proj.touch = W_Crylink_Touch2;
434                 proj.think = W_Crylink_Fadethink;
435                 if(counter == (shots - 1) / 2)
436                 {
437                         proj.fade_time = time + cvar("g_balance_crylink_secondary_middle_lifetime");
438                         proj.fade_rate = 1 / cvar("g_balance_crylink_secondary_middle_fadetime");
439                         proj.nextthink = time + cvar("g_balance_crylink_secondary_middle_lifetime") + cvar("g_balance_crylink_secondary_middle_fadetime");
440                 }
441                 else
442                 {
443                         proj.fade_time = time + cvar("g_balance_crylink_secondary_line_lifetime");
444                         proj.fade_rate = 1 / cvar("g_balance_crylink_secondary_line_fadetime");
445                         proj.nextthink = time + cvar("g_balance_crylink_secondary_line_lifetime") + cvar("g_balance_crylink_secondary_line_fadetime");
446                 }
447                 proj.cnt = cvar("g_balance_crylink_secondary_bounces");
448                 //proj.scale = 1 + 1 * proj.cnt;
449
450                 proj.angles = vectoangles (proj.velocity);
451
452                 //proj.glow_size = 20;
453
454                 proj.flags = FL_PROJECTILE;
455
456                 CSQCProjectile(proj, TRUE, (proj.cnt ? PROJECTILE_CRYLINK_BOUNCING : PROJECTILE_CRYLINK), TRUE);
457
458                 other = proj; MUTATOR_CALLHOOK(EditProjectile);
459
460                 counter = counter + 1;
461         }
462         self.crylink_lastgroup = proj;
463 }
464
465 void spawnfunc_weapon_crylink (void)
466 {
467         weapon_defaultspawnfunc(WEP_CRYLINK);
468 }
469
470 float w_crylink(float req)
471 {
472         if (req == WR_AIM)
473         {
474                 if (random() > 0.15)
475                         self.BUTTON_ATCK = bot_aim(cvar("g_balance_crylink_primary_speed"), 0, cvar("g_balance_crylink_primary_middle_lifetime"), FALSE);
476                 else
477                         self.BUTTON_ATCK2 = bot_aim(cvar("g_balance_crylink_secondary_speed"), 0, cvar("g_balance_crylink_secondary_middle_lifetime"), FALSE);
478         }
479         else if (req == WR_THINK)
480         {
481                 if (self.BUTTON_ATCK)
482                 {
483                         if (!self.crylink_waitrelease)
484                         if (weapon_prepareattack(0, cvar("g_balance_crylink_primary_refire")))
485                         {
486                                 W_Crylink_Attack();
487                                 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_crylink_primary_animtime"), w_ready);
488                                 if(cvar("g_balance_crylink_primary_joinspeed") != 0 || cvar("g_balance_crylink_primary_jointime") != 0)
489                                         self.crylink_waitrelease = 1;
490                         }
491                 }
492                 else if(self.BUTTON_ATCK2 && cvar("g_balance_crylink_secondary"))
493                 {
494                         if (!self.crylink_waitrelease)
495                         if (weapon_prepareattack(1, cvar("g_balance_crylink_secondary_refire")))
496                         {
497                                 W_Crylink_Attack2();
498                                 weapon_thinkf(WFRAME_FIRE2, cvar("g_balance_crylink_secondary_animtime"), w_ready);
499                                 if(cvar("g_balance_crylink_secondary_joinspeed") != 0 || cvar("g_balance_crylink_secondary_jointime") != 0)
500                                         self.crylink_waitrelease = 2;
501                         }
502                 }
503                 else
504                 {
505                         if (self.crylink_waitrelease)
506                         {
507                                 // fired and released now!
508                                 if(self.crylink_lastgroup)
509                                 {
510                                         vector pos;
511                                         entity linkjoineffect;
512                                         
513                                         
514                                         if(self.crylink_waitrelease == 1)
515                                         {
516                                                 pos = W_Crylink_LinkJoin(self.crylink_lastgroup, cvar("g_balance_crylink_primary_joinspeed"), cvar("g_balance_crylink_primary_jointime"));
517                                                 
518                                         }
519                                         else
520                                         {
521                                                 pos = W_Crylink_LinkJoin(self.crylink_lastgroup, cvar("g_balance_crylink_secondary_joinspeed"), cvar("g_balance_crylink_secondary_jointime"));
522                                         }
523                                         
524                                         linkjoineffect = spawn();
525                                         linkjoineffect.think = W_Crylink_LinkJoinEffect_Think;
526                                         linkjoineffect.classname = "linkjoineffect";                                    
527                                         linkjoineffect.nextthink = time + w_crylink_linkjoin_time;
528                                         linkjoineffect.owner = self;
529                                         setorigin(linkjoineffect, pos);
530
531
532                                 }
533                                 self.crylink_waitrelease = 0;
534                                 if(!w_crylink(WR_CHECKAMMO1) && !w_crylink(WR_CHECKAMMO2))
535                                 {
536                                         // ran out of ammo!
537                                         self.cnt = WEP_CRYLINK;
538                                         self.switchweapon = w_getbestweapon(self);
539                                 }
540                         }
541                 }
542         }
543         else if (req == WR_PRECACHE)
544         {
545                 precache_model ("models/weapons/g_crylink.md3");
546                 precache_model ("models/weapons/v_crylink.md3");
547                 precache_model ("models/weapons/h_crylink.iqm");
548                 precache_sound ("weapons/crylink_fire.wav");
549                 precache_sound ("weapons/crylink_fire2.wav");
550                 precache_sound ("weapons/crylink_linkjoin.wav");
551         }
552         else if (req == WR_SETUP)
553                 weapon_setup(WEP_CRYLINK);
554         else if (req == WR_CHECKAMMO1)
555         {
556                 // don't "run out of ammo" and switch weapons while waiting for release
557                 if(self.crylink_lastgroup && self.crylink_waitrelease)
558                         return TRUE;
559                 return self.ammo_cells >= cvar("g_balance_crylink_primary_ammo");
560         }
561         else if (req == WR_CHECKAMMO2)
562         {
563                 // don't "run out of ammo" and switch weapons while waiting for release
564                 if(self.crylink_lastgroup && self.crylink_waitrelease)
565                         return TRUE;
566                 return self.ammo_cells >= cvar("g_balance_crylink_secondary_ammo");
567         }
568         return TRUE;
569 };
570 #endif
571 #ifdef CSQC
572 float w_crylink(float req)
573 {
574         if(req == WR_IMPACTEFFECT)
575         {
576                 vector org2;
577                 org2 = w_org + w_backoff * 2;
578                 if(w_deathtype & HITTYPE_SECONDARY)
579                 {
580                         pointparticles(particleeffectnum("crylink_impact"), org2, '0 0 0', 1);
581                         if(!w_issilent)
582                                 sound(self, CHAN_PROJECTILE, "weapons/crylink_impact2.wav", VOL_BASE, ATTN_NORM);
583                 }
584                 else
585                 {
586                         pointparticles(particleeffectnum("crylink_impactbig"), org2, '0 0 0', 1);
587                         if(!w_issilent)
588                                 sound(self, CHAN_PROJECTILE, "weapons/crylink_impact.wav", VOL_BASE, ATTN_NORM);
589                 }
590         }
591         else if(req == WR_PRECACHE)
592         {
593                 precache_sound("weapons/crylink_impact2.wav");
594                 precache_sound("weapons/crylink_impact.wav");
595         }
596         else if (req == WR_SUICIDEMESSAGE)
597         {
598                 w_deathtypestring = "%s succeeded at self-destructing themself with the Crylink";
599         }
600         else if (req == WR_KILLMESSAGE)
601         {
602                 if(w_deathtype & HITTYPE_BOUNCE)
603                         w_deathtypestring = "%s could not hide from %s's Crylink"; // unchecked: SPLASH (SECONDARY can't be)
604                 else if(w_deathtype & HITTYPE_SPLASH)
605                         w_deathtypestring = "%s was too close to %s's Crylink"; // unchecked: SECONDARY
606                 else
607                         w_deathtypestring = "%s took a close look at %s's Crylink"; // unchecked: SECONDARY
608         }
609         return TRUE;
610 }
611 #endif
612 #endif