]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/weapons/weapon/devastator.qc
Merge branch 'sev/lumaIcons' into 'master'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / weapons / weapon / devastator.qc
1 #include "devastator.qh"
2
3 #ifdef SVQC
4
5 .entity lastrocket;
6
7 void W_Devastator_Unregister(entity this)
8 {
9         for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
10         {
11                 .entity weaponentity = weaponentities[slot];
12                 if(this.realowner.(weaponentity).lastrocket == this)
13                         this.realowner.(weaponentity).lastrocket = NULL;
14         }
15 }
16
17 void W_Devastator_Explode(entity this, entity directhitentity)
18 {
19         W_Devastator_Unregister(this);
20
21         if(directhitentity.takedamage == DAMAGE_AIM)
22                 if(IS_PLAYER(directhitentity))
23                         if(DIFF_TEAM(this.realowner, directhitentity))
24                                 if(!IS_DEAD(directhitentity))
25                                         if(IsFlying(directhitentity))
26                                                 Send_Notification(NOTIF_ONE, this.realowner, MSG_ANNCE, ANNCE_ACHIEVEMENT_AIRSHOT);
27
28         this.event_damage = func_null;
29         this.takedamage = DAMAGE_NO;
30
31         RadiusDamage(
32                 this,
33                 this.realowner,
34                 WEP_CVAR(devastator, damage),
35                 WEP_CVAR(devastator, edgedamage),
36                 WEP_CVAR(devastator, radius),
37                 NULL,
38                 NULL,
39                 WEP_CVAR(devastator, force),
40                 this.projectiledeathtype,
41                 this.weaponentity_fld,
42                 directhitentity
43         );
44
45         Weapon thiswep = WEP_DEVASTATOR;
46         .entity weaponentity = this.weaponentity_fld;
47         if(this.realowner.(weaponentity).m_weapon == thiswep)
48         {
49                 if(GetResourceAmount(this.realowner, thiswep.ammo_type) < WEP_CVAR(devastator, ammo))
50                 if(!(this.realowner.items & IT_UNLIMITED_WEAPON_AMMO))
51                 {
52                         this.realowner.cnt = WEP_DEVASTATOR.m_id;
53                         int slot = weaponslot(weaponentity);
54                         ATTACK_FINISHED(this.realowner, slot) = time;
55                         this.realowner.(weaponentity).m_switchweapon = w_getbestweapon(this.realowner, weaponentity);
56                 }
57         }
58         delete(this);
59 }
60
61 void W_Devastator_Explode_think(entity this)
62 {
63         W_Devastator_Explode(this, NULL);
64 }
65
66 void W_Devastator_DoRemoteExplode(entity this, .entity weaponentity)
67 {
68         W_Devastator_Unregister(this);
69
70         this.event_damage = func_null;
71         this.takedamage = DAMAGE_NO;
72
73         bool handled_as_rocketjump = false;
74         entity head = NULL;
75
76         if(WEP_CVAR(devastator, remote_jump_radius))
77         {
78                 head = WarpZone_FindRadius(
79                         this.origin,
80                         WEP_CVAR(devastator, remote_jump_radius),
81                         false
82                 );
83
84                 while(head)
85                 {
86                         if(head.takedamage && (head == this.realowner))
87                         {
88                                 if(vdist(this.origin - head.WarpZone_findradius_nearest, <=, WEP_CVAR(devastator, remote_jump_radius)))
89                                 {
90                                         // we handled this as a rocketjump :)
91                                         handled_as_rocketjump = true;
92
93                                         // modify velocity
94                                         if(WEP_CVAR(devastator, remote_jump_velocity_z_add))
95                                         {
96                                                 head.velocity_x *= 0.9;
97                                                 head.velocity_y *= 0.9;
98                                                 head.velocity_z = bound(
99                                                         WEP_CVAR(devastator, remote_jump_velocity_z_min),
100                                                         head.velocity.z + WEP_CVAR(devastator, remote_jump_velocity_z_add),
101                                                         WEP_CVAR(devastator, remote_jump_velocity_z_max)
102                                                 );
103                                         }
104
105                                         // now do the damage
106                                         RadiusDamage(
107                                                 this,
108                                                 head,
109                                                 WEP_CVAR(devastator, remote_jump_damage),
110                                                 WEP_CVAR(devastator, remote_jump_damage),
111                                                 WEP_CVAR(devastator, remote_jump_radius),
112                                                 NULL,
113                                                 head,
114                                                 (WEP_CVAR(devastator, remote_jump_force) ? WEP_CVAR(devastator, remote_jump_force) : 0),
115                                                 this.projectiledeathtype | HITTYPE_BOUNCE,
116                                                 this.weaponentity_fld,
117                                                 NULL
118                                         );
119                                         break;
120                                 }
121                         }
122                         head = head.chain;
123                 }
124         }
125
126         RadiusDamage(
127                 this,
128                 this.realowner,
129                 WEP_CVAR(devastator, remote_damage),
130                 WEP_CVAR(devastator, remote_edgedamage),
131                 WEP_CVAR(devastator, remote_radius),
132                 (handled_as_rocketjump ? head : NULL),
133                 NULL,
134                 WEP_CVAR(devastator, remote_force),
135                 this.projectiledeathtype | HITTYPE_BOUNCE,
136                 this.weaponentity_fld,
137                 NULL
138         );
139
140         Weapon thiswep = WEP_DEVASTATOR;
141         if(this.realowner.(weaponentity).m_weapon == thiswep)
142         {
143                 if(GetResourceAmount(this.realowner, thiswep.ammo_type) < WEP_CVAR(devastator, ammo))
144                 if(!(this.realowner.items & IT_UNLIMITED_WEAPON_AMMO))
145                 {
146                         this.realowner.cnt = WEP_DEVASTATOR.m_id;
147                         int slot = weaponslot(weaponentity);
148                         ATTACK_FINISHED(this.realowner, slot) = time;
149                         this.realowner.(weaponentity).m_switchweapon = w_getbestweapon(this.realowner, weaponentity);
150                 }
151         }
152         delete(this);
153 }
154
155 void W_Devastator_RemoteExplode(entity this, .entity weaponentity)
156 {
157         if(!IS_DEAD(this.realowner))
158         if(this.realowner.(weaponentity).lastrocket)
159         {
160                 if((this.spawnshieldtime >= 0)
161                         ? (time >= this.spawnshieldtime) // timer
162                         : (vdist(NearestPointOnBox(this.realowner, this.origin) - this.origin, >, WEP_CVAR(devastator, remote_radius))) // safety device
163                 )
164                 {
165                         W_Devastator_DoRemoteExplode(this, weaponentity);
166                 }
167         }
168 }
169
170 vector W_Devastator_SteerTo(vector thisdir, vector goaldir, float maxturn_cos)
171 {
172         if(thisdir * goaldir > maxturn_cos)
173                 return goaldir;
174         if(thisdir * goaldir < -0.9998) // less than 1 degree and opposite
175                 return thisdir; // refuse to guide (better than letting a numerical error happen)
176         float f, m2;
177         vector v;
178         // solve:
179         //   g = normalize(thisdir + goaldir * X)
180         //   thisdir * g = maxturn
181         //
182         //   gg = thisdir + goaldir * X
183         //   (thisdir * gg)^2 = maxturn^2 * (gg * gg)
184         //
185         //   (1 + (thisdir * goaldir) * X)^2 = maxturn^2 * (1 + X*X + 2 * X * thisdir * goaldir)
186         f = thisdir * goaldir;
187         //   (1 + f * X)^2 = maxturn^2 * (1 + X*X + 2 * X * f)
188         //   0 = (m^2 - f^2) * x^2 + (2 * f * (m^2 - 1)) * x + (m^2 - 1)
189         m2 = maxturn_cos * maxturn_cos;
190         v = solve_quadratic(m2 - f * f, 2 * f * (m2 - 1), m2 - 1);
191         return normalize(thisdir + goaldir * v.y); // the larger solution!
192 }
193 // assume thisdir == -goaldir:
194 //   f == -1
195 //   v = solve_qadratic(m2 - 1, -2 * (m2 - 1), m2 - 1)
196 //   (m2 - 1) x^2 - 2 * (m2 - 1) * x + (m2 - 1) = 0
197 //   x^2 - 2 * x + 1 = 0
198 //   (x - 1)^2 = 0
199 //   x = 1
200 //   normalize(thisdir + goaldir)
201 //   normalize(0)
202
203 void W_Devastator_Think(entity this)
204 {
205         vector desireddir, olddir, newdir, desiredorigin, goal;
206         float velspeed, f;
207         this.nextthink = time;
208         if(time > this.cnt)
209         {
210                 this.projectiledeathtype |= HITTYPE_BOUNCE;
211                 W_Devastator_Explode(this, NULL);
212                 return;
213         }
214
215         // accelerate
216         makevectors(this.angles.x * '-1 0 0' + this.angles.y * '0 1 0');
217         velspeed = WEP_CVAR(devastator, speed) * W_WeaponSpeedFactor(this.realowner) - (this.velocity * v_forward);
218         if(velspeed > 0)
219                 this.velocity = this.velocity + v_forward * min(WEP_CVAR(devastator, speedaccel) * W_WeaponSpeedFactor(this.realowner) * frametime, velspeed);
220
221         // laser guided, or remote detonation
222         .entity weaponentity = this.weaponentity_fld;
223         if(this.realowner.(weaponentity).m_weapon == WEP_DEVASTATOR)
224         {
225                 if(this == this.realowner.(weaponentity).lastrocket)
226                 if(!this.realowner.(weaponentity).rl_release)
227                 if(!PHYS_INPUT_BUTTON_ATCK2(this))
228                 if(WEP_CVAR(devastator, guiderate))
229                 if(time > this.pushltime)
230                 if(!IS_DEAD(this.realowner))
231                 {
232                         f = WEP_CVAR(devastator, guideratedelay);
233                         if(f)
234                                 f = bound(0, (time - this.pushltime) / f, 1);
235                         else
236                                 f = 1;
237
238                         vector md = this.realowner.(weaponentity).movedir;
239                         vector vecs = ((md.x > 0) ? md : '0 0 0');
240
241                         vector dv = v_right * -vecs.y + v_up * vecs.z;
242
243                         if(!W_DualWielding(this.realowner))
244                                 dv = '0 0 0'; // don't override!
245
246                         velspeed = vlen(this.velocity);
247
248                         makevectors(this.realowner.v_angle);
249                         desireddir = WarpZone_RefSys_TransformVelocity(this.realowner, this, v_forward);
250                         desiredorigin = WarpZone_RefSys_TransformOrigin(this.realowner, this, this.realowner.origin + this.realowner.view_ofs + dv);
251                         olddir = normalize(this.velocity);
252
253                         // now it gets tricky... we want to move like some curve to approximate the target direction
254                         // but we are limiting the rate at which we can turn!
255                         goal = desiredorigin + ((this.origin - desiredorigin) * desireddir + WEP_CVAR(devastator, guidegoal)) * desireddir;
256                         newdir = W_Devastator_SteerTo(olddir, normalize(goal - this.origin), cos(WEP_CVAR(devastator, guiderate) * f * frametime * DEG2RAD));
257
258                         this.velocity = newdir * velspeed;
259                         this.angles = vectoangles(this.velocity);
260
261                         if(!this.count)
262                         {
263                                 Send_Effect(EFFECT_ROCKET_GUIDE, this.origin, this.velocity, 1);
264                                 // TODO add a better sound here
265                                 sound(this.realowner, CH_WEAPON_B, SND_ROCKET_MODE, VOL_BASE, ATTN_NORM);
266                                 this.count = 1;
267                         }
268                 }
269
270                 if(this.rl_detonate_later)
271                         W_Devastator_RemoteExplode(this, weaponentity);
272         }
273
274         if(this.csqcprojectile_clientanimate == 0)
275                 UpdateCSQCProjectile(this);
276 }
277
278 void W_Devastator_Touch(entity this, entity toucher)
279 {
280         if(WarpZone_Projectile_Touch(this, toucher))
281         {
282                 if(wasfreed(this))
283                         W_Devastator_Unregister(this);
284                 return;
285         }
286         W_Devastator_Unregister(this);
287         W_Devastator_Explode(this, toucher);
288 }
289
290 void W_Devastator_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, .entity weaponentity, vector hitloc, vector force)
291 {
292         if(GetResourceAmount(this, RESOURCE_HEALTH) <= 0)
293                 return;
294
295         if(!W_CheckProjectileDamage(inflictor.realowner, this.realowner, deathtype, -1)) // no exceptions
296                 return; // g_projectiles_damage says to halt
297
298         TakeResource(this, RESOURCE_HEALTH, damage);
299         this.angles = vectoangles(this.velocity);
300
301         if(GetResourceAmount(this, RESOURCE_HEALTH) <= 0)
302                 W_PrepareExplosionByDamage(this, attacker, W_Devastator_Explode_think);
303 }
304
305 void W_Devastator_Attack(Weapon thiswep, entity actor, .entity weaponentity, int fire)
306 {
307         W_DecreaseAmmo(thiswep, actor, WEP_CVAR(devastator, ammo), weaponentity);
308
309         W_SetupShot_ProjectileSize(actor, weaponentity, '-3 -3 -3', '3 3 3', false, 5, SND_ROCKET_FIRE, CH_WEAPON_A, WEP_CVAR(devastator, damage), WEP_DEVASTATOR.m_id);
310         Send_Effect(EFFECT_ROCKET_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
311
312         entity missile = WarpZone_RefSys_SpawnSameRefSys(actor);
313         missile.weaponentity_fld = weaponentity;
314         missile.owner = missile.realowner = actor;
315         actor.(weaponentity).lastrocket = missile;
316         if(WEP_CVAR(devastator, detonatedelay) >= 0)
317                 missile.spawnshieldtime = time + WEP_CVAR(devastator, detonatedelay);
318         else
319                 missile.spawnshieldtime = -1;
320         missile.pushltime = time + WEP_CVAR(devastator, guidedelay);
321         missile.classname = "rocket";
322         missile.bot_dodge = true;
323         missile.bot_dodgerating = WEP_CVAR(devastator, damage) * 2; // * 2 because it can be detonated inflight which makes it even more dangerous
324
325         missile.takedamage = DAMAGE_YES;
326         missile.damageforcescale = WEP_CVAR(devastator, damageforcescale);
327         SetResourceAmountExplicit(missile, RESOURCE_HEALTH, WEP_CVAR(devastator, health));
328         missile.event_damage = W_Devastator_Damage;
329         missile.damagedbycontents = true;
330         IL_PUSH(g_damagedbycontents, missile);
331
332         set_movetype(missile, MOVETYPE_FLY);
333         PROJECTILE_MAKETRIGGER(missile);
334         missile.projectiledeathtype = WEP_DEVASTATOR.m_id;
335         setsize(missile, '-3 -3 -3', '3 3 3'); // give it some size so it can be shot
336
337         setorigin(missile, w_shotorg - v_forward * 3); // move it back so it hits the wall at the right point
338         W_SetupProjVelocity_Basic(missile, WEP_CVAR(devastator, speedstart), 0);
339         missile.angles = vectoangles(missile.velocity);
340
341         settouch(missile, W_Devastator_Touch);
342         setthink(missile, W_Devastator_Think);
343         missile.nextthink = time;
344         missile.cnt = time + WEP_CVAR(devastator, lifetime);
345         missile.rl_detonate_later = (fire & 2); // allow instant detonation
346         missile.flags = FL_PROJECTILE;
347         IL_PUSH(g_projectiles, missile);
348         IL_PUSH(g_bot_dodge, missile);
349         missile.missile_flags = MIF_SPLASH;
350
351         CSQCProjectile(missile, WEP_CVAR(devastator, guiderate) == 0 && WEP_CVAR(devastator, speedaccel) == 0, PROJECTILE_ROCKET, false); // because of fly sound
352
353         // muzzle flash for 1st person view
354         entity flash = spawn();
355         setmodel(flash, MDL_DEVASTATOR_MUZZLEFLASH); // precision set below
356         SUB_SetFade(flash, time, 0.1);
357         flash.effects = EF_ADDITIVE | EF_FULLBRIGHT | EF_LOWPRECISION;
358         W_AttachToShotorg(actor, weaponentity, flash, '5 0 0');
359
360         // common properties
361         MUTATOR_CALLHOOK(EditProjectile, actor, missile);
362
363         if (time >= missile.nextthink)
364         {
365                 getthink(missile)(missile);
366         }
367 }
368
369 METHOD(Devastator, wr_aim, void(entity thiswep, entity actor, .entity weaponentity))
370 {
371     // aim and decide to fire if appropriate
372     PHYS_INPUT_BUTTON_ATCK(actor) = bot_aim(actor, weaponentity, WEP_CVAR(devastator, speed), 0, WEP_CVAR(devastator, lifetime), false);
373     if(skill >= 2) // skill 0 and 1 bots won't detonate rockets!
374     {
375         // decide whether to detonate rockets
376         float edgedamage, coredamage, edgeradius, recipricoledgeradius;
377         float selfdamage, teamdamage, enemydamage;
378         edgedamage = WEP_CVAR(devastator, edgedamage);
379         coredamage = WEP_CVAR(devastator, damage);
380         edgeradius = WEP_CVAR(devastator, radius);
381         recipricoledgeradius = 1 / edgeradius;
382         selfdamage = 0;
383         teamdamage = 0;
384         enemydamage = 0;
385         IL_EACH(g_projectiles, it.realowner == actor && it.classname == "rocket",
386         {
387             entity rocket = it;
388             IL_EACH(g_bot_targets, it.bot_attack,
389             {
390                 float d = vlen(it.origin + (it.mins + it.maxs) * 0.5 - rocket.origin);
391                 d = bound(0, edgedamage + (coredamage - edgedamage) * sqrt(1 - d * recipricoledgeradius), 10000);
392                 // count potential damage according to type of target
393                 if(it == actor)
394                         selfdamage = selfdamage + d;
395                 else if(SAME_TEAM(it, actor))
396                         teamdamage = teamdamage + d;
397                 else if(bot_shouldattack(actor, it))
398                         enemydamage = enemydamage + d;
399             });
400         });
401         float desirabledamage;
402         desirabledamage = enemydamage;
403         if(time > actor.invincible_finished && time > actor.spawnshieldtime)
404             desirabledamage = desirabledamage - selfdamage * autocvar_g_balance_selfdamagepercent;
405         if(teamplay && actor.team)
406             desirabledamage = desirabledamage - teamdamage;
407
408         makevectors(actor.v_angle);
409         IL_EACH(g_projectiles, it.realowner == actor && it.classname == "rocket",
410         {
411             if(skill > 9) // normal players only do this for the target they are tracking
412             {
413                     entity rocket = it;
414                     IL_EACH(g_bot_targets, it.bot_attack,
415                     {
416                         if((v_forward * normalize(rocket.origin - it.origin) < 0.1)
417                             && desirabledamage > 0.1 * coredamage
418                             ) PHYS_INPUT_BUTTON_ATCK2(actor) = true;
419                     });
420                 }
421                 else
422                 {
423                 //As the distance gets larger, a correct detonation gets near imposible
424                 //Bots are assumed to use the rocket spawnfunc_light to see if the rocket gets near a player
425                 if((v_forward * normalize(it.origin - actor.enemy.origin) < 0.1)
426                         && IS_PLAYER(actor.enemy)
427                         && (desirabledamage >= 0.1 * coredamage)
428                         )
429                 {
430                         float distance = bound(300, vlen(actor.origin - actor.enemy.origin), 30000);
431                         if(random() / distance * 300 > frametime * bound(0, (10 - skill) * 0.2, 1))
432                                 PHYS_INPUT_BUTTON_ATCK2(actor) = true;
433                 }
434                 }
435         });
436         // if we would be doing at X percent of the core damage, detonate it
437         // but don't fire a new shot at the same time!
438         if(desirabledamage >= 0.75 * coredamage) //this should do group damage in rare fortunate events
439             PHYS_INPUT_BUTTON_ATCK2(actor) = true;
440         if((skill > 6.5) && (selfdamage > GetResourceAmount(actor, RESOURCE_HEALTH)))
441             PHYS_INPUT_BUTTON_ATCK2(actor) = false;
442         //if(PHYS_INPUT_BUTTON_ATCK2(actor) == true)
443         //      dprint(ftos(desirabledamage),"\n");
444         if(PHYS_INPUT_BUTTON_ATCK2(actor)) PHYS_INPUT_BUTTON_ATCK(actor) = false;
445     }
446 }
447
448 METHOD(Devastator, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
449 {
450     if(WEP_CVAR(devastator, reload_ammo) && actor.(weaponentity).clip_load < WEP_CVAR(devastator, ammo)) { // forced reload
451         thiswep.wr_reload(thiswep, actor, weaponentity);
452     } else {
453         if(fire & 1)
454         {
455             if(actor.(weaponentity).rl_release || WEP_CVAR(devastator, guidestop))
456             if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(devastator, refire)))
457             {
458                 W_Devastator_Attack(thiswep, actor, weaponentity, fire);
459                 weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(devastator, animtime), w_ready);
460                 actor.(weaponentity).rl_release = 0;
461             }
462         }
463         else
464             actor.(weaponentity).rl_release = 1;
465
466         if(fire & 2)
467         if(actor.(weaponentity).m_switchweapon == WEP_DEVASTATOR)
468         {
469             bool rockfound = false;
470             IL_EACH(g_projectiles, it.realowner == actor && it.classname == "rocket",
471             {
472                 if(!it.rl_detonate_later)
473                 {
474                     it.rl_detonate_later = true;
475                     rockfound = true;
476                 }
477             });
478             if(rockfound)
479                 sound(actor, CH_WEAPON_B, SND_ROCKET_DET, VOL_BASE, ATTN_NORM);
480         }
481     }
482 }
483 METHOD(Devastator, wr_setup, void(entity thiswep, entity actor, .entity weaponentity))
484 {
485     actor.(weaponentity).rl_release = 1;
486 }
487 METHOD(Devastator, wr_checkammo1, bool(entity thiswep, entity actor, .entity weaponentity))
488 {
489     #if 0
490     // don't switch while guiding a missile
491     if(ATTACK_FINISHED(actor, slot) <= time || PS(actor).m_weapon != WEP_DEVASTATOR)
492     {
493         ammo_amount = false;
494         if(WEP_CVAR(devastator, reload_ammo))
495         {
496             if(GetResourceAmount(actor, thiswep.ammo_type) < WEP_CVAR(devastator, ammo) && actor.(weaponentity).(weapon_load[WEP_DEVASTATOR.m_id]) < WEP_CVAR(devastator, ammo))
497                 ammo_amount = true;
498         }
499         else if(GetResourceAmount(actor, thiswep.ammo_type) < WEP_CVAR(devastator, ammo))
500             ammo_amount = true;
501         return !ammo_amount;
502     }
503     #endif
504     #if 0
505     if(actor.rl_release == 0)
506     {
507         LOG_INFOF("W_Devastator(WR_CHECKAMMO1): %d, %.2f, %d: TRUE", actor.rl_release, GetResourceAmount(actor, thiswep.ammo_type), WEP_CVAR(devastator, ammo));
508         return true;
509     }
510     else
511     {
512         ammo_amount = GetResourceAmount(actor, thiswep.ammo_type) >= WEP_CVAR(devastator, ammo);
513         ammo_amount += actor.(weaponentity).(weapon_load[WEP_DEVASTATOR.m_id]) >= WEP_CVAR(devastator, ammo);
514         LOG_INFOF("W_Devastator(WR_CHECKAMMO1): %d, %.2f, %d: %s", actor.rl_release, GetResourceAmount(actor, thiswep.ammo_type), WEP_CVAR(devastator, ammo), (ammo_amount ? "TRUE" : "FALSE"));
515         return ammo_amount;
516     }
517     #else
518     float ammo_amount = GetResourceAmount(actor, thiswep.ammo_type) >= WEP_CVAR(devastator, ammo);
519     ammo_amount += actor.(weaponentity).(weapon_load[WEP_DEVASTATOR.m_id]) >= WEP_CVAR(devastator, ammo);
520     return ammo_amount;
521     #endif
522 }
523 METHOD(Devastator, wr_checkammo2, bool(entity thiswep, entity actor, .entity weaponentity))
524 {
525     return false;
526 }
527 METHOD(Devastator, wr_resetplayer, void(entity thiswep, entity actor))
528 {
529     for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
530     {
531         .entity weaponentity = weaponentities[slot];
532         actor.(weaponentity).lastrocket = NULL; // stop rocket guiding, no revenge from the grave!
533         actor.(weaponentity).rl_release = 0;
534     }
535 }
536 METHOD(Devastator, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
537 {
538     W_Reload(actor, weaponentity, WEP_CVAR(devastator, ammo), SND_RELOAD);
539 }
540 METHOD(Devastator, wr_suicidemessage, Notification(entity thiswep))
541 {
542     return WEAPON_DEVASTATOR_SUICIDE;
543 }
544 METHOD(Devastator, wr_killmessage, Notification(entity thiswep))
545 {
546     if((w_deathtype & HITTYPE_BOUNCE) || (w_deathtype & HITTYPE_SPLASH))
547         return WEAPON_DEVASTATOR_MURDER_SPLASH;
548     else
549         return WEAPON_DEVASTATOR_MURDER_DIRECT;
550 }
551
552 #endif
553 #ifdef CSQC
554
555 METHOD(Devastator, wr_impacteffect, void(entity thiswep, entity actor))
556 {
557     vector org2;
558     org2 = w_org + w_backoff * 12;
559     pointparticles(EFFECT_ROCKET_EXPLODE, org2, '0 0 0', 1);
560     if(!w_issilent)
561         sound(actor, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTN_NORM);
562 }
563
564 #endif