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