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