]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/weapons/weapon/vaporizer.qc
Merge branch 'master' into terencehill/dynamic_hud
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / weapons / weapon / vaporizer.qc
1 #ifndef IMPLEMENTATION
2 CLASS(Vaporizer, Weapon)
3 /* ammotype  */ ATTRIB(Vaporizer, ammo_field, .int, ammo_cells)
4 /* impulse   */ ATTRIB(Vaporizer, impulse, int, 7)
5 /* flags     */ ATTRIB(Vaporizer, spawnflags, int, WEP_FLAG_RELOADABLE | WEP_FLAG_CANCLIMB | WEP_FLAG_SUPERWEAPON | WEP_TYPE_HITSCAN);
6 /* rating    */ ATTRIB(Vaporizer, bot_pickupbasevalue, float, BOT_PICKUP_RATING_HIGH);
7 /* color     */ ATTRIB(Vaporizer, wpcolor, vector, '0.5 1 1');
8 /* modelname */ ATTRIB(Vaporizer, mdl, string, "minstanex");
9 #ifndef MENUQC
10 /* model     */ ATTRIB(Vaporizer, m_model, Model, MDL_VAPORIZER_ITEM);
11 #endif
12 /* crosshair */ ATTRIB(Vaporizer, w_crosshair, string, "gfx/crosshairminstanex");
13 /* crosshair */ ATTRIB(Vaporizer, w_crosshair_size, float, 0.6);
14 /* wepimg    */ ATTRIB(Vaporizer, model2, string, "weaponminstanex");
15 /* refname   */ ATTRIB(Vaporizer, netname, string, "vaporizer");
16 /* wepname   */ ATTRIB(Vaporizer, m_name, string, _("Vaporizer"));
17
18 #define X(BEGIN, P, END, class, prefix) \
19         BEGIN(class) \
20                 P(class, prefix, ammo, float, PRI) \
21         P(class, prefix, animtime, float, PRI) \
22         P(class, prefix, damage, float, PRI) \
23         P(class, prefix, refire, float, PRI) \
24         P(class, prefix, ammo, float, SEC) \
25         P(class, prefix, animtime, float, SEC) \
26         P(class, prefix, damage, float, SEC) \
27         P(class, prefix, delay, float, SEC) \
28         P(class, prefix, edgedamage, float, SEC) \
29         P(class, prefix, force, float, SEC) \
30         P(class, prefix, lifetime, float, SEC) \
31         P(class, prefix, radius, float, SEC) \
32         P(class, prefix, refire, float, SEC) \
33         P(class, prefix, shotangle, float, SEC) \
34         P(class, prefix, speed, float, SEC) \
35         P(class, prefix, spread, float, SEC) \
36         P(class, prefix, reload_ammo, float, NONE) \
37         P(class, prefix, reload_time, float, NONE) \
38         P(class, prefix, switchdelay_raise, float, NONE) \
39         P(class, prefix, switchdelay_drop, float, NONE) \
40         P(class, prefix, weaponreplace, string, NONE) \
41         P(class, prefix, weaponstart, float, NONE) \
42         P(class, prefix, weaponstartoverride, float, NONE) \
43         P(class, prefix, weaponthrowable, float, NONE) \
44         END()
45     W_PROPS(X, Vaporizer, vaporizer)
46 #undef X
47
48 ENDCLASS(Vaporizer)
49 REGISTER_WEAPON(VAPORIZER, vaporizer, NEW(Vaporizer));
50
51
52 #ifdef SVQC
53 .float vaporizer_lasthit;
54 .float jump_interval;
55 .float jump_interval2;
56 .bool held_down;
57 .float rm_force;
58 .float rm_damage;
59 .float rm_edmg;
60 #endif
61 #endif
62 #ifdef IMPLEMENTATION
63
64 REGISTER_NET_TEMP(TE_CSQC_VAPORBEAMPARTICLE)
65
66 #if defined(SVQC)
67 void SendCSQCVaporizerBeamParticle(entity player, int hit) {
68         vector v;
69         v = WarpZone_UnTransformOrigin(WarpZone_trace_transform, trace_endpos);
70         WriteHeader(MSG_BROADCAST, TE_CSQC_VAPORBEAMPARTICLE);
71         WriteCoord(MSG_BROADCAST, w_shotorg.x);
72         WriteCoord(MSG_BROADCAST, w_shotorg.y);
73         WriteCoord(MSG_BROADCAST, w_shotorg.z);
74         WriteCoord(MSG_BROADCAST, v.x);
75         WriteCoord(MSG_BROADCAST, v.y);
76         WriteCoord(MSG_BROADCAST, v.z);
77         WriteByte(MSG_BROADCAST, hit);
78         WriteByte(MSG_BROADCAST, etof(player));
79         WriteByte(MSG_BROADCAST, player.team);
80 }
81 #elif defined(CSQC)
82 bool autocvar_cl_vaporizerbeam_particle = false;
83 float autocvar_cl_vaporizerbeam_lifetime = 0.8;
84 float autocvar_cl_vaporizerbeam_colorboost = 0.7;
85
86 string Draw_VaporizerBeam_trace_callback_tex;
87 float Draw_VaporizerBeam_trace_callback_rnd;
88 vector Draw_VaporizerBeam_trace_callback_rgb;
89 float Draw_VaporizerBeam_trace_callback_a;
90 void Draw_VaporizerBeam_trace_callback(vector start, vector hit, vector end)
91 {
92         float i;
93         vector vorg;
94         vorg = WarpZone_TransformOrigin(WarpZone_trace_transform, view_origin);
95         for(i = 0; i < Draw_VaporizerBeam_trace_callback_a; ++i)
96                 Draw_CylindricLine(hit, start, 8, Draw_VaporizerBeam_trace_callback_tex, 0.25, Draw_VaporizerBeam_trace_callback_rnd, Draw_VaporizerBeam_trace_callback_rgb, min(1, Draw_VaporizerBeam_trace_callback_a - i), DRAWFLAG_NORMAL, vorg);
97         Draw_VaporizerBeam_trace_callback_rnd += 0.25 * vlen(hit - start) / 8;
98 }
99
100 .vector vorg1, vorg2;
101 .float spawn_time;
102 void VaporizerBeam_Draw(entity this)
103 {
104         //draw either the old v2.3 beam or the new beam
105         particles_alphamin = particles_alphamax = particles_fade = 1;
106
107         string tex = "particles/lgbeam";
108         if(this.cnt)
109                 tex = "particles/gauntletbeam";
110         vector rgb;
111         //entity e = CSQCModel_server2csqc(this.sv_entnum - 1);
112         //if (e == NULL)
113         //{
114                 rgb = colormapPaletteColor(stof(getplayerkeyvalue(this.sv_entnum - 1, "colors")) & 0x0F, true);
115                 //rgb = '1 1 1';
116         //}
117         //else
118         //      rgb = e.glowmod;
119         rgb *= (1 + autocvar_cl_vaporizerbeam_colorboost);
120
121         float fail = (this.nextthink - time);
122
123         Draw_VaporizerBeam_trace_callback_tex = tex;
124         Draw_VaporizerBeam_trace_callback_rnd = 0;
125         Draw_VaporizerBeam_trace_callback_rgb = rgb;
126         Draw_VaporizerBeam_trace_callback_a = bound(0, fail, 1);
127         WarpZone_TraceBox_ThroughZone(this.vorg1, '0 0 0', '0 0 0', this.vorg2, MOVE_NOTHING, world, world, Draw_VaporizerBeam_trace_callback);
128         Draw_VaporizerBeam_trace_callback_tex = string_null;
129
130         /*if(!MUTATOR_CALLHOOK(Particles_VaporizerBeam, this.vorg1, this.vorg2))
131         if(autocvar_cl_particles_oldvortexbeam && (STAT(ALLOW_OLDVORTEXBEAM) || isdemo()))
132                 WarpZone_TrailParticles_WithMultiplier(world, particleeffectnum(EFFECT_VORTEX_BEAM_OLD), this.vorg1, this.vorg2, 1, PARTICLES_USEALPHA | PARTICLES_USEFADE);
133         else
134                 WarpZone_TrailParticles_WithMultiplier(world, particleeffectnum(EFFECT_VORTEX_BEAM), this.vorg1, this.vorg2, 1, PARTICLES_USEALPHA | PARTICLES_USEFADE);*/
135 }
136
137 NET_HANDLE(TE_CSQC_VAPORBEAMPARTICLE, bool isNew)
138 {
139         Net_Accept(vortex_beam);
140         this.think = SUB_Remove_self;
141         this.nextthink = time + bound(0, autocvar_cl_vaporizerbeam_lifetime, 10);
142         this.draw = VaporizerBeam_Draw;
143         this.drawmask = MASK_NORMAL;
144
145         this.vorg1_x = ReadCoord(); this.vorg1_y = ReadCoord(); this.vorg1_z = ReadCoord();
146         this.vorg2_x = ReadCoord(); this.vorg2_y = ReadCoord(); this.vorg2_z = ReadCoord();
147         this.cnt = ReadByte();
148         int myowner = ReadByte();
149         this.owner = playerslots[myowner - 1];
150         this.sv_entnum = myowner;
151         this.team = ReadByte() - 1;
152
153         if(autocvar_cl_vaporizerbeam_particle)
154         {
155                 WarpZone_TrailParticles(world, particleeffectnum(((this.cnt) ? EFFECT_VAPORIZER_HIT(this.team) : EFFECT_VAPORIZER(this.team))), this.vorg1, this.vorg2);
156                 this.draw = func_null;
157                 this.drawmask = MASK_NORMAL;
158                 remove(this);
159         }
160
161         pointparticles(EFFECT_VORTEX_MUZZLEFLASH, this.vorg1, normalize(this.vorg2 - this.vorg1) * 1000, 1);
162         return true;
163 }
164 #endif
165
166 #ifdef SVQC
167 spawnfunc(weapon_vaporizer) { weapon_defaultspawnfunc(this, WEP_VAPORIZER); }
168 spawnfunc(weapon_minstanex) { spawnfunc_weapon_vaporizer(this); }
169
170 void W_RocketMinsta_Explosion(vector loc)
171 {SELFPARAM();
172         if(accuracy_canbegooddamage(self))
173                 accuracy_add(self, WEP_DEVASTATOR.m_id, autocvar_g_rm_damage, 0);
174         entity dmgent = spawn();
175         dmgent.owner = dmgent.realowner = self;
176         setorigin(dmgent, loc);
177         RadiusDamage (dmgent, self, autocvar_g_rm_damage, autocvar_g_rm_edgedamage, autocvar_g_rm_radius, world, world, autocvar_g_rm_force, WEP_DEVASTATOR.m_id | HITTYPE_SPLASH, other);
178         remove(dmgent);
179 }
180
181 void W_Vaporizer_Attack(Weapon thiswep)
182 {SELFPARAM();
183         bool flying = IsFlying(self); // do this BEFORE to make the trace values from FireRailgunBullet last
184         float vaporizer_damage = ((WEP_CVAR_PRI(vaporizer, damage) > 0) ? WEP_CVAR_PRI(vaporizer, damage) : 10000);
185
186         W_SetupShot(self, true, 0, SND_Null, CH_WEAPON_A, vaporizer_damage);
187         // handle sound separately so we can change the volume
188         // added bonus: no longer plays the strength sound (strength gives no bonus to instakill anyway)
189         sound (self, CH_WEAPON_A, SND_MINSTANEXFIRE, VOL_BASE * 0.8, ATTEN_NORM);
190
191         yoda = 0;
192         damage_goodhits = 0;
193         FireRailgunBullet(w_shotorg, w_shotorg + w_shotdir * MAX_SHOT_DISTANCE, vaporizer_damage, 800, 0, 0, 0, 0, WEP_VAPORIZER.m_id);
194
195         // do this now, as goodhits is disabled below
196         SendCSQCVaporizerBeamParticle(self, damage_goodhits);
197
198         if(yoda && flying)
199                 Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_ACHIEVEMENT_YODA);
200         if(damage_goodhits && self.vaporizer_lasthit)
201         {
202                 Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_ACHIEVEMENT_IMPRESSIVE);
203                 damage_goodhits = 0; // only every second time
204         }
205
206         self.vaporizer_lasthit = damage_goodhits;
207
208         if(autocvar_g_rm)
209         if(!(trace_dphitq3surfaceflags & (Q3SURFACEFLAG_SKY | Q3SURFACEFLAG_NOIMPACT)))
210                 W_RocketMinsta_Explosion(trace_endpos);
211
212         W_DecreaseAmmo(thiswep, self, ((g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo)));
213 }
214
215 void W_RocketMinsta_Laser_Explode ()
216 {SELFPARAM();
217         if(other.takedamage == DAMAGE_AIM)
218                 if(IS_PLAYER(other))
219                         if(DIFF_TEAM(self.realowner, other))
220                                 if(!IS_DEAD(other))
221                                         if(IsFlying(other))
222                                                 Send_Notification(NOTIF_ONE, self.realowner, MSG_ANNCE, ANNCE_ACHIEVEMENT_ELECTROBITCH);
223
224         self.event_damage = func_null;
225         self.takedamage = DAMAGE_NO;
226         RadiusDamage (self, self.realowner, self.rm_damage, self.rm_edmg, autocvar_g_rm_laser_radius, world, world, self.rm_force, self.projectiledeathtype, other);
227         remove(self);
228 }
229
230 void W_RocketMinsta_Laser_Explode_use(entity this, entity actor, entity trigger)
231 {
232         WITHSELF(this, W_RocketMinsta_Laser_Explode());
233 }
234
235 void W_RocketMinsta_Laser_Touch ()
236 {SELFPARAM();
237         PROJECTILE_TOUCH;
238         //W_RocketMinsta_Laser_Explode ();
239         RadiusDamage (self, self.realowner, self.rm_damage, self.rm_edmg, autocvar_g_rm_laser_radius, world, world, self.rm_force, self.projectiledeathtype, other);
240         remove(self);
241 }
242
243 void W_RocketMinsta_Attack2()
244 {SELFPARAM();
245         makevectors(self.v_angle);
246
247         entity proj;
248         float counter = 0;
249         float total = autocvar_g_rm_laser_count;
250         float spread = autocvar_g_rm_laser_spread;
251         float rndspread = autocvar_g_rm_laser_spread_random;
252
253         Weapon w = PS(self).m_weapon;
254         PS(self).m_weapon = WEP_ELECTRO;
255         W_SetupShot_ProjectileSize (self, '0 0 -3', '0 0 -3', false, 2, SND_CRYLINK_FIRE, CH_WEAPON_A, autocvar_g_rm_laser_damage);
256         PS(self).m_weapon = w;
257
258         Send_Effect(EFFECT_ELECTRO_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
259
260     while(counter < total)
261         {
262         proj = new(plasma_prim);
263         proj.owner = proj.realowner = self;
264         proj.bot_dodge = true;
265         proj.bot_dodgerating = autocvar_g_rm_laser_damage;
266         proj.use = W_RocketMinsta_Laser_Explode_use;
267         proj.think = adaptor_think2use_hittype_splash;
268         proj.nextthink = time + autocvar_g_rm_laser_lifetime;
269         PROJECTILE_MAKETRIGGER(proj);
270         proj.projectiledeathtype = WEP_ELECTRO.m_id;
271         setorigin(proj, w_shotorg);
272
273                 proj.rm_force = autocvar_g_rm_laser_force / total;
274                 proj.rm_damage = autocvar_g_rm_laser_damage / total;
275                 proj.rm_edmg = proj.rm_damage;
276
277         //W_SetupProjectileVelocity(proj, autocvar_g_rm_laser_speed, spread * (rndspread ? random() : 1) * autocvar_g_rm_laser_speed);
278
279         proj.movetype = MOVETYPE_BOUNCEMISSILE;
280         //W_SETUPPROJECTILEVELOCITY(proj, g_balance_minstanex_laser);
281                 proj.velocity = (w_shotdir + (((counter + 0.5) / total) * 2 - 1) * v_right * (spread * (rndspread ? random() : 1))) * cvar("g_rm_laser_speed");
282                 proj.velocity_z = proj.velocity_z + cvar("g_rm_laser_zspread") * (random() - 0.5);
283                 proj.velocity = W_CalculateProjectileVelocity(proj.realowner.velocity, proj.velocity, true);
284         proj.angles = vectoangles(proj.velocity);
285         proj.touch = W_RocketMinsta_Laser_Touch;
286         setsize(proj, '0 0 -3', '0 0 -3');
287         proj.flags = FL_PROJECTILE;
288         proj.missile_flags = MIF_SPLASH;
289
290         CSQCProjectile(proj, true, PROJECTILE_ROCKETMINSTA_LASER, true);
291
292         MUTATOR_CALLHOOK(EditProjectile, self, proj);
293         counter++;
294     }
295 }
296
297 void W_RocketMinsta_Attack3 ()
298 {SELFPARAM();
299         makevectors(self.v_angle);
300
301         entity proj;
302         float counter = 0;
303         float total = 1;
304
305         Weapon w = PS(self).m_weapon;
306         PS(self).m_weapon = WEP_ELECTRO;
307         W_SetupShot_ProjectileSize (self, '0 0 -3', '0 0 -3', false, 2, SND_ELECTRO_FIRE2, CH_WEAPON_A, autocvar_g_rm_laser_damage);
308         PS(self).m_weapon = w;
309
310         Send_Effect(EFFECT_ELECTRO_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
311
312     while(counter < total)
313         {
314         proj = new(plasma_prim);
315         proj.owner = proj.realowner = self;
316         proj.bot_dodge = true;
317         proj.bot_dodgerating = autocvar_g_rm_laser_damage;
318         proj.use = W_RocketMinsta_Laser_Explode_use;
319         proj.think = adaptor_think2use_hittype_splash;
320         proj.nextthink = time + autocvar_g_rm_laser_lifetime;
321         PROJECTILE_MAKETRIGGER(proj);
322         proj.projectiledeathtype = WEP_ELECTRO.m_id;
323         setorigin(proj, w_shotorg);
324
325                 proj.rm_force = autocvar_g_rm_laser_force / total;
326                 proj.rm_damage = autocvar_g_rm_laser_damage / total;
327                 proj.rm_edmg = proj.rm_damage;
328
329         //W_SetupProjectileVelocity(proj, autocvar_g_rm_laser_speed, spread * (rndspread ? random() : 1) * autocvar_g_rm_laser_speed);
330
331         proj.movetype = MOVETYPE_BOUNCEMISSILE;
332                 proj.velocity = w_shotdir * autocvar_g_rm_laser_speed;
333                 proj.velocity = W_CalculateProjectileVelocity(proj.realowner.velocity, proj.velocity, true);
334         proj.angles = vectoangles(proj.velocity);
335         proj.touch = W_RocketMinsta_Laser_Touch;
336         setsize(proj, '0 0 -3', '0 0 -3');
337         proj.flags = FL_PROJECTILE;
338         proj.missile_flags = MIF_SPLASH;
339
340         CSQCProjectile(proj, true, PROJECTILE_ROCKETMINSTA_LASER, true);
341
342         MUTATOR_CALLHOOK(EditProjectile, self, proj);
343         counter++;
344     }
345 }
346
347 METHOD(Vaporizer, wr_aim, void(entity thiswep))
348 {
349     SELFPARAM();
350     if(self.(thiswep.ammo_field) > 0)
351         PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(self, 1000000, 0, 1, false);
352     else
353         PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(self, WEP_CVAR_SEC(vaporizer, speed), 0, WEP_CVAR_SEC(vaporizer, lifetime), false); // WEAPONTODO: replace with proper vaporizer cvars
354 }
355 METHOD(Vaporizer, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
356 {
357     float vaporizer_ammo = ((g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo));
358     // if the laser uses load, we also consider its ammo for reloading
359     if(WEP_CVAR(vaporizer, reload_ammo) && WEP_CVAR_SEC(vaporizer, ammo) && actor.clip_load < min(vaporizer_ammo, WEP_CVAR_SEC(vaporizer, ammo))) { // forced reload
360         thiswep.wr_reload(thiswep, actor, weaponentity);
361     } else if(WEP_CVAR(vaporizer, reload_ammo) && actor.clip_load < vaporizer_ammo) { // forced reload
362         thiswep.wr_reload(thiswep, actor, weaponentity);
363     }
364     if((fire & 1) && (actor.ammo_cells || !autocvar_g_rm) && !forbidWeaponUse(actor))
365     {
366         if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(vaporizer, refire)))
367         {
368             W_Vaporizer_Attack(thiswep);
369             weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(vaporizer, animtime), w_ready);
370         }
371     }
372     if((fire & 2) || ((fire & 1) && !actor.ammo_cells && autocvar_g_rm))
373     {
374         if((autocvar_g_rm && autocvar_g_rm_laser) || autocvar_g_rm_laser == 2)
375         {
376             bool rapid = autocvar_g_rm_laser_rapid;
377             if(actor.jump_interval <= time && !actor.held_down)
378             {
379                 if(rapid)
380                     actor.held_down = true;
381                 actor.jump_interval = time + autocvar_g_rm_laser_refire;
382                 actor.jump_interval2 = time + autocvar_g_rm_laser_rapid_delay;
383                 damage_goodhits = 0;
384                 W_RocketMinsta_Attack2();
385             }
386             else if(rapid && actor.jump_interval2 <= time && actor.held_down)
387             {
388                 actor.jump_interval2 = time + autocvar_g_rm_laser_rapid_refire;
389                 damage_goodhits = 0;
390                 W_RocketMinsta_Attack3();
391                 //weapon_thinkf(actor, WFRAME_FIRE2, autocvar_g_rm_laser_rapid_animtime, w_ready);
392             }
393         }
394         else if (actor.jump_interval <= time)
395         {
396             // handle refire manually, so that primary and secondary can be fired without conflictions (important for instagib)
397             actor.jump_interval = time + WEP_CVAR_SEC(vaporizer, refire) * W_WeaponRateFactor();
398
399             // decrease ammo for the laser?
400             if(WEP_CVAR_SEC(vaporizer, ammo))
401                 W_DecreaseAmmo(thiswep, actor, WEP_CVAR_SEC(vaporizer, ammo));
402
403             // ugly instagib hack to reuse the fire mode of the laser
404             makevectors(actor.v_angle);
405             Weapon oldwep = PS(actor).m_weapon; // we can't avoid this hack
406             PS(actor).m_weapon = WEP_BLASTER;
407             W_Blaster_Attack(
408                 actor,
409                 WEP_BLASTER.m_id | HITTYPE_SECONDARY,
410                 WEP_CVAR_SEC(vaporizer, shotangle),
411                 WEP_CVAR_SEC(vaporizer, damage),
412                 WEP_CVAR_SEC(vaporizer, edgedamage),
413                 WEP_CVAR_SEC(vaporizer, radius),
414                 WEP_CVAR_SEC(vaporizer, force),
415                 WEP_CVAR_SEC(vaporizer, speed),
416                 WEP_CVAR_SEC(vaporizer, spread),
417                 WEP_CVAR_SEC(vaporizer, delay),
418                 WEP_CVAR_SEC(vaporizer, lifetime)
419             );
420             PS(actor).m_weapon = oldwep;
421
422             // now do normal refire
423             weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(vaporizer, animtime), w_ready);
424         }
425     }
426     else
427         actor.held_down = false;
428 }
429 METHOD(Vaporizer, wr_setup, void(entity thiswep))
430 {
431     SELFPARAM();
432     self.ammo_field = (thiswep.ammo_field);
433     self.vaporizer_lasthit = 0;
434 }
435 METHOD(Vaporizer, wr_checkammo1, bool(entity thiswep))
436 {
437     SELFPARAM();
438     float vaporizer_ammo = ((g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo));
439     float ammo_amount = self.(thiswep.ammo_field) >= vaporizer_ammo;
440     ammo_amount += self.(weapon_load[WEP_VAPORIZER.m_id]) >= vaporizer_ammo;
441     return ammo_amount;
442 }
443 METHOD(Vaporizer, wr_checkammo2, bool(entity thiswep))
444 {
445     SELFPARAM();
446     if(!WEP_CVAR_SEC(vaporizer, ammo))
447         return true;
448     float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_SEC(vaporizer, ammo);
449     ammo_amount += self.(weapon_load[WEP_VAPORIZER.m_id]) >= WEP_CVAR_SEC(vaporizer, ammo);
450     return ammo_amount;
451 }
452 METHOD(Vaporizer, wr_resetplayer, void(entity thiswep))
453 {
454     SELFPARAM();
455     self.vaporizer_lasthit = 0;
456 }
457 METHOD(Vaporizer, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
458 {
459     SELFPARAM();
460     float vaporizer_ammo = ((g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo));
461     float used_ammo;
462     if(WEP_CVAR_SEC(vaporizer, ammo))
463         used_ammo = min(vaporizer_ammo, WEP_CVAR_SEC(vaporizer, ammo));
464     else
465         used_ammo = vaporizer_ammo;
466
467     W_Reload(self, used_ammo, SND_RELOAD);
468 }
469 METHOD(Vaporizer, wr_suicidemessage, Notification(entity thiswep))
470 {
471     return WEAPON_THINKING_WITH_PORTALS;
472 }
473 METHOD(Vaporizer, wr_killmessage, Notification(entity thiswep))
474 {
475     return WEAPON_VAPORIZER_MURDER;
476 }
477
478 #endif
479 #ifdef CSQC
480
481 METHOD(Vaporizer, wr_impacteffect, void(entity thiswep))
482 {
483     SELFPARAM();
484     vector org2 = w_org + w_backoff * 6;
485     if(w_deathtype & HITTYPE_SECONDARY)
486     {
487         pointparticles(EFFECT_BLASTER_IMPACT, org2, w_backoff * 1000, 1);
488         if(!w_issilent) { sound(self, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTN_NORM); }
489     }
490     else
491     {
492         pointparticles(EFFECT_VORTEX_IMPACT, org2, '0 0 0', 1);
493         if(!w_issilent) { sound(self, CH_SHOTS, SND_NEXIMPACT, VOL_BASE, ATTN_NORM); }
494     }
495 }
496 METHOD(Vaporizer, wr_init, void(entity thiswep))
497 {
498     if(autocvar_cl_reticle && autocvar_cl_reticle_weapon)
499     {
500         precache_pic("gfx/reticle_nex");
501     }
502 }
503 METHOD(Vaporizer, wr_zoomreticle, bool(entity thiswep))
504 {
505     if(button_zoom || zoomscript_caught)
506     {
507         reticle_image = "gfx/reticle_nex";
508         return true;
509     }
510     else
511     {
512         // no weapon specific image for this weapon
513         return false;
514     }
515 }
516
517 #endif
518 #endif