3 /* WEP_##id */ VAPORIZER,
4 /* function */ W_Vaporizer,
5 /* ammotype */ ammo_cells,
7 /* flags */ WEP_FLAG_RELOADABLE | WEP_FLAG_CANCLIMB | WEP_FLAG_SUPERWEAPON | WEP_TYPE_HITSCAN,
8 /* rating */ BOT_PICKUP_RATING_HIGH,
10 /* modelname */ "minstanex",
11 /* simplemdl */ "foobar",
12 /* crosshair */ "gfx/crosshairminstanex 0.6",
13 /* wepimg */ "weaponminstanex",
14 /* refname */ "vaporizer",
15 /* wepname */ _("Vaporizer")
18 #define VAPORIZER_SETTINGS(w_cvar,w_prop) VAPORIZER_SETTINGS_LIST(w_cvar, w_prop, VAPORIZER, vaporizer)
19 #define VAPORIZER_SETTINGS_LIST(w_cvar,w_prop,id,sn) \
20 w_cvar(id, sn, PRI, ammo) \
21 w_cvar(id, sn, PRI, animtime) \
22 w_cvar(id, sn, PRI, refire) \
23 w_cvar(id, sn, SEC, ammo) \
24 w_cvar(id, sn, SEC, animtime) \
25 w_cvar(id, sn, SEC, damage) \
26 w_cvar(id, sn, SEC, delay) \
27 w_cvar(id, sn, SEC, edgedamage) \
28 w_cvar(id, sn, SEC, force) \
29 w_cvar(id, sn, SEC, lifetime) \
30 w_cvar(id, sn, SEC, radius) \
31 w_cvar(id, sn, SEC, refire) \
32 w_cvar(id, sn, SEC, shotangle) \
33 w_cvar(id, sn, SEC, speed) \
34 w_cvar(id, sn, SEC, spread) \
35 w_prop(id, sn, float, reloading_ammo, reload_ammo) \
36 w_prop(id, sn, float, reloading_time, reload_time) \
37 w_prop(id, sn, float, switchdelay_raise, switchdelay_raise) \
38 w_prop(id, sn, float, switchdelay_drop, switchdelay_drop) \
39 w_prop(id, sn, string, weaponreplace, weaponreplace) \
40 w_prop(id, sn, float, weaponstart, weaponstart) \
41 w_prop(id, sn, float, weaponstartoverride, weaponstartoverride) \
42 w_prop(id, sn, float, weaponthrowable, weaponthrowable)
45 VAPORIZER_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
46 .float vaporizer_lasthit;
52 void spawnfunc_weapon_vaporizer(void) { weapon_defaultspawnfunc(WEP_VAPORIZER.m_id); }
53 void spawnfunc_weapon_minstanex(void) { spawnfunc_weapon_vaporizer(); }
55 void W_Vaporizer_Attack(void)
58 flying = IsFlying(self); // do this BEFORE to make the trace values from FireRailgunBullet last
60 W_SetupShot(self, true, 0, "", CH_WEAPON_A, 10000);
61 // handle sound separately so we can change the volume
62 // added bonus: no longer plays the strength sound (strength gives no bonus to instakill anyway)
63 sound (self, CH_WEAPON_A, W_Sound("minstanexfire"), VOL_BASE * 0.8, ATTEN_NORM);
67 FireRailgunBullet(w_shotorg, w_shotorg + w_shotdir * MAX_SHOT_DISTANCE, 10000, 800, 0, 0, 0, 0, WEP_VAPORIZER.m_id);
70 Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_ACHIEVEMENT_YODA);
71 if(damage_goodhits && self.vaporizer_lasthit)
73 Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_ACHIEVEMENT_IMPRESSIVE);
74 damage_goodhits = 0; // only every second time
77 self.vaporizer_lasthit = damage_goodhits;
79 Send_Effect(EFFECT_VORTEX_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
81 // teamcolor / hit beam effect
83 v = WarpZone_UnTransformOrigin(WarpZone_trace_transform, trace_endpos);
86 case NUM_TEAM_1: // Red
88 Send_Effect(EFFECT_VAPORIZER_RED_HIT, w_shotorg, v, 1);
90 Send_Effect(EFFECT_VAPORIZER_RED, w_shotorg, v, 1);
92 case NUM_TEAM_2: // Blue
94 Send_Effect(EFFECT_VAPORIZER_BLUE_HIT, w_shotorg, v, 1);
96 Send_Effect(EFFECT_VAPORIZER_BLUE, w_shotorg, v, 1);
98 case NUM_TEAM_3: // Yellow
100 Send_Effect(EFFECT_VAPORIZER_YELLOW_HIT, w_shotorg, v, 1);
102 Send_Effect(EFFECT_VAPORIZER_YELLOW, w_shotorg, v, 1);
104 case NUM_TEAM_4: // Pink
106 Send_Effect(EFFECT_VAPORIZER_PINK_HIT, w_shotorg, v, 1);
108 Send_Effect(EFFECT_VAPORIZER_PINK, w_shotorg, v, 1);
112 Send_Effect_("TE_TEI_G3_HIT", w_shotorg, v, 1);
114 Send_Effect_("TE_TEI_G3", w_shotorg, v, 1);
118 W_DecreaseAmmo(((g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo)));
121 float W_Vaporizer(float req)
124 float vaporizer_ammo;
126 // now multiple WR_s use this
127 vaporizer_ammo = ((g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo));
133 if(self.WEP_AMMO(VAPORIZER) > 0)
134 self.BUTTON_ATCK = bot_aim(1000000, 0, 1, false);
136 self.BUTTON_ATCK2 = bot_aim(WEP_CVAR_SEC(vaporizer, speed), 0, WEP_CVAR_SEC(vaporizer, lifetime), false); // WEAPONTODO: replace with proper vaporizer cvars
142 // if the laser uses load, we also consider its ammo for reloading
143 if(WEP_CVAR(vaporizer, reload_ammo) && WEP_CVAR_SEC(vaporizer, ammo) && self.clip_load < min(vaporizer_ammo, WEP_CVAR_SEC(vaporizer, ammo))) // forced reload
144 WEP_ACTION(self.weapon, WR_RELOAD);
145 else if(WEP_CVAR(vaporizer, reload_ammo) && self.clip_load < vaporizer_ammo) // forced reload
146 WEP_ACTION(self.weapon, WR_RELOAD);
147 else if(self.BUTTON_ATCK)
149 if(weapon_prepareattack(0, WEP_CVAR_PRI(vaporizer, refire)))
151 W_Vaporizer_Attack();
152 weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(vaporizer, animtime), w_ready);
155 else if(self.BUTTON_ATCK2)
157 if(self.jump_interval <= time)
158 if(weapon_prepareattack(1, -1))
160 // handle refire manually, so that primary and secondary can be fired without conflictions (important for instagib)
161 self.jump_interval = time + WEP_CVAR_SEC(vaporizer, refire) * W_WeaponRateFactor();
163 // decrease ammo for the laser?
164 if(WEP_CVAR_SEC(vaporizer, ammo))
165 W_DecreaseAmmo(WEP_CVAR_SEC(vaporizer, ammo));
167 // ugly instagib hack to reuse the fire mode of the laser
168 int oldwep = self.weapon; // we can't avoid this hack
169 self.weapon = WEP_BLASTER.m_id;
171 WEP_BLASTER.m_id | HITTYPE_SECONDARY,
172 WEP_CVAR_SEC(vaporizer, shotangle),
173 WEP_CVAR_SEC(vaporizer, damage),
174 WEP_CVAR_SEC(vaporizer, edgedamage),
175 WEP_CVAR_SEC(vaporizer, radius),
176 WEP_CVAR_SEC(vaporizer, force),
177 WEP_CVAR_SEC(vaporizer, speed),
178 WEP_CVAR_SEC(vaporizer, spread),
179 WEP_CVAR_SEC(vaporizer, delay),
180 WEP_CVAR_SEC(vaporizer, lifetime)
182 self.weapon = oldwep;
184 // now do normal refire
185 weapon_thinkf(WFRAME_FIRE2, WEP_CVAR_SEC(vaporizer, animtime), w_ready);
193 precache_model("models/nexflash.md3");
194 precache_model(W_Model("g_minstanex.md3"));
195 precache_model(W_Model("v_minstanex.md3"));
196 precache_model(W_Model("h_minstanex.iqm"));
197 precache_sound(W_Sound("minstanexfire"));
198 precache_sound(W_Sound("nexwhoosh1"));
199 precache_sound(W_Sound("nexwhoosh2"));
200 precache_sound(W_Sound("nexwhoosh3"));
201 //W_Blaster(WR_INIT); // Samual: Is this really the proper thing to do? Didn't we already run this previously?
202 VAPORIZER_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
207 self.ammo_field = WEP_AMMO(VAPORIZER);
208 self.vaporizer_lasthit = 0;
213 ammo_amount = self.WEP_AMMO(VAPORIZER) >= vaporizer_ammo;
214 ammo_amount += self.(weapon_load[WEP_VAPORIZER.m_id]) >= vaporizer_ammo;
219 if(!WEP_CVAR_SEC(vaporizer, ammo))
221 ammo_amount = self.WEP_AMMO(VAPORIZER) >= WEP_CVAR_SEC(vaporizer, ammo);
222 ammo_amount += self.(weapon_load[WEP_VAPORIZER.m_id]) >= WEP_CVAR_SEC(vaporizer, ammo);
227 VAPORIZER_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
232 self.vaporizer_lasthit = 0;
238 if(WEP_CVAR_SEC(vaporizer, ammo))
239 used_ammo = min(vaporizer_ammo, WEP_CVAR_SEC(vaporizer, ammo));
241 used_ammo = vaporizer_ammo;
243 W_Reload(used_ammo, W_Sound("reload"));
246 case WR_SUICIDEMESSAGE:
248 return WEAPON_THINKING_WITH_PORTALS;
252 return WEAPON_VAPORIZER_MURDER;
259 float W_Vaporizer(float req)
263 case WR_IMPACTEFFECT:
266 org2 = w_org + w_backoff * 6;
267 if(w_deathtype & HITTYPE_SECONDARY)
269 pointparticles(particleeffectnum(EFFECT_BLASTER_IMPACT), org2, w_backoff * 1000, 1);
270 if(!w_issilent) { sound(self, CH_SHOTS, W_Sound("laserimpact"), VOL_BASE, ATTN_NORM); }
274 pointparticles(particleeffectnum(EFFECT_VORTEX_IMPACT), org2, '0 0 0', 1);
275 if(!w_issilent) { sound(self, CH_SHOTS, W_Sound("neximpact"), VOL_BASE, ATTN_NORM); }
281 precache_sound(W_Sound("laserimpact"));
282 precache_sound(W_Sound("neximpact"));
283 if(autocvar_cl_reticle && autocvar_cl_reticle_weapon)
285 precache_pic("gfx/reticle_nex");
291 if(button_zoom || zoomscript_caught)
293 reticle_image = "gfx/reticle_nex";
298 // no weapon specific image for this weapon