Merge branch 'master' into terencehill/accuracy_shotgun
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / weapons / weapon / hagar.qc
1 #include "hagar.qh"
2
3 #ifdef SVQC
4
5 // NO bounce protection, as bounces are limited!
6
7 void W_Hagar_Explode(entity this, entity directhitentity)
8 {
9         this.event_damage = func_null;
10         RadiusDamage(this, this.realowner, WEP_CVAR_PRI(hagar, damage), WEP_CVAR_PRI(hagar, edgedamage), WEP_CVAR_PRI(hagar, radius), NULL, NULL, WEP_CVAR_PRI(hagar, force), this.projectiledeathtype, directhitentity);
11
12         delete(this);
13 }
14
15 void W_Hagar_Explode_use(entity this, entity actor, entity trigger)
16 {
17         W_Hagar_Explode(this, trigger);
18 }
19
20 void W_Hagar_Explode2(entity this, entity directhitentity)
21 {
22         this.event_damage = func_null;
23         RadiusDamage(this, this.realowner, WEP_CVAR_SEC(hagar, damage), WEP_CVAR_SEC(hagar, edgedamage), WEP_CVAR_SEC(hagar, radius), NULL, NULL, WEP_CVAR_SEC(hagar, force), this.projectiledeathtype, directhitentity);
24
25         delete(this);
26 }
27
28 void W_Hagar_Explode2_use(entity this, entity actor, entity trigger)
29 {
30         W_Hagar_Explode2(this, trigger);
31 }
32
33 void W_Hagar_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
34 {
35         if(this.health <= 0)
36                 return;
37
38         float is_linkexplode = ( ((inflictor.owner != NULL) ? (inflictor.owner == this.owner) : true)
39                 && (inflictor.projectiledeathtype & HITTYPE_SECONDARY)
40                 && (this.projectiledeathtype & HITTYPE_SECONDARY));
41
42         if(is_linkexplode)
43                 is_linkexplode = (is_linkexplode && WEP_CVAR_SEC(hagar, load_linkexplode));
44         else
45                 is_linkexplode = -1; // not secondary load, so continue as normal without exception.
46
47         if(!W_CheckProjectileDamage(inflictor.realowner, this.realowner, deathtype, is_linkexplode))
48                 return; // g_projectiles_damage says to halt
49
50         this.health = this.health - damage;
51         this.angles = vectoangles(this.velocity);
52
53         if(this.health <= 0)
54                 W_PrepareExplosionByDamage(this, attacker, getthink(this));
55 }
56
57 void W_Hagar_Touch(entity this, entity toucher)
58 {
59         PROJECTILE_TOUCH(this, toucher);
60         this.use(this, NULL, toucher);
61 }
62
63 void W_Hagar_Touch2(entity this, entity toucher)
64 {
65         PROJECTILE_TOUCH(this, toucher);
66
67         if(this.cnt > 0 || toucher.takedamage == DAMAGE_AIM) {
68                 this.use(this, NULL, toucher);
69         } else {
70                 this.cnt++;
71                 Send_Effect(EFFECT_HAGAR_BOUNCE, this.origin, this.velocity, 1);
72                 this.angles = vectoangles(this.velocity);
73                 this.owner = NULL;
74                 this.projectiledeathtype |= HITTYPE_BOUNCE;
75         }
76 }
77
78 void W_Hagar_Attack(Weapon thiswep, entity actor, .entity weaponentity)
79 {
80         entity missile;
81
82         W_DecreaseAmmo(thiswep, actor, WEP_CVAR_PRI(hagar, ammo), weaponentity);
83
84         W_SetupShot(actor, weaponentity, false, 2, SND_HAGAR_FIRE, CH_WEAPON_A, WEP_CVAR_PRI(hagar, damage));
85
86         Send_Effect(EFFECT_HAGAR_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
87
88         missile = new(missile);
89         missile.owner = missile.realowner = actor;
90         missile.bot_dodge = true;
91         missile.bot_dodgerating = WEP_CVAR_PRI(hagar, damage);
92
93         missile.takedamage = DAMAGE_YES;
94         missile.health = WEP_CVAR_PRI(hagar, health);
95         missile.damageforcescale = WEP_CVAR_PRI(hagar, damageforcescale);
96         missile.event_damage = W_Hagar_Damage;
97         missile.damagedbycontents = true;
98         IL_PUSH(g_damagedbycontents, missile);
99
100         settouch(missile, W_Hagar_Touch);
101         missile.use = W_Hagar_Explode_use;
102         setthink(missile, adaptor_think2use_hittype_splash);
103         missile.nextthink = time + WEP_CVAR_PRI(hagar, lifetime);
104         PROJECTILE_MAKETRIGGER(missile);
105         missile.projectiledeathtype = WEP_HAGAR.m_id;
106         setorigin(missile, w_shotorg);
107         setsize(missile, '0 0 0', '0 0 0');
108
109         set_movetype(missile, MOVETYPE_FLY);
110         W_SetupProjVelocity_PRI(missile, hagar);
111
112         missile.angles = vectoangles(missile.velocity);
113         missile.flags = FL_PROJECTILE;
114         IL_PUSH(g_projectiles, missile);
115         IL_PUSH(g_bot_dodge, missile);
116         missile.missile_flags = MIF_SPLASH;
117
118         CSQCProjectile(missile, true, PROJECTILE_HAGAR, true);
119
120         MUTATOR_CALLHOOK(EditProjectile, actor, missile);
121 }
122
123 void W_Hagar_Attack2(Weapon thiswep, entity actor, .entity weaponentity)
124 {
125         entity missile;
126
127         W_DecreaseAmmo(thiswep, actor, WEP_CVAR_SEC(hagar, ammo), weaponentity);
128
129         W_SetupShot(actor, weaponentity, false, 2, SND_HAGAR_FIRE, CH_WEAPON_A, WEP_CVAR_SEC(hagar, damage));
130
131         Send_Effect(EFFECT_HAGAR_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
132
133         missile = new(missile);
134         missile.owner = missile.realowner = actor;
135         missile.bot_dodge = true;
136         missile.bot_dodgerating = WEP_CVAR_SEC(hagar, damage);
137
138         missile.takedamage = DAMAGE_YES;
139         missile.health = WEP_CVAR_SEC(hagar, health);
140         missile.damageforcescale = WEP_CVAR_SEC(hagar, damageforcescale);
141         missile.event_damage = W_Hagar_Damage;
142         missile.damagedbycontents = true;
143         IL_PUSH(g_damagedbycontents, missile);
144
145         settouch(missile, W_Hagar_Touch2);
146         missile.cnt = 0;
147         missile.use = W_Hagar_Explode2_use;
148         setthink(missile, adaptor_think2use_hittype_splash);
149         missile.nextthink = time + WEP_CVAR_SEC(hagar, lifetime_min) + random() * WEP_CVAR_SEC(hagar, lifetime_rand);
150         PROJECTILE_MAKETRIGGER(missile);
151         missile.projectiledeathtype = WEP_HAGAR.m_id | HITTYPE_SECONDARY;
152         setorigin(missile, w_shotorg);
153         setsize(missile, '0 0 0', '0 0 0');
154
155         set_movetype(missile, MOVETYPE_BOUNCEMISSILE);
156         W_SetupProjVelocity_SEC(missile, hagar);
157
158         missile.angles = vectoangles(missile.velocity);
159         missile.flags = FL_PROJECTILE;
160         IL_PUSH(g_projectiles, missile);
161         IL_PUSH(g_bot_dodge, missile);
162         missile.missile_flags = MIF_SPLASH;
163
164         CSQCProjectile(missile, true, PROJECTILE_HAGAR_BOUNCING, true);
165
166         MUTATOR_CALLHOOK(EditProjectile, actor, missile);
167 }
168
169 .float hagar_loadstep, hagar_loadblock, hagar_loadbeep, hagar_warning;
170 void W_Hagar_Attack2_Load_Release(entity actor, .entity weaponentity)
171 {
172         // time to release the rockets we've loaded
173
174         entity missile;
175         float counter, shots, spread_pershot;
176         vector s;
177         vector forward, right, up;
178
179         if(!actor.(weaponentity).hagar_load)
180                 return;
181
182         weapon_prepareattack_do(actor, weaponentity, true, WEP_CVAR_SEC(hagar, refire));
183
184         shots = actor.(weaponentity).hagar_load;
185         W_SetupShot(actor, weaponentity, false, 2, SND_HAGAR_FIRE, CH_WEAPON_A, WEP_CVAR_SEC(hagar, damage) * shots);
186         Send_Effect(EFFECT_HAGAR_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
187
188         forward = v_forward;
189         right = v_right;
190         up = v_up;
191
192         missile = NULL;
193         for(counter = 0; counter < shots; ++counter)
194         {
195                 missile = new(missile);
196                 missile.owner = missile.realowner = actor;
197                 missile.bot_dodge = true;
198                 missile.bot_dodgerating = WEP_CVAR_SEC(hagar, damage);
199
200                 missile.takedamage = DAMAGE_YES;
201                 missile.health = WEP_CVAR_SEC(hagar, health);
202                 missile.damageforcescale = WEP_CVAR_SEC(hagar, damageforcescale);
203                 missile.event_damage = W_Hagar_Damage;
204                 missile.damagedbycontents = true;
205                 IL_PUSH(g_damagedbycontents, missile);
206
207                 settouch(missile, W_Hagar_Touch); // not bouncy
208                 missile.use = W_Hagar_Explode2_use;
209                 setthink(missile, adaptor_think2use_hittype_splash);
210                 missile.nextthink = time + WEP_CVAR_SEC(hagar, lifetime_min) + random() * WEP_CVAR_SEC(hagar, lifetime_rand);
211                 PROJECTILE_MAKETRIGGER(missile);
212                 missile.projectiledeathtype = WEP_HAGAR.m_id | HITTYPE_SECONDARY;
213                 setorigin(missile, w_shotorg);
214                 setsize(missile, '0 0 0', '0 0 0');
215                 set_movetype(missile, MOVETYPE_FLY);
216                 missile.missile_flags = MIF_SPLASH;
217
218                 // per-shot spread calculation: the more shots there are, the less spread is applied (based on the bias cvar)
219                 spread_pershot = ((shots - 1) / (WEP_CVAR_SEC(hagar, load_max) - 1));
220                 spread_pershot = (1 - (spread_pershot * WEP_CVAR_SEC(hagar, load_spread_bias)));
221                 spread_pershot = (WEP_CVAR_SEC(hagar, spread) * spread_pershot * g_weaponspreadfactor);
222
223                 // pattern spread calculation
224                 s = '0 0 0';
225                 if(counter == 0)
226                         s = '0 0 0';
227                 else
228                 {
229                         makevectors('0 360 0' * (0.75 + (counter - 0.5) / (shots - 1)));
230                         s.y = v_forward.x;
231                         s.z = v_forward.y;
232                 }
233                 s = s * WEP_CVAR_SEC(hagar, load_spread) * g_weaponspreadfactor;
234
235                 W_SetupProjVelocity_Explicit(missile, w_shotdir + right * s.y + up * s.z, v_up, WEP_CVAR_SEC(hagar, speed), 0, 0, spread_pershot, false);
236
237                 missile.angles = vectoangles(missile.velocity);
238                 missile.flags = FL_PROJECTILE;
239                 IL_PUSH(g_projectiles, missile);
240                 IL_PUSH(g_bot_dodge, missile);
241
242                 CSQCProjectile(missile, true, PROJECTILE_HAGAR, true);
243
244                 MUTATOR_CALLHOOK(EditProjectile, actor, missile);
245         }
246
247         weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(hagar, load_animtime), w_ready);
248         actor.(weaponentity).hagar_loadstep = time + WEP_CVAR_SEC(hagar, refire) * W_WeaponRateFactor(actor);
249         actor.(weaponentity).hagar_load = 0;
250
251         if(weaponslot(weaponentity) == 0)
252                 actor.hagar_load = 0;
253 }
254
255 void W_Hagar_Attack2_Load(Weapon thiswep, entity actor, .entity weaponentity)
256 {
257         // loadable hagar secondary attack, must always run each frame
258         if(round_handler_IsActive() && !round_handler_IsRoundStarted())
259                 return;
260         if(time < game_starttime)
261                 return;
262
263         bool loaded = actor.(weaponentity).hagar_load >= WEP_CVAR_SEC(hagar, load_max);
264
265         // this is different than WR_CHECKAMMO when it comes to reloading
266         bool enough_ammo;
267         if(actor.items & IT_UNLIMITED_WEAPON_AMMO)
268                 enough_ammo = true;
269         else if(autocvar_g_balance_hagar_reload_ammo)
270                 enough_ammo = actor.(weaponentity).(weapon_load[WEP_HAGAR.m_id]) >= WEP_CVAR_SEC(hagar, ammo);
271         else
272                 enough_ammo = GetResourceAmount(actor, thiswep.ammo_type) >= WEP_CVAR_SEC(hagar, ammo);
273
274         bool stopped = loaded || !enough_ammo;
275
276         if(PHYS_INPUT_BUTTON_ATCK2(actor))
277         {
278                 if(PHYS_INPUT_BUTTON_ATCK(actor) && WEP_CVAR_SEC(hagar, load_abort))
279                 {
280                         if(actor.(weaponentity).hagar_load)
281                         {
282                                 // if we pressed primary fire while loading, unload all rockets and abort
283                                 actor.(weaponentity).state = WS_READY;
284                                 W_DecreaseAmmo(thiswep, actor, WEP_CVAR_SEC(hagar, ammo) * actor.(weaponentity).hagar_load * -1, weaponentity); // give back ammo
285                                 actor.(weaponentity).hagar_load = 0;
286                                 if(weaponslot(weaponentity) == 0)
287                                         actor.hagar_load = 0;
288                                 sound(actor, CH_WEAPON_A, SND_HAGAR_BEEP, VOL_BASE, ATTN_NORM);
289
290                                 // pause until we can load rockets again, once we re-press the alt fire button
291                                 actor.(weaponentity).hagar_loadstep = time + WEP_CVAR_SEC(hagar, load_speed) * W_WeaponRateFactor(actor);
292
293                                 // require letting go of the alt fire button before we can load again
294                                 actor.(weaponentity).hagar_loadblock = true;
295                         }
296                 }
297                 else
298                 {
299                         // check if we can attempt to load another rocket
300                         if(!stopped)
301                         {
302                                 if(!actor.(weaponentity).hagar_loadblock && actor.(weaponentity).hagar_loadstep < time)
303                                 {
304                                         W_DecreaseAmmo(thiswep, actor, WEP_CVAR_SEC(hagar, ammo), weaponentity);
305                                         actor.(weaponentity).state = WS_INUSE;
306                                         actor.(weaponentity).hagar_load += 1;
307                                         sound(actor, CH_WEAPON_B, SND_HAGAR_LOAD, VOL_BASE * 0.8, ATTN_NORM); // sound is too loud according to most
308
309                                         if(actor.(weaponentity).hagar_load >= WEP_CVAR_SEC(hagar, load_max))
310                                                 stopped = true;
311                                         else
312                                                 actor.(weaponentity).hagar_loadstep = time + WEP_CVAR_SEC(hagar, load_speed) * W_WeaponRateFactor(actor);
313                                 }
314                         }
315                         if(stopped && !actor.(weaponentity).hagar_loadbeep && actor.(weaponentity).hagar_load) // prevents the beep from playing each frame
316                         {
317                                 // if this is the last rocket we can load, play a beep sound to notify the player
318                                 sound(actor, CH_WEAPON_A, SND_HAGAR_BEEP, VOL_BASE, ATTN_NORM);
319                                 actor.(weaponentity).hagar_loadbeep = true;
320                                 actor.(weaponentity).hagar_loadstep = time + WEP_CVAR_SEC(hagar, load_hold) * W_WeaponRateFactor(actor);
321                         }
322                 }
323         }
324         else if(actor.(weaponentity).hagar_loadblock)
325         {
326                 // the alt fire button has been released, so re-enable loading if blocked
327                 actor.(weaponentity).hagar_loadblock = false;
328         }
329
330         if(actor.(weaponentity).hagar_load)
331         {
332                 // play warning sound if we're about to release
333                 if(stopped && actor.(weaponentity).hagar_loadstep - 0.5 < time && WEP_CVAR_SEC(hagar, load_hold) >= 0)
334                 {
335                         if(!actor.(weaponentity).hagar_warning) // prevents the beep from playing each frame
336                         {
337                                 // we're about to automatically release after holding time, play a beep sound to notify the player
338                                 sound(actor, CH_WEAPON_A, SND_HAGAR_BEEP, VOL_BASE, ATTN_NORM);
339                                 actor.(weaponentity).hagar_warning = true;
340                         }
341                 }
342
343                 // release if player let go of button or if they've held it in too long
344                 if(!PHYS_INPUT_BUTTON_ATCK2(actor) || (stopped && actor.(weaponentity).hagar_loadstep < time && WEP_CVAR_SEC(hagar, load_hold) >= 0))
345                 {
346                         actor.(weaponentity).state = WS_READY;
347                         W_Hagar_Attack2_Load_Release(actor, weaponentity);
348                 }
349         }
350         else
351         {
352                 actor.(weaponentity).hagar_loadbeep = false;
353                 actor.(weaponentity).hagar_warning = false;
354
355                 // we aren't checking ammo during an attack, so we must do it here
356                 if(!(thiswep.wr_checkammo1(thiswep, actor, weaponentity) + thiswep.wr_checkammo2(thiswep, actor, weaponentity)))
357                 if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO))
358                 {
359                         // note: this doesn't force the switch
360                         W_SwitchToOtherWeapon(actor, weaponentity);
361                         return;
362                 }
363         }
364 }
365
366 void W_Hagar_Attack_Auto(Weapon thiswep, entity actor, .entity weaponentity, int fire)
367 {
368         if(!(fire & 1) || actor.(weaponentity).hagar_load || actor.(weaponentity).hagar_loadblock || actor.(weaponentity).m_switchweapon != WEP_HAGAR)
369         {
370                 w_ready(thiswep, actor, weaponentity, fire);
371                 return;
372         }
373
374         if(!thiswep.wr_checkammo1(thiswep, actor, weaponentity))
375         if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO))
376         {
377                 W_SwitchWeapon_Force(actor, w_getbestweapon(actor, weaponentity), weaponentity);
378                 w_ready(thiswep, actor, weaponentity, fire);
379                 return;
380         }
381
382         W_Hagar_Attack(thiswep, actor, weaponentity);
383
384         int slot = weaponslot(weaponentity);
385         ATTACK_FINISHED(actor, slot) = time + WEP_CVAR_PRI(hagar, refire) * W_WeaponRateFactor(actor);
386         int theframe = WFRAME_FIRE1;
387         entity this = actor.(weaponentity);
388         if(this)
389         {
390                 if(this.wframe == WFRAME_FIRE1)
391                         theframe = WFRAME_DONTCHANGE;
392         }
393         weapon_thinkf(actor, weaponentity, theframe, WEP_CVAR_PRI(hagar, refire), W_Hagar_Attack_Auto);
394 }
395
396 METHOD(Hagar, wr_aim, void(entity thiswep, entity actor, .entity weaponentity))
397 {
398     if(random()>0.15)
399         PHYS_INPUT_BUTTON_ATCK(actor) = bot_aim(actor, weaponentity, WEP_CVAR_PRI(hagar, speed), 0, WEP_CVAR_PRI(hagar, lifetime), false);
400     else // not using secondary_speed since these are only 15% and should cause some ricochets without re-aiming
401         PHYS_INPUT_BUTTON_ATCK2(actor) = bot_aim(actor, weaponentity, WEP_CVAR_PRI(hagar, speed), 0, WEP_CVAR_PRI(hagar, lifetime), false);
402 }
403 METHOD(Hagar, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
404 {
405     float loadable_secondary;
406     loadable_secondary = (WEP_CVAR_SEC(hagar, load) && WEP_CVAR(hagar, secondary));
407     if(weaponslot(weaponentity) == 0)
408         actor.hagar_load = actor.(weaponentity).hagar_load;
409
410     if(loadable_secondary)
411         W_Hagar_Attack2_Load(thiswep, actor, weaponentity); // must always run each frame
412     if(autocvar_g_balance_hagar_reload_ammo && actor.(weaponentity).clip_load < min(WEP_CVAR_PRI(hagar, ammo), WEP_CVAR_SEC(hagar, ammo))) { // forced reload
413         thiswep.wr_reload(thiswep, actor, weaponentity);
414     }
415     else if((fire & 1) && !actor.(weaponentity).hagar_load && !actor.(weaponentity).hagar_loadblock) // not while secondary is loaded or awaiting reset
416         {
417                 if(weapon_prepareattack(thiswep, actor, weaponentity, false, 0))
418                         W_Hagar_Attack_Auto(thiswep, actor, weaponentity, fire);
419         }
420     else if((fire & 2) && !loadable_secondary && WEP_CVAR(hagar, secondary))
421     {
422         if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(hagar, refire)))
423         {
424             W_Hagar_Attack2(thiswep, actor, weaponentity);
425             weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(hagar, refire), w_ready);
426         }
427     }
428 }
429 METHOD(Hagar, wr_gonethink, void(entity thiswep, entity actor, .entity weaponentity))
430 {
431     // we lost the weapon and want to prepare switching away
432     if(actor.(weaponentity).hagar_load)
433     {
434         actor.(weaponentity).state = WS_READY;
435         W_Hagar_Attack2_Load_Release(actor, weaponentity);
436     }
437 }
438 METHOD(Hagar, wr_setup, void(entity thiswep, entity actor, .entity weaponentity))
439 {
440         actor.hagar_load = 0;
441     actor.(weaponentity).hagar_loadblock = false;
442     if(actor.(weaponentity).hagar_load)
443     {
444         W_DecreaseAmmo(thiswep, actor, WEP_CVAR_SEC(hagar, ammo) * actor.(weaponentity).hagar_load * -1, weaponentity); // give back ammo if necessary
445         actor.(weaponentity).hagar_load = 0;
446     }
447 }
448 METHOD(Hagar, wr_checkammo1, bool(entity thiswep, entity actor, .entity weaponentity))
449 {
450     float ammo_amount = GetResourceAmount(actor, thiswep.ammo_type) >= WEP_CVAR_PRI(hagar, ammo);
451     ammo_amount += actor.(weaponentity).(weapon_load[WEP_HAGAR.m_id]) >= WEP_CVAR_PRI(hagar, ammo);
452     return ammo_amount;
453 }
454 METHOD(Hagar, wr_checkammo2, bool(entity thiswep, entity actor, .entity weaponentity))
455 {
456     float ammo_amount = GetResourceAmount(actor, thiswep.ammo_type) >= WEP_CVAR_SEC(hagar, ammo);
457     ammo_amount += actor.(weaponentity).(weapon_load[WEP_HAGAR.m_id]) >= WEP_CVAR_SEC(hagar, ammo);
458     return ammo_amount;
459 }
460 METHOD(Hagar, wr_resetplayer, void(entity thiswep, entity actor))
461 {
462     actor.hagar_load = 0;
463     for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
464     {
465         .entity weaponentity = weaponentities[slot];
466         actor.(weaponentity).hagar_load = 0;
467     }
468 }
469 METHOD(Hagar, wr_playerdeath, void(entity thiswep, entity actor, .entity weaponentity))
470 {
471     // if we have any rockets loaded when we die, release them
472     if(actor.(weaponentity).hagar_load && WEP_CVAR_SEC(hagar, load_releasedeath))
473         W_Hagar_Attack2_Load_Release(actor, weaponentity);
474 }
475 METHOD(Hagar, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
476 {
477     if(!actor.(weaponentity).hagar_load) // require releasing loaded rockets first
478         W_Reload(actor, weaponentity, min(WEP_CVAR_PRI(hagar, ammo), WEP_CVAR_SEC(hagar, ammo)), SND_RELOAD);
479 }
480 METHOD(Hagar, wr_suicidemessage, Notification(entity thiswep))
481 {
482     return WEAPON_HAGAR_SUICIDE;
483 }
484 METHOD(Hagar, wr_killmessage, Notification(entity thiswep))
485 {
486     if(w_deathtype & HITTYPE_SECONDARY)
487         return WEAPON_HAGAR_MURDER_BURST;
488     else
489         return WEAPON_HAGAR_MURDER_SPRAY;
490 }
491
492 #endif
493 #ifdef CSQC
494
495 METHOD(Hagar, wr_impacteffect, void(entity thiswep, entity actor))
496 {
497     vector org2;
498     org2 = w_org + w_backoff * 6;
499     pointparticles(EFFECT_HAGAR_EXPLODE, org2, '0 0 0', 1);
500     if(!w_issilent)
501     {
502         if(w_random<0.15)
503             sound(actor, CH_SHOTS, SND_HAGEXP1, VOL_BASE, ATTN_NORM);
504         else if(w_random<0.7)
505             sound(actor, CH_SHOTS, SND_HAGEXP2, VOL_BASE, ATTN_NORM);
506         else
507             sound(actor, CH_SHOTS, SND_HAGEXP3, VOL_BASE, ATTN_NORM);
508     }
509 }
510
511 #endif