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