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