]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/server/w_crylink.qc
Merge remote branch 'origin/fruitiex/fruitphys'
[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
152                         
153                         if(e.projectiledeathtype & HITTYPE_SECONDARY)
154                         {
155                                 if(cvar("g_balance_crylink_secondary_joinexplode"))
156                                 {
157                                         n = n / cvar("g_balance_crylink_secondary_shots");
158                                         RadiusDamage (e, e.realowner, cvar("g_balance_crylink_secondary_joinexplode_damage") * n, 
159                                                                         cvar("g_balance_crylink_secondary_joinexplode_edgedamage") * n, 
160                                                                         cvar("g_balance_crylink_secondary_joinexplode_radius") * n, world, 
161                                                                         cvar("g_balance_crylink_secondary_joinexplode_force") * n, e.projectiledeathtype, other);
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                         }                       
175                         
176                         // they seem to touch...
177                         // TODO make a specific particle effect for this
178                         pointparticles(particleeffectnum("crylink_linkjoin"), self.origin, '0 0 0', 1);
179                 }
180         }
181         remove(self);
182 }
183
184
185 // NO bounce protection, as bounces are limited!
186 void W_Crylink_Touch (void)
187 {
188         float finalhit;
189         float f;
190         //PROJECTILE_TOUCH;
191         local entity savenext, saveprev, saveown;
192         saveown = self.realowner;
193         savenext = self.queuenext;
194         saveprev = self.queueprev;
195         if(WarpZone_Projectile_Touch())
196         {
197                 if(wasfreed(self))
198                         W_Crylink_Dequeue_Raw(saveown, saveprev, self, savenext);
199                 return;
200         }
201
202         float a;
203         a = bound(0, 1 - (time - self.fade_time) * self.fade_rate, 1);
204
205         finalhit = ((self.cnt <= 0) || (other.takedamage != DAMAGE_NO));
206         if(finalhit)
207                 f = 1;
208         else
209                 f = cvar("g_balance_crylink_primary_bouncedamagefactor");
210         if(a)
211                 f *= a;
212         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"))
213         {
214                 W_Crylink_LinkExplode(self.queuenext, self);
215                 remove (self);
216                 return;
217         }
218         else if(finalhit)
219         {
220                 // just unlink
221                 W_Crylink_Dequeue(self);
222                 remove(self);
223                 return;
224         }
225         self.cnt = self.cnt - 1;
226         self.angles = vectoangles(self.velocity);
227         self.owner = world;
228         self.projectiledeathtype |= HITTYPE_BOUNCE;
229         // commented out as it causes a little hitch...
230         //if(proj.cnt == 0)
231         //      CSQCProjectile(proj, TRUE, PROJECTILE_CRYLINK, TRUE);
232 }
233
234 void W_Crylink_Touch2 (void)
235 {
236         float finalhit;
237         float f;
238         //PROJECTILE_TOUCH;
239         local entity savenext, saveprev, saveown;
240         savenext = self.queuenext;
241         saveprev = self.queueprev;
242         saveown = self.realowner;
243         if(WarpZone_Projectile_Touch())
244         {
245                 if(wasfreed(self))
246                         W_Crylink_Dequeue_Raw(saveown, saveprev, self, savenext);
247                 return;
248         }
249
250         float a;
251         a = 1 - (time - self.fade_time) * self.fade_rate;
252
253         finalhit = ((self.cnt <= 0) || (other.takedamage != DAMAGE_NO));
254         if(finalhit)
255                 f = 1;
256         else
257                 f = cvar("g_balance_crylink_secondary_bouncedamagefactor");
258         if(a)
259                 f *= a;
260         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"))
261         {
262                 W_Crylink_LinkExplode(self.queuenext, self);
263                 remove (self);
264                 return;
265         }
266         else if(finalhit)
267         {
268                 // just unlink
269                 W_Crylink_Dequeue(self);
270                 remove(self);
271                 return;
272         }
273         self.cnt = self.cnt - 1;
274         self.angles = vectoangles(self.velocity);
275         self.owner = world;
276         self.projectiledeathtype |= HITTYPE_BOUNCE;
277         // commented out as it causes a little hitch...
278         //if(proj.cnt == 0)
279         //      CSQCProjectile(proj, TRUE, PROJECTILE_CRYLINK, TRUE);
280 }
281
282 void W_Crylink_Fadethink (void)
283 {
284         W_Crylink_Dequeue(self);
285         remove(self);
286 }
287
288 void W_Crylink_Attack (void)
289 {
290         local float counter, shots;
291         local entity proj, prevproj, firstproj;
292         local vector s;
293         vector forward, right, up;
294
295         if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
296                 self.ammo_cells = self.ammo_cells - cvar("g_balance_crylink_primary_ammo");
297
298         W_SetupShot (self, FALSE, 2, "weapons/crylink_fire.wav", (cvar("g_balance_crylink_primary_damage")*cvar("g_balance_crylink_primary_shots")));
299         forward = v_forward;
300         right = v_right;
301         up = v_up;
302
303         shots = cvar("g_balance_crylink_primary_shots");
304         pointparticles(particleeffectnum("crylink_muzzleflash"), w_shotorg, w_shotdir * 1000, shots);
305         proj = world;
306         while (counter < shots)
307         {
308                 proj = spawn ();
309                 proj.realowner = proj.owner = self;
310                 proj.classname = "spike";
311                 proj.bot_dodge = TRUE;
312                 proj.bot_dodgerating = cvar("g_balance_crylink_primary_damage");
313                 if(shots == 1) {
314                         proj.queuenext = proj;
315                         proj.queueprev = proj;
316                 }
317                 else if(counter == 0) { // first projectile, store in firstproj for now
318                         firstproj = proj;
319                 }
320                 else if(counter == shots - 1) { // last projectile, link up with first projectile
321                         prevproj.queuenext = proj;
322                         firstproj.queueprev = proj;
323                         proj.queuenext = firstproj;
324                         proj.queueprev = prevproj;
325                 }
326                 else { // else link up with previous projectile
327                         prevproj.queuenext = proj;
328                         proj.queueprev = prevproj;
329                 }
330
331                 prevproj = proj;
332
333                 proj.movetype = MOVETYPE_BOUNCEMISSILE;
334                 PROJECTILE_MAKETRIGGER(proj);
335                 proj.projectiledeathtype = WEP_CRYLINK;
336                 //proj.gravity = 0.001;
337
338                 setorigin (proj, w_shotorg);
339                 setsize(proj, '0 0 0', '0 0 0');
340
341
342                 s = '0 0 0';
343                 if (counter == 0)
344                         s = '0 0 0';
345                 else
346                 {
347                         makevectors('0 360 0' * (0.75 + (counter - 0.5) / (shots - 1)));
348                         s_y = v_forward_x;
349                         s_z = v_forward_y;
350                 }
351                 s = s * cvar("g_balance_crylink_primary_spread") * g_weaponspreadfactor;
352                 W_SetupProjectileVelocityEx(proj, w_shotdir + right * s_y + up * s_z, v_up, cvar("g_balance_crylink_primary_speed"), 0, 0, 0);
353                 proj.touch = W_Crylink_Touch;
354
355                 proj.think = W_Crylink_Fadethink;
356                 if(counter == 0)
357                 {
358                         proj.fade_time = time + cvar("g_balance_crylink_primary_middle_lifetime");
359                         proj.fade_rate = 1 / cvar("g_balance_crylink_primary_middle_fadetime");
360                         proj.nextthink = time + cvar("g_balance_crylink_primary_middle_lifetime") + cvar("g_balance_crylink_primary_middle_fadetime");
361                 }
362                 else
363                 {
364                         proj.fade_time = time + cvar("g_balance_crylink_primary_other_lifetime");
365                         proj.fade_rate = 1 / cvar("g_balance_crylink_primary_other_fadetime");
366                         proj.nextthink = time + cvar("g_balance_crylink_primary_other_lifetime") + cvar("g_balance_crylink_primary_other_fadetime");
367                 }
368                 proj.cnt = cvar("g_balance_crylink_primary_bounces");
369                 //proj.scale = 1 + 1 * proj.cnt;
370
371                 proj.angles = vectoangles (proj.velocity);
372
373                 //proj.glow_size = 20;
374
375                 proj.flags = FL_PROJECTILE;
376
377                 CSQCProjectile(proj, TRUE, (proj.cnt ? PROJECTILE_CRYLINK_BOUNCING : PROJECTILE_CRYLINK), TRUE);
378
379                 other = proj; MUTATOR_CALLHOOK(EditProjectile);
380
381                 counter = counter + 1;
382         }
383         self.crylink_lastgroup = proj;
384 }
385
386 void W_Crylink_Attack2 (void)
387 {
388         local float counter, shots;
389         local entity proj, prevproj, firstproj;
390
391         if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
392                 self.ammo_cells = self.ammo_cells - cvar("g_balance_crylink_secondary_ammo");
393
394         W_SetupShot (self, FALSE, 2, "weapons/crylink_fire2.wav", (cvar("g_balance_crylink_secondary_damage")*cvar("g_balance_crylink_secondary_shots")));
395
396         shots = cvar("g_balance_crylink_secondary_shots");
397         pointparticles(particleeffectnum("crylink_muzzleflash"), w_shotorg, w_shotdir * 1000, shots);
398         proj = world;
399         while (counter < shots)
400         {
401                 proj = spawn ();
402                 proj.realowner = proj.owner = self;
403                 proj.classname = "spike";
404                 proj.bot_dodge = TRUE;
405                 proj.bot_dodgerating = cvar("g_balance_crylink_secondary_damage");
406                 if(shots == 1) {
407                         proj.queuenext = proj;
408                         proj.queueprev = proj;
409                 }
410                 else if(counter == 0) { // first projectile, store in firstproj for now
411                         firstproj = proj;
412                 }
413                 else if(counter == shots - 1) { // last projectile, link up with first projectile
414                         prevproj.queuenext = proj;
415                         firstproj.queueprev = proj;
416                         proj.queuenext = firstproj;
417                         proj.queueprev = prevproj;
418                 }
419                 else { // else link up with previous projectile
420                         prevproj.queuenext = proj;
421                         proj.queueprev = prevproj;
422                 }
423
424                 prevproj = proj;
425
426                 proj.movetype = MOVETYPE_BOUNCEMISSILE;
427                 PROJECTILE_MAKETRIGGER(proj);
428                 proj.projectiledeathtype = WEP_CRYLINK | HITTYPE_SECONDARY;
429                 //proj.gravity = 0.001;
430
431                 setorigin (proj, w_shotorg);
432                 setsize(proj, '0 0 0', '0 0 0');
433
434                 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);
435                 proj.touch = W_Crylink_Touch2;
436                 proj.think = W_Crylink_Fadethink;
437                 if(counter == (shots - 1) / 2)
438                 {
439                         proj.fade_time = time + cvar("g_balance_crylink_secondary_middle_lifetime");
440                         proj.fade_rate = 1 / cvar("g_balance_crylink_secondary_middle_fadetime");
441                         proj.nextthink = time + cvar("g_balance_crylink_secondary_middle_lifetime") + cvar("g_balance_crylink_secondary_middle_fadetime");
442                 }
443                 else
444                 {
445                         proj.fade_time = time + cvar("g_balance_crylink_secondary_line_lifetime");
446                         proj.fade_rate = 1 / cvar("g_balance_crylink_secondary_line_fadetime");
447                         proj.nextthink = time + cvar("g_balance_crylink_secondary_line_lifetime") + cvar("g_balance_crylink_secondary_line_fadetime");
448                 }
449                 proj.cnt = cvar("g_balance_crylink_secondary_bounces");
450                 //proj.scale = 1 + 1 * proj.cnt;
451
452                 proj.angles = vectoangles (proj.velocity);
453
454                 //proj.glow_size = 20;
455
456                 proj.flags = FL_PROJECTILE;
457
458                 CSQCProjectile(proj, TRUE, (proj.cnt ? PROJECTILE_CRYLINK_BOUNCING : PROJECTILE_CRYLINK), TRUE);
459
460                 other = proj; MUTATOR_CALLHOOK(EditProjectile);
461
462                 counter = counter + 1;
463         }
464         self.crylink_lastgroup = proj;
465 }
466
467 void spawnfunc_weapon_crylink (void)
468 {
469         weapon_defaultspawnfunc(WEP_CRYLINK);
470 }
471
472 float w_crylink(float req)
473 {
474         if (req == WR_AIM)
475         {
476                 if (random() > 0.15)
477                         self.BUTTON_ATCK = bot_aim(cvar("g_balance_crylink_primary_speed"), 0, cvar("g_balance_crylink_primary_middle_lifetime"), FALSE);
478                 else
479                         self.BUTTON_ATCK2 = bot_aim(cvar("g_balance_crylink_secondary_speed"), 0, cvar("g_balance_crylink_secondary_middle_lifetime"), FALSE);
480         }
481         else if (req == WR_THINK)
482         {
483                 if (self.BUTTON_ATCK)
484                 {
485                         if (!self.crylink_waitrelease)
486                         if (weapon_prepareattack(0, cvar("g_balance_crylink_primary_refire")))
487                         {
488                                 W_Crylink_Attack();
489                                 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_crylink_primary_animtime"), w_ready);
490                                 if(cvar("g_balance_crylink_primary_joinspeed") != 0 || cvar("g_balance_crylink_primary_jointime") != 0)
491                                         self.crylink_waitrelease = 1;
492                         }
493                 }
494                 else if(self.BUTTON_ATCK2 && cvar("g_balance_crylink_secondary"))
495                 {
496                         if (!self.crylink_waitrelease)
497                         if (weapon_prepareattack(1, cvar("g_balance_crylink_secondary_refire")))
498                         {
499                                 W_Crylink_Attack2();
500                                 weapon_thinkf(WFRAME_FIRE2, cvar("g_balance_crylink_secondary_animtime"), w_ready);
501                                 if(cvar("g_balance_crylink_secondary_joinspeed") != 0 || cvar("g_balance_crylink_secondary_jointime") != 0)
502                                         self.crylink_waitrelease = 2;
503                         }
504                 }
505                 else
506                 {
507                         if (self.crylink_waitrelease)
508                         {
509                                 // fired and released now!
510                                 if(self.crylink_lastgroup)
511                                 {
512                                         vector pos;
513                                         entity linkjoineffect;
514                                         
515                                         
516                                         if(self.crylink_waitrelease == 1)
517                                         {
518                                                 pos = W_Crylink_LinkJoin(self.crylink_lastgroup, cvar("g_balance_crylink_primary_joinspeed"), cvar("g_balance_crylink_primary_jointime"));
519                                                 
520                                         }
521                                         else
522                                         {
523                                                 pos = W_Crylink_LinkJoin(self.crylink_lastgroup, cvar("g_balance_crylink_secondary_joinspeed"), cvar("g_balance_crylink_secondary_jointime"));
524                                         }
525                                         
526                                         linkjoineffect = spawn();
527                                         linkjoineffect.think = W_Crylink_LinkJoinEffect_Think;
528                                         linkjoineffect.classname = "linkjoineffect";                                    
529                                         linkjoineffect.nextthink = time + w_crylink_linkjoin_time;
530                                         linkjoineffect.owner = self;
531                                         setorigin(linkjoineffect, pos);
532
533
534                                 }
535                                 self.crylink_waitrelease = 0;
536                                 if(!w_crylink(WR_CHECKAMMO1) && !w_crylink(WR_CHECKAMMO2))
537                                 {
538                                         // ran out of ammo!
539                                         self.cnt = WEP_CRYLINK;
540                                         self.switchweapon = w_getbestweapon(self);
541                                 }
542                         }
543                 }
544         }
545         else if (req == WR_PRECACHE)
546         {
547                 precache_model ("models/weapons/g_crylink.md3");
548                 precache_model ("models/weapons/v_crylink.md3");
549                 precache_model ("models/weapons/h_crylink.iqm");
550                 precache_sound ("weapons/crylink_fire.wav");
551                 precache_sound ("weapons/crylink_fire2.wav");
552                 precache_sound ("weapons/crylink_linkjoin.wav");
553         }
554         else if (req == WR_SETUP)
555                 weapon_setup(WEP_CRYLINK);
556         else if (req == WR_CHECKAMMO1)
557         {
558                 // don't "run out of ammo" and switch weapons while waiting for release
559                 if(self.crylink_lastgroup && self.crylink_waitrelease)
560                         return TRUE;
561                 return self.ammo_cells >= cvar("g_balance_crylink_primary_ammo");
562         }
563         else if (req == WR_CHECKAMMO2)
564         {
565                 // don't "run out of ammo" and switch weapons while waiting for release
566                 if(self.crylink_lastgroup && self.crylink_waitrelease)
567                         return TRUE;
568                 return self.ammo_cells >= cvar("g_balance_crylink_secondary_ammo");
569         }
570         return TRUE;
571 };
572 #endif
573 #ifdef CSQC
574 float w_crylink(float req)
575 {
576         if(req == WR_IMPACTEFFECT)
577         {
578                 vector org2;
579                 org2 = w_org + w_backoff * 2;
580                 if(w_deathtype & HITTYPE_SECONDARY)
581                 {
582                         pointparticles(particleeffectnum("crylink_impact"), org2, '0 0 0', 1);
583                         if(!w_issilent)
584                                 sound(self, CHAN_PROJECTILE, "weapons/crylink_impact2.wav", VOL_BASE, ATTN_NORM);
585                 }
586                 else
587                 {
588                         pointparticles(particleeffectnum("crylink_impactbig"), org2, '0 0 0', 1);
589                         if(!w_issilent)
590                                 sound(self, CHAN_PROJECTILE, "weapons/crylink_impact.wav", VOL_BASE, ATTN_NORM);
591                 }
592         }
593         else if(req == WR_PRECACHE)
594         {
595                 precache_sound("weapons/crylink_impact2.wav");
596                 precache_sound("weapons/crylink_impact.wav");
597         }
598         else if (req == WR_SUICIDEMESSAGE)
599         {
600                 w_deathtypestring = "%s succeeded at self-destructing themself with the Crylink";
601         }
602         else if (req == WR_KILLMESSAGE)
603         {
604                 if(w_deathtype & HITTYPE_BOUNCE)
605                         w_deathtypestring = "%s could not hide from %s's Crylink"; // unchecked: SPLASH (SECONDARY can't be)
606                 else if(w_deathtype & HITTYPE_SPLASH)
607                         w_deathtypestring = "%s was too close to %s's Crylink"; // unchecked: SECONDARY
608                 else
609                         w_deathtypestring = "%s took a close look at %s's Crylink"; // unchecked: SECONDARY
610         }
611         return TRUE;
612 }
613 #endif
614 #endif