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