]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/weapons/w_hagar.qc
4f1b9058474596b1f1fc148090ed02cfe5488166
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / weapons / w_hagar.qc
1 #ifndef IMPLEMENTATION
2 REGISTER_WEAPON(
3 /* WEP_##id  */ HAGAR,
4 /* function  */ W_Hagar,
5 /* ammotype  */ ammo_rockets,
6 /* impulse   */ 8,
7 /* flags     */ WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_FLAG_CANCLIMB | WEP_TYPE_SPLASH,
8 /* rating    */ BOT_PICKUP_RATING_MID,
9 /* color     */ '1 1 0.5',
10 /* modelname */ "hagar",
11 /* simplemdl */ "foobar",
12 /* crosshair */ "gfx/crosshairhagar 0.8",
13 /* wepimg    */ "weaponhagar",
14 /* refname   */ "hagar",
15 /* wepname   */ _("Hagar")
16 );
17
18 #define HAGAR_SETTINGS(w_cvar,w_prop) HAGAR_SETTINGS_LIST(w_cvar, w_prop, HAGAR, hagar)
19 #define HAGAR_SETTINGS_LIST(w_cvar,w_prop,id,sn) \
20         w_cvar(id, sn, BOTH, ammo) \
21         w_cvar(id, sn, BOTH, damage) \
22         w_cvar(id, sn, BOTH, edgedamage) \
23         w_cvar(id, sn, BOTH, force) \
24         w_cvar(id, sn, BOTH, radius) \
25         w_cvar(id, sn, BOTH, refire) \
26         w_cvar(id, sn, BOTH, speed) \
27         w_cvar(id, sn, BOTH, spread) \
28         w_cvar(id, sn, BOTH, damageforcescale) \
29         w_cvar(id, sn, BOTH, health) \
30         w_cvar(id, sn, PRI,  lifetime) \
31         w_cvar(id, sn, SEC,  load) \
32         w_cvar(id, sn, SEC,  load_max) \
33         w_cvar(id, sn, SEC,  load_abort) \
34         w_cvar(id, sn, SEC,  load_animtime) \
35         w_cvar(id, sn, SEC,  load_hold) \
36         w_cvar(id, sn, SEC,  load_speed) \
37         w_cvar(id, sn, SEC,  load_releasedeath) \
38         w_cvar(id, sn, SEC,  load_spread) \
39         w_cvar(id, sn, SEC,  load_spread_bias) \
40         w_cvar(id, sn, SEC,  load_linkexplode) \
41         w_cvar(id, sn, SEC,  lifetime_min) \
42         w_cvar(id, sn, SEC,  lifetime_rand) \
43         w_cvar(id, sn, NONE, secondary) \
44         w_prop(id, sn, float,  reloading_ammo, reload_ammo) \
45         w_prop(id, sn, float,  reloading_time, reload_time) \
46         w_prop(id, sn, float,  switchdelay_raise, switchdelay_raise) \
47         w_prop(id, sn, float,  switchdelay_drop, switchdelay_drop) \
48         w_prop(id, sn, string, weaponreplace, weaponreplace) \
49         w_prop(id, sn, float,  weaponstart, weaponstart) \
50         w_prop(id, sn, float,  weaponstartoverride, weaponstartoverride) \
51         w_prop(id, sn, float,  weaponthrowable, weaponthrowable)
52
53 #ifdef SVQC
54 HAGAR_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
55 #endif
56 #endif
57 #ifdef IMPLEMENTATION
58 #ifdef SVQC
59 void spawnfunc_weapon_hagar(void) { weapon_defaultspawnfunc(WEP_HAGAR.m_id); }
60
61 // NO bounce protection, as bounces are limited!
62
63 void W_Hagar_Explode(void)
64 {
65         self.event_damage = func_null;
66         RadiusDamage(self, self.realowner, WEP_CVAR_PRI(hagar, damage), WEP_CVAR_PRI(hagar, edgedamage), WEP_CVAR_PRI(hagar, radius), world, world, WEP_CVAR_PRI(hagar, force), self.projectiledeathtype, other);
67
68         remove(self);
69 }
70
71 void W_Hagar_Explode2(void)
72 {
73         self.event_damage = func_null;
74         RadiusDamage(self, self.realowner, WEP_CVAR_SEC(hagar, damage), WEP_CVAR_SEC(hagar, edgedamage), WEP_CVAR_SEC(hagar, radius), world, world, WEP_CVAR_SEC(hagar, force), self.projectiledeathtype, other);
75
76         remove(self);
77 }
78
79 void W_Hagar_Damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
80 {
81         if(self.health <= 0)
82                 return;
83
84         float is_linkexplode = ( ((inflictor.owner != world) ? (inflictor.owner == self.owner) : true)
85                 && (inflictor.projectiledeathtype & HITTYPE_SECONDARY)
86                 && (self.projectiledeathtype & HITTYPE_SECONDARY));
87
88         if(is_linkexplode)
89                 is_linkexplode = (is_linkexplode && WEP_CVAR_SEC(hagar, load_linkexplode));
90         else
91                 is_linkexplode = -1; // not secondary load, so continue as normal without exception.
92
93         if(!W_CheckProjectileDamage(inflictor.realowner, self.realowner, deathtype, is_linkexplode))
94                 return; // g_projectiles_damage says to halt
95
96         self.health = self.health - damage;
97         self.angles = vectoangles(self.velocity);
98
99         if(self.health <= 0)
100                 W_PrepareExplosionByDamage(attacker, self.think);
101 }
102
103 void W_Hagar_Touch(void)
104 {
105         PROJECTILE_TOUCH;
106         self.use();
107 }
108
109 void W_Hagar_Touch2(void)
110 {
111         PROJECTILE_TOUCH;
112
113         if(self.cnt > 0 || other.takedamage == DAMAGE_AIM) {
114                 self.use();
115         } else {
116                 self.cnt++;
117                 Send_Effect(EFFECT_HAGAR_BOUNCE, self.origin, self.velocity, 1);
118                 self.angles = vectoangles(self.velocity);
119                 self.owner = world;
120                 self.projectiledeathtype |= HITTYPE_BOUNCE;
121         }
122 }
123
124 void W_Hagar_Attack(void)
125 {
126         entity missile;
127
128         W_DecreaseAmmo(WEP_CVAR_PRI(hagar, ammo));
129
130         W_SetupShot(self, false, 2, W_Sound("hagar_fire"), CH_WEAPON_A, WEP_CVAR_PRI(hagar, damage));
131
132         Send_Effect(EFFECT_HAGAR_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
133
134         missile = spawn();
135         missile.owner = missile.realowner = self;
136         missile.classname = "missile";
137         missile.bot_dodge = true;
138         missile.bot_dodgerating = WEP_CVAR_PRI(hagar, damage);
139
140         missile.takedamage = DAMAGE_YES;
141         missile.health = WEP_CVAR_PRI(hagar, health);
142         missile.damageforcescale = WEP_CVAR_PRI(hagar, damageforcescale);
143         missile.event_damage = W_Hagar_Damage;
144         missile.damagedbycontents = true;
145
146         missile.touch = W_Hagar_Touch;
147         missile.use = W_Hagar_Explode;
148         missile.think = adaptor_think2use_hittype_splash;
149         missile.nextthink = time + WEP_CVAR_PRI(hagar, lifetime);
150         PROJECTILE_MAKETRIGGER(missile);
151         missile.projectiledeathtype = WEP_HAGAR.m_id;
152         setorigin(missile, w_shotorg);
153         setsize(missile, '0 0 0', '0 0 0');
154
155         missile.movetype = MOVETYPE_FLY;
156         W_SetupProjVelocity_PRI(missile, hagar);
157
158         missile.angles = vectoangles(missile.velocity);
159         missile.flags = FL_PROJECTILE;
160         missile.missile_flags = MIF_SPLASH;
161
162         CSQCProjectile(missile, true, PROJECTILE_HAGAR, true);
163
164         MUTATOR_CALLHOOK(EditProjectile, self, missile);
165 }
166
167 void W_Hagar_Attack2(void)
168 {
169         entity missile;
170
171         W_DecreaseAmmo(WEP_CVAR_SEC(hagar, ammo));
172
173         W_SetupShot(self, false, 2, W_Sound("hagar_fire"), CH_WEAPON_A, WEP_CVAR_SEC(hagar, damage));
174
175         Send_Effect(EFFECT_HAGAR_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
176
177         missile = spawn();
178         missile.owner = missile.realowner = self;
179         missile.classname = "missile";
180         missile.bot_dodge = true;
181         missile.bot_dodgerating = WEP_CVAR_SEC(hagar, damage);
182
183         missile.takedamage = DAMAGE_YES;
184         missile.health = WEP_CVAR_SEC(hagar, health);
185         missile.damageforcescale = WEP_CVAR_SEC(hagar, damageforcescale);
186         missile.event_damage = W_Hagar_Damage;
187         missile.damagedbycontents = true;
188
189         missile.touch = W_Hagar_Touch2;
190         missile.cnt = 0;
191         missile.use = W_Hagar_Explode2;
192         missile.think = adaptor_think2use_hittype_splash;
193         missile.nextthink = time + WEP_CVAR_SEC(hagar, lifetime_min) + random() * WEP_CVAR_SEC(hagar, lifetime_rand);
194         PROJECTILE_MAKETRIGGER(missile);
195         missile.projectiledeathtype = WEP_HAGAR.m_id | HITTYPE_SECONDARY;
196         setorigin(missile, w_shotorg);
197         setsize(missile, '0 0 0', '0 0 0');
198
199         missile.movetype = MOVETYPE_BOUNCEMISSILE;
200         W_SetupProjVelocity_SEC(missile, hagar);
201
202         missile.angles = vectoangles(missile.velocity);
203         missile.flags = FL_PROJECTILE;
204         missile.missile_flags = MIF_SPLASH;
205
206         CSQCProjectile(missile, true, PROJECTILE_HAGAR_BOUNCING, true);
207
208         MUTATOR_CALLHOOK(EditProjectile, self, missile);
209 }
210
211 .float hagar_loadstep, hagar_loadblock, hagar_loadbeep, hagar_warning;
212 void W_Hagar_Attack2_Load_Release(void)
213 {
214         // time to release the rockets we've loaded
215
216         entity missile;
217         float counter, shots, spread_pershot;
218         vector s;
219         vector forward, right, up;
220
221         if(!self.hagar_load)
222                 return;
223
224         weapon_prepareattack_do(1, WEP_CVAR_SEC(hagar, refire));
225
226         W_SetupShot(self, false, 2, W_Sound("hagar_fire"), CH_WEAPON_A, WEP_CVAR_SEC(hagar, damage));
227         Send_Effect(EFFECT_HAGAR_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
228
229         forward = v_forward;
230         right = v_right;
231         up = v_up;
232
233         shots = self.hagar_load;
234         missile = world;
235         for(counter = 0; counter < shots; ++counter)
236         {
237                 missile = spawn();
238                 missile.owner = missile.realowner = self;
239                 missile.classname = "missile";
240                 missile.bot_dodge = true;
241                 missile.bot_dodgerating = WEP_CVAR_SEC(hagar, damage);
242
243                 missile.takedamage = DAMAGE_YES;
244                 missile.health = WEP_CVAR_SEC(hagar, health);
245                 missile.damageforcescale = WEP_CVAR_SEC(hagar, damageforcescale);
246                 missile.event_damage = W_Hagar_Damage;
247                 missile.damagedbycontents = true;
248
249                 missile.touch = W_Hagar_Touch; // not bouncy
250                 missile.use = W_Hagar_Explode2;
251                 missile.think = adaptor_think2use_hittype_splash;
252                 missile.nextthink = time + WEP_CVAR_SEC(hagar, lifetime_min) + random() * WEP_CVAR_SEC(hagar, lifetime_rand);
253                 PROJECTILE_MAKETRIGGER(missile);
254                 missile.projectiledeathtype = WEP_HAGAR.m_id | HITTYPE_SECONDARY;
255                 setorigin(missile, w_shotorg);
256                 setsize(missile, '0 0 0', '0 0 0');
257                 missile.movetype = MOVETYPE_FLY;
258                 missile.missile_flags = MIF_SPLASH;
259
260                 // per-shot spread calculation: the more shots there are, the less spread is applied (based on the bias cvar)
261                 spread_pershot = ((shots - 1) / (WEP_CVAR_SEC(hagar, load_max) - 1));
262                 spread_pershot = (1 - (spread_pershot * WEP_CVAR_SEC(hagar, load_spread_bias)));
263                 spread_pershot = (WEP_CVAR_SEC(hagar, spread) * spread_pershot * g_weaponspreadfactor);
264
265                 // pattern spread calculation
266                 s = '0 0 0';
267                 if(counter == 0)
268                         s = '0 0 0';
269                 else
270                 {
271                         makevectors('0 360 0' * (0.75 + (counter - 0.5) / (shots - 1)));
272                         s.y = v_forward.x;
273                         s.z = v_forward.y;
274                 }
275                 s = s * WEP_CVAR_SEC(hagar, load_spread) * g_weaponspreadfactor;
276
277                 W_SetupProjVelocity_Explicit(missile, w_shotdir + right * s.y + up * s.z, v_up, WEP_CVAR_SEC(hagar, speed), 0, 0, spread_pershot, false);
278
279                 missile.angles = vectoangles(missile.velocity);
280                 missile.flags = FL_PROJECTILE;
281
282                 CSQCProjectile(missile, true, PROJECTILE_HAGAR, true);
283
284                 MUTATOR_CALLHOOK(EditProjectile, self, missile);
285         }
286
287         weapon_thinkf(WFRAME_FIRE2, WEP_CVAR_SEC(hagar, load_animtime), w_ready);
288         self.hagar_loadstep = time + WEP_CVAR_SEC(hagar, refire) * W_WeaponRateFactor();
289         self.hagar_load = 0;
290 }
291
292 void W_Hagar_Attack2_Load(void)
293 {
294         // loadable hagar secondary attack, must always run each frame
295
296         if(time < game_starttime)
297                 return;
298
299         bool loaded = self.hagar_load >= WEP_CVAR_SEC(hagar, load_max);
300
301         // this is different than WR_CHECKAMMO when it comes to reloading
302         bool enough_ammo;
303         if(self.items & IT_UNLIMITED_WEAPON_AMMO)
304                 enough_ammo = true;
305         else if(autocvar_g_balance_hagar_reload_ammo)
306                 enough_ammo = self.(weapon_load[WEP_HAGAR.m_id]) >= WEP_CVAR_SEC(hagar, ammo);
307         else
308                 enough_ammo = self.WEP_AMMO(HAGAR) >= WEP_CVAR_SEC(hagar, ammo);
309
310         bool stopped = loaded || !enough_ammo;
311
312         if(self.BUTTON_ATCK2)
313         {
314                 if(self.BUTTON_ATCK && WEP_CVAR_SEC(hagar, load_abort))
315                 {
316                         if(self.hagar_load)
317                         {
318                                 // if we pressed primary fire while loading, unload all rockets and abort
319                                 self.weaponentity.state = WS_READY;
320                                 W_DecreaseAmmo(WEP_CVAR_SEC(hagar, ammo) * self.hagar_load * -1); // give back ammo
321                                 self.hagar_load = 0;
322                                 sound(self, CH_WEAPON_A, W_Sound("hagar_beep"), VOL_BASE, ATTN_NORM);
323
324                                 // pause until we can load rockets again, once we re-press the alt fire button
325                                 self.hagar_loadstep = time + WEP_CVAR_SEC(hagar, load_speed) * W_WeaponRateFactor();
326
327                                 // require letting go of the alt fire button before we can load again
328                                 self.hagar_loadblock = true;
329                         }
330                 }
331                 else
332                 {
333                         // check if we can attempt to load another rocket
334                         if(!stopped)
335                         {
336                                 if(!self.hagar_loadblock && self.hagar_loadstep < time)
337                                 {
338                                         W_DecreaseAmmo(WEP_CVAR_SEC(hagar, ammo));
339                                         self.weaponentity.state = WS_INUSE;
340                                         self.hagar_load += 1;
341                                         sound(self, CH_WEAPON_B, W_Sound("hagar_load"), VOL_BASE * 0.8, ATTN_NORM); // sound is too loud according to most
342
343                                         if(self.hagar_load >= WEP_CVAR_SEC(hagar, load_max))
344                                                 stopped = true;
345                                         else
346                                                 self.hagar_loadstep = time + WEP_CVAR_SEC(hagar, load_speed) * W_WeaponRateFactor();
347                                 }
348                         }
349                         if(stopped && !self.hagar_loadbeep && self.hagar_load) // prevents the beep from playing each frame
350                         {
351                                 // if this is the last rocket we can load, play a beep sound to notify the player
352                                 sound(self, CH_WEAPON_A, W_Sound("hagar_beep"), VOL_BASE, ATTN_NORM);
353                                 self.hagar_loadbeep = true;
354                                 self.hagar_loadstep = time + WEP_CVAR_SEC(hagar, load_hold) * W_WeaponRateFactor();
355                         }
356                 }
357         }
358         else if(self.hagar_loadblock)
359         {
360                 // the alt fire button has been released, so re-enable loading if blocked
361                 self.hagar_loadblock = false;
362         }
363
364         if(self.hagar_load)
365         {
366                 // play warning sound if we're about to release
367                 if(stopped && self.hagar_loadstep - 0.5 < time && WEP_CVAR_SEC(hagar, load_hold) >= 0)
368                 {
369                         if(!self.hagar_warning) // prevents the beep from playing each frame
370                         {
371                                 // we're about to automatically release after holding time, play a beep sound to notify the player
372                                 sound(self, CH_WEAPON_A, W_Sound("hagar_beep"), VOL_BASE, ATTN_NORM);
373                                 self.hagar_warning = true;
374                         }
375                 }
376
377                 // release if player let go of button or if they've held it in too long
378                 if(!self.BUTTON_ATCK2 || (stopped && self.hagar_loadstep < time && WEP_CVAR_SEC(hagar, load_hold) >= 0))
379                 {
380                         self.weaponentity.state = WS_READY;
381                         W_Hagar_Attack2_Load_Release();
382                 }
383         }
384         else
385         {
386                 self.hagar_loadbeep = false;
387                 self.hagar_warning = false;
388
389                 // we aren't checking ammo during an attack, so we must do it here
390                 if(!(WEP_ACTION(self.weapon, WR_CHECKAMMO1) + WEP_ACTION(self.weapon, WR_CHECKAMMO2)))
391                 if(!(self.items & IT_UNLIMITED_WEAPON_AMMO))
392                 {
393                         // note: this doesn't force the switch
394                         W_SwitchToOtherWeapon(self);
395                         return;
396                 }
397         }
398 }
399
400 bool W_Hagar(int req)
401 {
402         float ammo_amount;
403         switch(req)
404         {
405                 case WR_AIM:
406                 {
407                         if(random()>0.15)
408                                 self.BUTTON_ATCK = bot_aim(WEP_CVAR_PRI(hagar, speed), 0, WEP_CVAR_PRI(hagar, lifetime), false);
409                         else // not using secondary_speed since these are only 15% and should cause some ricochets without re-aiming
410                                 self.BUTTON_ATCK2 = bot_aim(WEP_CVAR_PRI(hagar, speed), 0, WEP_CVAR_PRI(hagar, lifetime), false);
411
412                         return true;
413                 }
414                 case WR_THINK:
415                 {
416                         float loadable_secondary;
417                         loadable_secondary = (WEP_CVAR_SEC(hagar, load) && WEP_CVAR(hagar, secondary));
418
419                         if(loadable_secondary)
420                                 W_Hagar_Attack2_Load(); // must always run each frame
421                         if(autocvar_g_balance_hagar_reload_ammo && self.clip_load < min(WEP_CVAR_PRI(hagar, ammo), WEP_CVAR_SEC(hagar, ammo))) // forced reload
422                                 WEP_ACTION(self.weapon, WR_RELOAD);
423                         else if(self.BUTTON_ATCK && !self.hagar_load && !self.hagar_loadblock) // not while secondary is loaded or awaiting reset
424                         {
425                                 if(weapon_prepareattack(0, WEP_CVAR_PRI(hagar, refire)))
426                                 {
427                                         W_Hagar_Attack();
428                                         weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(hagar, refire), w_ready);
429                                 }
430                         }
431                         else if(self.BUTTON_ATCK2 && !loadable_secondary && WEP_CVAR(hagar, secondary))
432                         {
433                                 if(weapon_prepareattack(1, WEP_CVAR_SEC(hagar, refire)))
434                                 {
435                                         W_Hagar_Attack2();
436                                         weapon_thinkf(WFRAME_FIRE2, WEP_CVAR_SEC(hagar, refire), w_ready);
437                                 }
438                         }
439                         return true;
440                 }
441                 case WR_GONETHINK:
442                 {
443                         // we lost the weapon and want to prepare switching away
444                         if(self.hagar_load)
445                         {
446                                 self.weaponentity.state = WS_READY;
447                                 W_Hagar_Attack2_Load_Release();
448                         }
449
450                         return true;
451                 }
452                 case WR_INIT:
453                 {
454                         precache_model(W_Model("g_hagar.md3"));
455                         precache_model(W_Model("v_hagar.md3"));
456                         precache_model(W_Model("h_hagar.iqm"));
457                         precache_sound(W_Sound("hagar_fire"));
458                         precache_sound(W_Sound("hagar_load"));
459                         precache_sound(W_Sound("hagar_beep"));
460                         HAGAR_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
461                         return true;
462                 }
463                 case WR_SETUP:
464                 {
465                         self.hagar_loadblock = false;
466
467                         if(self.hagar_load)
468                         {
469                                 W_DecreaseAmmo(WEP_CVAR_SEC(hagar, ammo) * self.hagar_load * -1); // give back ammo if necessary
470                                 self.hagar_load = 0;
471                         }
472
473                         return true;
474                 }
475                 case WR_CHECKAMMO1:
476                 {
477                         ammo_amount = self.WEP_AMMO(HAGAR) >= WEP_CVAR_PRI(hagar, ammo);
478                         ammo_amount += self.(weapon_load[WEP_HAGAR.m_id]) >= WEP_CVAR_PRI(hagar, ammo);
479                         return ammo_amount;
480                 }
481                 case WR_CHECKAMMO2:
482                 {
483                         ammo_amount = self.WEP_AMMO(HAGAR) >= WEP_CVAR_SEC(hagar, ammo);
484                         ammo_amount += self.(weapon_load[WEP_HAGAR.m_id]) >= WEP_CVAR_SEC(hagar, ammo);
485                         return ammo_amount;
486                 }
487                 case WR_CONFIG:
488                 {
489                         HAGAR_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
490                         return true;
491                 }
492                 case WR_RESETPLAYER:
493                 {
494                         self.hagar_load = 0;
495                         return true;
496                 }
497                 case WR_PLAYERDEATH:
498                 {
499                         // if we have any rockets loaded when we die, release them
500                         if(self.hagar_load && WEP_CVAR_SEC(hagar, load_releasedeath))
501                                 W_Hagar_Attack2_Load_Release();
502
503                         return true;
504                 }
505                 case WR_RELOAD:
506                 {
507                         if(!self.hagar_load) // require releasing loaded rockets first
508                                 W_Reload(min(WEP_CVAR_PRI(hagar, ammo), WEP_CVAR_SEC(hagar, ammo)), W_Sound("reload"));
509
510                         return true;
511                 }
512                 case WR_SUICIDEMESSAGE:
513                 {
514                         return WEAPON_HAGAR_SUICIDE;
515                 }
516                 case WR_KILLMESSAGE:
517                 {
518                         if(w_deathtype & HITTYPE_SECONDARY)
519                                 return WEAPON_HAGAR_MURDER_BURST;
520                         else
521                                 return WEAPON_HAGAR_MURDER_SPRAY;
522                 }
523         }
524         return false;
525 }
526 #endif
527 #ifdef CSQC
528 bool W_Hagar(int req)
529 {
530         switch(req)
531         {
532                 case WR_IMPACTEFFECT:
533                 {
534                         vector org2;
535                         org2 = w_org + w_backoff * 6;
536                         pointparticles(particleeffectnum(EFFECT_HAGAR_EXPLODE), org2, '0 0 0', 1);
537                         if(!w_issilent)
538                         {
539                                 if(w_random<0.15)
540                                         sound(self, CH_SHOTS, W_Sound("hagexp1"), VOL_BASE, ATTN_NORM);
541                                 else if(w_random<0.7)
542                                         sound(self, CH_SHOTS, W_Sound("hagexp2"), VOL_BASE, ATTN_NORM);
543                                 else
544                                         sound(self, CH_SHOTS, W_Sound("hagexp3"), VOL_BASE, ATTN_NORM);
545                         }
546
547                         return true;
548                 }
549                 case WR_INIT:
550                 {
551                         precache_sound(W_Sound("hagexp1"));
552                         precache_sound(W_Sound("hagexp2"));
553                         precache_sound(W_Sound("hagexp3"));
554                         return true;
555                 }
556                 case WR_ZOOMRETICLE:
557                 {
558                         // no weapon specific image for this weapon
559                         return false;
560                 }
561         }
562         return false;
563 }
564 #endif
565 #endif