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