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