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