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