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.4",
13 /* refname */ "vaporizer",
14 /* wepname */ _("Vaporizer")
17 #define VAPORIZER_SETTINGS(w_cvar,w_prop) VAPORIZER_SETTINGS_LIST(w_cvar, w_prop, VAPORIZER, vaporizer)
18 #define VAPORIZER_SETTINGS_LIST(w_cvar,w_prop,id,sn) \
19 w_cvar(id, sn, PRI, ammo) \
20 w_cvar(id, sn, PRI, animtime) \
21 w_cvar(id, sn, PRI, refire) \
22 w_cvar(id, sn, SEC, ammo) \
23 w_cvar(id, sn, SEC, animtime) \
24 w_cvar(id, sn, SEC, damage) \
25 w_cvar(id, sn, SEC, delay) \
26 w_cvar(id, sn, SEC, edgedamage) \
27 w_cvar(id, sn, SEC, force) \
28 w_cvar(id, sn, SEC, lifetime) \
29 w_cvar(id, sn, SEC, radius) \
30 w_cvar(id, sn, SEC, refire) \
31 w_cvar(id, sn, SEC, shotangle) \
32 w_cvar(id, sn, SEC, speed) \
33 w_cvar(id, sn, SEC, spread) \
34 w_prop(id, sn, float, reloading_ammo, reload_ammo) \
35 w_prop(id, sn, float, reloading_time, reload_time) \
36 w_prop(id, sn, float, switchdelay_raise, switchdelay_raise) \
37 w_prop(id, sn, float, switchdelay_drop, switchdelay_drop) \
38 w_prop(id, sn, string, weaponreplace, weaponreplace) \
39 w_prop(id, sn, float, weaponstart, weaponstart) \
40 w_prop(id, sn, float, weaponstartoverride, weaponstartoverride)
43 VAPORIZER_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
44 .float vaporizer_lasthit;
49 void spawnfunc_weapon_vaporizer (void) { weapon_defaultspawnfunc(WEP_VAPORIZER); }
50 void spawnfunc_weapon_minstanex () { spawnfunc_weapon_vaporizer(); }
52 void W_Vaporizer_Attack (void)
55 flying = IsFlying(self); // do this BEFORE to make the trace values from FireRailgunBullet last
57 W_SetupShot (self, TRUE, 0, "weapons/minstanexfire.wav", CH_WEAPON_A, 10000);
61 FireRailgunBullet (w_shotorg, w_shotorg + w_shotdir * MAX_SHOT_DISTANCE, 10000, 800, 0, 0, 0, 0, WEP_VAPORIZER);
64 Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_ACHIEVEMENT_YODA);
65 if(damage_goodhits && self.vaporizer_lasthit)
67 Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_ACHIEVEMENT_IMPRESSIVE);
68 damage_goodhits = 0; // only every second time
71 self.vaporizer_lasthit = damage_goodhits;
73 pointparticles(particleeffectnum("nex_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
75 // teamcolor / hit beam effect
77 v = WarpZone_UnTransformOrigin(WarpZone_trace_transform, trace_endpos);
80 case NUM_TEAM_1: // Red
82 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3RED_HIT"), w_shotorg, v);
84 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3RED"), w_shotorg, v);
86 case NUM_TEAM_2: // Blue
88 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3BLUE_HIT"), w_shotorg, v);
90 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3BLUE"), w_shotorg, v);
92 case NUM_TEAM_3: // Yellow
94 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3YELLOW_HIT"), w_shotorg, v);
96 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3YELLOW"), w_shotorg, v);
98 case NUM_TEAM_4: // Pink
100 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3PINK_HIT"), w_shotorg, v);
102 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3PINK"), w_shotorg, v);
106 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3_HIT"), w_shotorg, v);
108 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3"), w_shotorg, v);
112 W_DecreaseAmmo(((g_minstagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo)));
115 float W_Vaporizer(float req)
118 float vaporizer_ammo;
120 // now multiple WR_s use this
121 vaporizer_ammo = ((g_minstagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo));
127 if(self.WEP_AMMO(VAPORIZER) > 0)
128 self.BUTTON_ATCK = bot_aim(1000000, 0, 1, FALSE);
130 self.BUTTON_ATCK2 = bot_aim(WEP_CVAR_SEC(vaporizer, speed), 0, WEP_CVAR_SEC(vaporizer, lifetime), FALSE); // WEAPONTODO: replace with proper vaporizer cvars
136 // if the laser uses load, we also consider its ammo for reloading
137 if(WEP_CVAR(vaporizer, reload_ammo) && WEP_CVAR_SEC(vaporizer, ammo) && self.clip_load < min(vaporizer_ammo, WEP_CVAR_SEC(vaporizer, ammo))) // forced reload
138 WEP_ACTION(self.weapon, WR_RELOAD);
139 else if(WEP_CVAR(vaporizer, reload_ammo) && self.clip_load < vaporizer_ammo) // forced reload
140 WEP_ACTION(self.weapon, WR_RELOAD);
141 else if (self.BUTTON_ATCK)
143 if (weapon_prepareattack(0, WEP_CVAR_PRI(vaporizer, refire)))
145 W_Vaporizer_Attack();
146 weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(vaporizer, animtime), w_ready);
149 else if (self.BUTTON_ATCK2)
151 if (self.jump_interval <= time)
152 if (weapon_prepareattack(1, -1))
154 // handle refire manually, so that primary and secondary can be fired without conflictions (important for minstagib)
155 self.jump_interval = time + WEP_CVAR_SEC(vaporizer, refire) * W_WeaponRateFactor();
157 // decrease ammo for the laser?
158 if(WEP_CVAR_SEC(vaporizer, ammo))
159 W_DecreaseAmmo(WEP_CVAR_SEC(vaporizer, ammo));
161 // ugly minstagib hack to reuse the fire mode of the laser
164 self.weapon = WEP_BLASTER;
166 WEP_CVAR_SEC(vaporizer, shotangle),
167 WEP_CVAR_SEC(vaporizer, damage),
168 WEP_CVAR_SEC(vaporizer, edgedamage),
169 WEP_CVAR_SEC(vaporizer, radius),
170 WEP_CVAR_SEC(vaporizer, force),
171 WEP_CVAR_SEC(vaporizer, speed),
172 WEP_CVAR_SEC(vaporizer, spread),
173 WEP_CVAR_SEC(vaporizer, delay),
174 WEP_CVAR_SEC(vaporizer, lifetime)
178 // now do normal refire
179 weapon_thinkf(WFRAME_FIRE2, WEP_CVAR_SEC(vaporizer, animtime), w_ready);
187 precache_model("models/nexflash.md3");
188 precache_model("models/weapons/g_minstanex.md3");
189 precache_model("models/weapons/v_minstanex.md3");
190 precache_model("models/weapons/h_minstanex.iqm");
191 precache_sound("weapons/minstanexfire.wav");
192 precache_sound("weapons/nexwhoosh1.wav");
193 precache_sound("weapons/nexwhoosh2.wav");
194 precache_sound("weapons/nexwhoosh3.wav");
195 //W_Blaster(WR_INIT); // Samual: Is this really the proper thing to do? Didn't we already run this previously?
196 VAPORIZER_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP)
201 self.ammo_field = WEP_AMMO(VAPORIZER);
202 self.vaporizer_lasthit = 0;
207 ammo_amount = self.WEP_AMMO(VAPORIZER) >= vaporizer_ammo;
208 ammo_amount += self.(weapon_load[WEP_VAPORIZER]) >= vaporizer_ammo;
213 if(!WEP_CVAR_SEC(vaporizer, ammo))
215 ammo_amount = self.WEP_AMMO(VAPORIZER) >= WEP_CVAR_SEC(vaporizer, ammo);
216 ammo_amount += self.(weapon_load[WEP_VAPORIZER]) >= WEP_CVAR_SEC(vaporizer, ammo);
221 VAPORIZER_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS)
226 self.vaporizer_lasthit = 0;
232 if(WEP_CVAR_SEC(vaporizer, ammo))
233 used_ammo = min(vaporizer_ammo, WEP_CVAR_SEC(vaporizer, ammo));
235 used_ammo = vaporizer_ammo;
237 W_Reload(used_ammo, "weapons/reload.wav");
240 case WR_SUICIDEMESSAGE:
242 return WEAPON_THINKING_WITH_PORTALS;
246 return WEAPON_VAPORIZER_MURDER;
253 float W_Vaporizer(float req)
257 case WR_IMPACTEFFECT:
260 org2 = w_org + w_backoff * 6;
261 pointparticles(particleeffectnum("nex_impact"), org2, '0 0 0', 1);
263 sound(self, CH_SHOTS, "weapons/neximpact.wav", VOL_BASE, ATTN_NORM);
269 precache_sound("weapons/neximpact.wav");
270 if(autocvar_cl_reticle && autocvar_cl_reticle_weapon)
272 precache_pic("gfx/reticle_nex");
278 if(button_zoom || zoomscript_caught)
280 reticle_image = "gfx/reticle_nex";
285 // no weapon specific image for this weapon