]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/weapons/weapon/vaporizer.qc
Merge branch 'Mario/teams_bitflag' into 'master'
[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, NULL, NULL, 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(NULL, particleeffectnum(EFFECT_VORTEX_BEAM_OLD), this.vorg1, this.vorg2, 1, PARTICLES_USEALPHA | PARTICLES_USEFADE);
133         else
134                 WarpZone_TrailParticles_WithMultiplier(NULL, 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         setthink(this, SUB_Remove);
141         this.nextthink = time + bound(0, autocvar_cl_vaporizerbeam_lifetime, 10);
142         this.draw = VaporizerBeam_Draw;
143         if (isNew) IL_PUSH(g_drawables, this);
144         this.drawmask = MASK_NORMAL;
145
146         this.vorg1_x = ReadCoord(); this.vorg1_y = ReadCoord(); this.vorg1_z = ReadCoord();
147         this.vorg2_x = ReadCoord(); this.vorg2_y = ReadCoord(); this.vorg2_z = ReadCoord();
148         this.cnt = ReadByte();
149         int myowner = ReadByte();
150         this.owner = playerslots[myowner - 1];
151         this.sv_entnum = myowner;
152         this.team = ReadByte() - 1;
153
154         pointparticles(EFFECT_VORTEX_MUZZLEFLASH, this.vorg1, normalize(this.vorg2 - this.vorg1) * 1000, 1);
155
156         if(autocvar_cl_vaporizerbeam_particle)
157         {
158                 WarpZone_TrailParticles(NULL, particleeffectnum(((this.cnt) ? EFFECT_VAPORIZER_HIT(this.team) : EFFECT_VAPORIZER(this.team))), this.vorg1, this.vorg2);
159                 this.draw = func_null;
160                 this.drawmask = MASK_NORMAL;
161                 remove(this);
162         }
163
164         return true;
165 }
166 #endif
167
168 #ifdef SVQC
169 spawnfunc(weapon_vaporizer) { weapon_defaultspawnfunc(this, WEP_VAPORIZER); }
170 spawnfunc(weapon_minstanex) { spawnfunc_weapon_vaporizer(this); }
171
172 void W_RocketMinsta_Explosion(entity actor, vector loc)
173 {
174         if(accuracy_canbegooddamage(actor))
175                 accuracy_add(actor, WEP_DEVASTATOR.m_id, autocvar_g_rm_damage, 0);
176         entity dmgent = spawn();
177         dmgent.owner = dmgent.realowner = actor;
178         setorigin(dmgent, loc);
179         RadiusDamage (dmgent, actor, autocvar_g_rm_damage, autocvar_g_rm_edgedamage, autocvar_g_rm_radius, NULL, NULL, autocvar_g_rm_force, WEP_DEVASTATOR.m_id | HITTYPE_SPLASH, other);
180         remove(dmgent);
181 }
182
183 void W_Vaporizer_Attack(Weapon thiswep, entity actor)
184 {
185         bool flying = IsFlying(actor); // do this BEFORE to make the trace values from FireRailgunBullet last
186         float vaporizer_damage = ((WEP_CVAR_PRI(vaporizer, damage) > 0) ? WEP_CVAR_PRI(vaporizer, damage) : 10000);
187
188         W_SetupShot(actor, true, 0, SND_Null, CH_WEAPON_A, vaporizer_damage);
189         // handle sound separately so we can change the volume
190         // added bonus: no longer plays the strength sound (strength gives no bonus to instakill anyway)
191         sound (actor, CH_WEAPON_A, SND_MINSTANEXFIRE, VOL_BASE * 0.8, ATTEN_NORM);
192
193         yoda = 0;
194         damage_goodhits = 0;
195         FireRailgunBullet(actor, w_shotorg, w_shotorg + w_shotdir * MAX_SHOT_DISTANCE, vaporizer_damage, 800, 0, 0, 0, 0, WEP_VAPORIZER.m_id);
196
197         // do this now, as goodhits is disabled below
198         SendCSQCVaporizerBeamParticle(actor, damage_goodhits);
199
200         if(yoda && flying)
201                 Send_Notification(NOTIF_ONE, actor, MSG_ANNCE, ANNCE_ACHIEVEMENT_YODA);
202         if(damage_goodhits && actor.vaporizer_lasthit)
203         {
204                 Send_Notification(NOTIF_ONE, actor, MSG_ANNCE, ANNCE_ACHIEVEMENT_IMPRESSIVE);
205                 damage_goodhits = 0; // only every second time
206         }
207
208         actor.vaporizer_lasthit = damage_goodhits;
209
210         if(autocvar_g_rm)
211         if(!(trace_dphitq3surfaceflags & (Q3SURFACEFLAG_SKY | Q3SURFACEFLAG_NOIMPACT)))
212                 W_RocketMinsta_Explosion(actor, trace_endpos);
213
214         W_DecreaseAmmo(thiswep, actor, ((g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo)));
215 }
216
217 void W_RocketMinsta_Laser_Explode (entity this)
218 {
219         if(other.takedamage == DAMAGE_AIM)
220                 if(IS_PLAYER(other))
221                         if(DIFF_TEAM(this.realowner, other))
222                                 if(!IS_DEAD(other))
223                                         if(IsFlying(other))
224                                                 Send_Notification(NOTIF_ONE, this.realowner, MSG_ANNCE, ANNCE_ACHIEVEMENT_ELECTROBITCH);
225
226         this.event_damage = func_null;
227         this.takedamage = DAMAGE_NO;
228         RadiusDamage (this, this.realowner, this.rm_damage, this.rm_edmg, autocvar_g_rm_laser_radius, NULL, NULL, this.rm_force, this.projectiledeathtype, other);
229         remove(this);
230 }
231
232 void W_RocketMinsta_Laser_Explode_use(entity this, entity actor, entity trigger)
233 {
234         W_RocketMinsta_Laser_Explode(this);
235 }
236
237 void W_RocketMinsta_Laser_Touch(entity this, entity toucher)
238 {
239         PROJECTILE_TOUCH(this, toucher);
240         //W_RocketMinsta_Laser_Explode ();
241         RadiusDamage(this, this.realowner, this.rm_damage, this.rm_edmg, autocvar_g_rm_laser_radius, NULL, NULL, this.rm_force, this.projectiledeathtype, toucher);
242         remove(this);
243 }
244
245 void W_RocketMinsta_Attack2(entity actor)
246 {
247         makevectors(actor.v_angle);
248
249         entity proj;
250         float counter = 0;
251         float total = autocvar_g_rm_laser_count;
252         float spread = autocvar_g_rm_laser_spread;
253         float rndspread = autocvar_g_rm_laser_spread_random;
254
255         Weapon w = PS(actor).m_weapon;
256         PS(actor).m_weapon = WEP_ELECTRO;
257         W_SetupShot_ProjectileSize (actor, '0 0 -3', '0 0 -3', false, 2, SND_CRYLINK_FIRE, CH_WEAPON_A, autocvar_g_rm_laser_damage);
258         PS(actor).m_weapon = w;
259
260         Send_Effect(EFFECT_ELECTRO_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
261
262     while(counter < total)
263         {
264         proj = new(plasma_prim);
265         proj.owner = proj.realowner = actor;
266         proj.bot_dodge = true;
267         proj.bot_dodgerating = autocvar_g_rm_laser_damage;
268         proj.use = W_RocketMinsta_Laser_Explode_use;
269         setthink(proj, adaptor_think2use_hittype_splash);
270         proj.nextthink = time + autocvar_g_rm_laser_lifetime;
271         PROJECTILE_MAKETRIGGER(proj);
272         proj.projectiledeathtype = WEP_ELECTRO.m_id;
273         setorigin(proj, w_shotorg);
274
275                 proj.rm_force = autocvar_g_rm_laser_force / total;
276                 proj.rm_damage = autocvar_g_rm_laser_damage / total;
277                 proj.rm_edmg = proj.rm_damage;
278
279         //W_SetupProjectileVelocity(proj, autocvar_g_rm_laser_speed, spread * (rndspread ? random() : 1) * autocvar_g_rm_laser_speed);
280
281         set_movetype(proj, MOVETYPE_BOUNCEMISSILE);
282         //W_SETUPPROJECTILEVELOCITY(proj, g_balance_minstanex_laser);
283                 proj.velocity = (w_shotdir + (((counter + 0.5) / total) * 2 - 1) * v_right * (spread * (rndspread ? random() : 1))) * cvar("g_rm_laser_speed");
284                 proj.velocity_z = proj.velocity_z + cvar("g_rm_laser_zspread") * (random() - 0.5);
285                 proj.velocity = W_CalculateProjectileVelocity(actor, actor.velocity, proj.velocity, true);
286         proj.angles = vectoangles(proj.velocity);
287         settouch(proj, W_RocketMinsta_Laser_Touch);
288         setsize(proj, '0 0 -3', '0 0 -3');
289         proj.flags = FL_PROJECTILE;
290         proj.missile_flags = MIF_SPLASH;
291
292         CSQCProjectile(proj, true, PROJECTILE_ROCKETMINSTA_LASER, true);
293
294         MUTATOR_CALLHOOK(EditProjectile, actor, proj);
295         counter++;
296     }
297 }
298
299 void W_RocketMinsta_Attack3 (entity actor)
300 {
301         makevectors(actor.v_angle);
302
303         entity proj;
304         float counter = 0;
305         float total = 1;
306
307         Weapon w = PS(actor).m_weapon;
308         PS(actor).m_weapon = WEP_ELECTRO;
309         W_SetupShot_ProjectileSize (actor, '0 0 -3', '0 0 -3', false, 2, SND_ELECTRO_FIRE2, CH_WEAPON_A, autocvar_g_rm_laser_damage);
310         PS(actor).m_weapon = w;
311
312         Send_Effect(EFFECT_ELECTRO_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
313
314     while(counter < total)
315         {
316         proj = new(plasma_prim);
317         proj.owner = proj.realowner = actor;
318         proj.bot_dodge = true;
319         proj.bot_dodgerating = autocvar_g_rm_laser_damage;
320         proj.use = W_RocketMinsta_Laser_Explode_use;
321         setthink(proj, adaptor_think2use_hittype_splash);
322         proj.nextthink = time + autocvar_g_rm_laser_lifetime;
323         PROJECTILE_MAKETRIGGER(proj);
324         proj.projectiledeathtype = WEP_ELECTRO.m_id;
325         setorigin(proj, w_shotorg);
326
327                 proj.rm_force = autocvar_g_rm_laser_force / total;
328                 proj.rm_damage = autocvar_g_rm_laser_damage / total;
329                 proj.rm_edmg = proj.rm_damage;
330
331         //W_SetupProjectileVelocity(proj, autocvar_g_rm_laser_speed, spread * (rndspread ? random() : 1) * autocvar_g_rm_laser_speed);
332
333         set_movetype(proj, MOVETYPE_BOUNCEMISSILE);
334                 proj.velocity = w_shotdir * autocvar_g_rm_laser_speed;
335                 proj.velocity = W_CalculateProjectileVelocity(actor, actor.velocity, proj.velocity, true);
336         proj.angles = vectoangles(proj.velocity);
337         settouch(proj, W_RocketMinsta_Laser_Touch);
338         setsize(proj, '0 0 -3', '0 0 -3');
339         proj.flags = FL_PROJECTILE;
340         proj.missile_flags = MIF_SPLASH;
341
342         CSQCProjectile(proj, true, PROJECTILE_ROCKETMINSTA_LASER, true);
343
344         MUTATOR_CALLHOOK(EditProjectile, actor, proj);
345         counter++;
346     }
347 }
348
349 METHOD(Vaporizer, wr_aim, void(entity thiswep, entity actor))
350 {
351     if(actor.(thiswep.ammo_field) > 0)
352         PHYS_INPUT_BUTTON_ATCK(actor) = bot_aim(actor, 1000000, 0, 1, false);
353     else
354         PHYS_INPUT_BUTTON_ATCK2(actor) = bot_aim(actor, WEP_CVAR_SEC(vaporizer, speed), 0, WEP_CVAR_SEC(vaporizer, lifetime), false); // WEAPONTODO: replace with proper vaporizer cvars
355 }
356 METHOD(Vaporizer, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
357 {
358     float vaporizer_ammo = ((g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo));
359     // if the laser uses load, we also consider its ammo for reloading
360     if(WEP_CVAR(vaporizer, reload_ammo) && WEP_CVAR_SEC(vaporizer, ammo) && actor.clip_load < min(vaporizer_ammo, WEP_CVAR_SEC(vaporizer, ammo))) { // forced reload
361         thiswep.wr_reload(thiswep, actor, weaponentity);
362     } else if(WEP_CVAR(vaporizer, reload_ammo) && actor.clip_load < vaporizer_ammo) { // forced reload
363         thiswep.wr_reload(thiswep, actor, weaponentity);
364     }
365     if((fire & 1) && (actor.ammo_cells || !autocvar_g_rm) && !forbidWeaponUse(actor))
366     {
367         if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(vaporizer, refire)))
368         {
369             W_Vaporizer_Attack(thiswep, actor);
370             weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(vaporizer, animtime), w_ready);
371         }
372     }
373     if((fire & 2) || ((fire & 1) && !actor.ammo_cells && autocvar_g_rm))
374     {
375         if((autocvar_g_rm && autocvar_g_rm_laser) || autocvar_g_rm_laser == 2)
376         {
377             bool rapid = autocvar_g_rm_laser_rapid;
378             if(actor.jump_interval <= time && !actor.held_down)
379             {
380                 if(rapid)
381                     actor.held_down = true;
382                 actor.jump_interval = time + autocvar_g_rm_laser_refire;
383                 actor.jump_interval2 = time + autocvar_g_rm_laser_rapid_delay;
384                 damage_goodhits = 0;
385                 W_RocketMinsta_Attack2(actor);
386             }
387             else if(rapid && actor.jump_interval2 <= time && actor.held_down)
388             {
389                 actor.jump_interval2 = time + autocvar_g_rm_laser_rapid_refire;
390                 damage_goodhits = 0;
391                 W_RocketMinsta_Attack3(actor);
392                 //weapon_thinkf(actor, WFRAME_FIRE2, autocvar_g_rm_laser_rapid_animtime, w_ready);
393             }
394         }
395         else if (actor.jump_interval <= time)
396         {
397             // handle refire manually, so that primary and secondary can be fired without conflictions (important for instagib)
398             actor.jump_interval = time + WEP_CVAR_SEC(vaporizer, refire) * W_WeaponRateFactor(actor);
399
400             // decrease ammo for the laser?
401             if(WEP_CVAR_SEC(vaporizer, ammo))
402                 W_DecreaseAmmo(thiswep, actor, WEP_CVAR_SEC(vaporizer, ammo));
403
404             // ugly instagib hack to reuse the fire mode of the laser
405             makevectors(actor.v_angle);
406             Weapon oldwep = PS(actor).m_weapon; // we can't avoid this hack
407             PS(actor).m_weapon = WEP_BLASTER;
408             W_Blaster_Attack(
409                 actor,
410                 WEP_BLASTER.m_id | HITTYPE_SECONDARY,
411                 WEP_CVAR_SEC(vaporizer, shotangle),
412                 WEP_CVAR_SEC(vaporizer, damage),
413                 WEP_CVAR_SEC(vaporizer, edgedamage),
414                 WEP_CVAR_SEC(vaporizer, radius),
415                 WEP_CVAR_SEC(vaporizer, force),
416                 WEP_CVAR_SEC(vaporizer, speed),
417                 WEP_CVAR_SEC(vaporizer, spread),
418                 WEP_CVAR_SEC(vaporizer, delay),
419                 WEP_CVAR_SEC(vaporizer, lifetime)
420             );
421             PS(actor).m_weapon = oldwep;
422
423             // now do normal refire
424             weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(vaporizer, animtime), w_ready);
425         }
426     }
427     else
428         actor.held_down = false;
429 }
430 METHOD(Vaporizer, wr_setup, void(entity thiswep, entity actor))
431 {
432     actor.ammo_field = (thiswep.ammo_field);
433     actor.vaporizer_lasthit = 0;
434 }
435 METHOD(Vaporizer, wr_checkammo1, bool(entity thiswep, entity actor))
436 {
437     float vaporizer_ammo = ((g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo));
438     float ammo_amount = actor.(thiswep.ammo_field) >= vaporizer_ammo;
439     ammo_amount += actor.(weapon_load[WEP_VAPORIZER.m_id]) >= vaporizer_ammo;
440     return ammo_amount;
441 }
442 METHOD(Vaporizer, wr_checkammo2, bool(entity thiswep, entity actor))
443 {
444     if(!WEP_CVAR_SEC(vaporizer, ammo))
445         return true;
446     float ammo_amount = actor.(thiswep.ammo_field) >= WEP_CVAR_SEC(vaporizer, ammo);
447     ammo_amount += actor.(weapon_load[WEP_VAPORIZER.m_id]) >= WEP_CVAR_SEC(vaporizer, ammo);
448     return ammo_amount;
449 }
450 METHOD(Vaporizer, wr_resetplayer, void(entity thiswep, entity actor))
451 {
452     actor.vaporizer_lasthit = 0;
453 }
454 METHOD(Vaporizer, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
455 {
456     float vaporizer_ammo = ((g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo));
457     float used_ammo;
458     if(WEP_CVAR_SEC(vaporizer, ammo))
459         used_ammo = min(vaporizer_ammo, WEP_CVAR_SEC(vaporizer, ammo));
460     else
461         used_ammo = vaporizer_ammo;
462
463     W_Reload(actor, used_ammo, SND_RELOAD);
464 }
465 METHOD(Vaporizer, wr_suicidemessage, Notification(entity thiswep))
466 {
467     return WEAPON_THINKING_WITH_PORTALS;
468 }
469 METHOD(Vaporizer, wr_killmessage, Notification(entity thiswep))
470 {
471     return WEAPON_VAPORIZER_MURDER;
472 }
473
474 #endif
475 #ifdef CSQC
476
477 METHOD(Vaporizer, wr_impacteffect, void(entity thiswep, entity actor))
478 {
479     vector org2 = w_org + w_backoff * 6;
480     if(w_deathtype & HITTYPE_SECONDARY)
481     {
482         pointparticles(EFFECT_BLASTER_IMPACT, org2, w_backoff * 1000, 1);
483         if(!w_issilent) { sound(actor, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTN_NORM); }
484     }
485     else
486     {
487         pointparticles(EFFECT_VORTEX_IMPACT, org2, '0 0 0', 1);
488         if(!w_issilent) { sound(actor, CH_SHOTS, SND_NEXIMPACT, VOL_BASE, ATTN_NORM); }
489     }
490 }
491 METHOD(Vaporizer, wr_init, void(entity thiswep))
492 {
493     if(autocvar_cl_reticle && autocvar_cl_reticle_weapon)
494     {
495         precache_pic("gfx/reticle_nex");
496     }
497 }
498 METHOD(Vaporizer, wr_zoomreticle, bool(entity thiswep))
499 {
500     if(button_zoom || zoomscript_caught)
501     {
502         reticle_image = "gfx/reticle_nex";
503         return true;
504     }
505     else
506     {
507         // no weapon specific image for this weapon
508         return false;
509     }
510 }
511
512 #endif
513 #endif