+#include "vaporizer.qh"
#ifndef IMPLEMENTATION
-REGISTER_WEAPON(
-/* WEP_##id */ VAPORIZER,
-/* function */ W_Vaporizer,
-/* ammotype */ ammo_cells,
-/* impulse */ 7,
-/* flags */ WEP_FLAG_RELOADABLE | WEP_FLAG_CANCLIMB | WEP_FLAG_SUPERWEAPON | WEP_TYPE_HITSCAN,
-/* rating */ BOT_PICKUP_RATING_HIGH,
-/* color */ '0.5 1 1',
-/* modelname */ "minstanex",
-/* simplemdl */ "foobar",
-/* crosshair */ "gfx/crosshairminstanex 0.6",
-/* wepimg */ "weaponminstanex",
-/* refname */ "vaporizer",
-/* wepname */ _("Vaporizer")
-);
-
-#define VAPORIZER_SETTINGS(w_cvar,w_prop) VAPORIZER_SETTINGS_LIST(w_cvar, w_prop, VAPORIZER, vaporizer)
-#define VAPORIZER_SETTINGS_LIST(w_cvar,w_prop,id,sn) \
- w_cvar(id, sn, PRI, ammo) \
- w_cvar(id, sn, PRI, animtime) \
- w_cvar(id, sn, PRI, damage) \
- w_cvar(id, sn, PRI, refire) \
- w_cvar(id, sn, SEC, ammo) \
- w_cvar(id, sn, SEC, animtime) \
- w_cvar(id, sn, SEC, damage) \
- w_cvar(id, sn, SEC, delay) \
- w_cvar(id, sn, SEC, edgedamage) \
- w_cvar(id, sn, SEC, force) \
- w_cvar(id, sn, SEC, lifetime) \
- w_cvar(id, sn, SEC, radius) \
- w_cvar(id, sn, SEC, refire) \
- w_cvar(id, sn, SEC, shotangle) \
- w_cvar(id, sn, SEC, speed) \
- w_cvar(id, sn, SEC, spread) \
- w_prop(id, sn, float, reloading_ammo, reload_ammo) \
- w_prop(id, sn, float, reloading_time, reload_time) \
- w_prop(id, sn, float, switchdelay_raise, switchdelay_raise) \
- w_prop(id, sn, float, switchdelay_drop, switchdelay_drop) \
- w_prop(id, sn, string, weaponreplace, weaponreplace) \
- w_prop(id, sn, float, weaponstart, weaponstart) \
- w_prop(id, sn, float, weaponstartoverride, weaponstartoverride) \
- w_prop(id, sn, float, weaponthrowable, weaponthrowable)
+CLASS(Vaporizer, Weapon)
+/* ammotype */ ATTRIB(Vaporizer, ammo_field, .int, ammo_cells);
+/* impulse */ ATTRIB(Vaporizer, impulse, int, 7);
+/* flags */ ATTRIB(Vaporizer, spawnflags, int, WEP_FLAG_RELOADABLE | WEP_FLAG_CANCLIMB | WEP_FLAG_SUPERWEAPON | WEP_TYPE_HITSCAN);
+/* rating */ ATTRIB(Vaporizer, bot_pickupbasevalue, float, BOT_PICKUP_RATING_HIGH);
+/* color */ ATTRIB(Vaporizer, wpcolor, vector, '0.5 1 1');
+/* modelname */ ATTRIB(Vaporizer, mdl, string, "minstanex");
+#ifdef GAMEQC
+/* model */ ATTRIB(Vaporizer, m_model, Model, MDL_VAPORIZER_ITEM);
+#endif
+/* crosshair */ ATTRIB(Vaporizer, w_crosshair, string, "gfx/crosshairminstanex");
+/* crosshair */ ATTRIB(Vaporizer, w_crosshair_size, float, 0.6);
+/* wepimg */ ATTRIB(Vaporizer, model2, string, "weaponminstanex");
+/* refname */ ATTRIB(Vaporizer, netname, string, "vaporizer");
+/* wepname */ ATTRIB(Vaporizer, m_name, string, _("Vaporizer"));
+
+#define X(BEGIN, P, END, class, prefix) \
+ BEGIN(class) \
+ P(class, prefix, ammo, float, PRI) \
+ P(class, prefix, animtime, float, PRI) \
+ P(class, prefix, damage, float, PRI) \
+ P(class, prefix, refire, float, PRI) \
+ P(class, prefix, ammo, float, SEC) \
+ P(class, prefix, animtime, float, SEC) \
+ P(class, prefix, damage, float, SEC) \
+ P(class, prefix, delay, float, SEC) \
+ P(class, prefix, edgedamage, float, SEC) \
+ P(class, prefix, force, float, SEC) \
+ P(class, prefix, lifetime, float, SEC) \
+ P(class, prefix, radius, float, SEC) \
+ P(class, prefix, refire, float, SEC) \
+ P(class, prefix, shotangle, float, SEC) \
+ P(class, prefix, speed, float, SEC) \
+ P(class, prefix, spread, float, SEC) \
+ P(class, prefix, reload_ammo, float, NONE) \
+ P(class, prefix, reload_time, float, NONE) \
+ P(class, prefix, switchdelay_raise, float, NONE) \
+ P(class, prefix, switchdelay_drop, float, NONE) \
+ P(class, prefix, weaponreplace, string, NONE) \
+ P(class, prefix, weaponstart, float, NONE) \
+ P(class, prefix, weaponstartoverride, float, NONE) \
+ P(class, prefix, weaponthrowable, float, NONE) \
+ END()
+ W_PROPS(X, Vaporizer, vaporizer)
+#undef X
+
+ENDCLASS(Vaporizer)
+REGISTER_WEAPON(VAPORIZER, vaporizer, NEW(Vaporizer));
+
#ifdef SVQC
-VAPORIZER_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
.float vaporizer_lasthit;
.float jump_interval;
.float jump_interval2;
#endif
#endif
#ifdef IMPLEMENTATION
+
+REGISTER_NET_TEMP(TE_CSQC_VAPORBEAMPARTICLE)
+
+#if defined(SVQC)
+void SendCSQCVaporizerBeamParticle(entity player, int hit) {
+ vector v;
+ v = WarpZone_UnTransformOrigin(WarpZone_trace_transform, trace_endpos);
+ WriteHeader(MSG_BROADCAST, TE_CSQC_VAPORBEAMPARTICLE);
+ WriteCoord(MSG_BROADCAST, w_shotorg.x);
+ WriteCoord(MSG_BROADCAST, w_shotorg.y);
+ WriteCoord(MSG_BROADCAST, w_shotorg.z);
+ WriteCoord(MSG_BROADCAST, v.x);
+ WriteCoord(MSG_BROADCAST, v.y);
+ WriteCoord(MSG_BROADCAST, v.z);
+ WriteByte(MSG_BROADCAST, hit);
+ WriteByte(MSG_BROADCAST, etof(player));
+ WriteByte(MSG_BROADCAST, player.team);
+}
+#elif defined(CSQC)
+bool autocvar_cl_vaporizerbeam_particle = false;
+float autocvar_cl_vaporizerbeam_lifetime = 0.8;
+float autocvar_cl_vaporizerbeam_colorboost = 0.7;
+
+string Draw_VaporizerBeam_trace_callback_tex;
+float Draw_VaporizerBeam_trace_callback_rnd;
+vector Draw_VaporizerBeam_trace_callback_rgb;
+float Draw_VaporizerBeam_trace_callback_a;
+void Draw_VaporizerBeam_trace_callback(vector start, vector hit, vector end)
+{
+ float i;
+ vector vorg;
+ vorg = WarpZone_TransformOrigin(WarpZone_trace_transform, view_origin);
+ for(i = 0; i < Draw_VaporizerBeam_trace_callback_a; ++i)
+ 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);
+ Draw_VaporizerBeam_trace_callback_rnd += 0.25 * vlen(hit - start) / 8;
+}
+
+.vector vorg1, vorg2;
+.float spawn_time;
+void VaporizerBeam_Draw(entity this)
+{
+ //draw either the old v2.3 beam or the new beam
+ particles_alphamin = particles_alphamax = particles_fade = 1;
+
+ string tex = "particles/lgbeam";
+ if(this.cnt)
+ tex = "particles/gauntletbeam";
+ vector rgb;
+ //entity e = CSQCModel_server2csqc(this.sv_entnum - 1);
+ //if (e == NULL)
+ //{
+ rgb = colormapPaletteColor(entcs_GetClientColors(this.sv_entnum - 1) & 0x0F, true);
+ //rgb = '1 1 1';
+ //}
+ //else
+ // rgb = e.glowmod;
+ rgb *= (1 + autocvar_cl_vaporizerbeam_colorboost);
+
+ float fail = (this.nextthink - time);
+
+ Draw_VaporizerBeam_trace_callback_tex = tex;
+ Draw_VaporizerBeam_trace_callback_rnd = 0;
+ Draw_VaporizerBeam_trace_callback_rgb = rgb;
+ Draw_VaporizerBeam_trace_callback_a = bound(0, fail, 1);
+ WarpZone_TraceBox_ThroughZone(this.vorg1, '0 0 0', '0 0 0', this.vorg2, MOVE_NOTHING, NULL, NULL, Draw_VaporizerBeam_trace_callback);
+ Draw_VaporizerBeam_trace_callback_tex = string_null;
+
+ /*if(!MUTATOR_CALLHOOK(Particles_VaporizerBeam, this.vorg1, this.vorg2))
+ if(autocvar_cl_particles_oldvortexbeam && (STAT(ALLOW_OLDVORTEXBEAM) || isdemo()))
+ WarpZone_TrailParticles_WithMultiplier(NULL, particleeffectnum(EFFECT_VORTEX_BEAM_OLD), this.vorg1, this.vorg2, 1, PARTICLES_USEALPHA | PARTICLES_USEFADE);
+ else
+ WarpZone_TrailParticles_WithMultiplier(NULL, particleeffectnum(EFFECT_VORTEX_BEAM), this.vorg1, this.vorg2, 1, PARTICLES_USEALPHA | PARTICLES_USEFADE);*/
+}
+
+NET_HANDLE(TE_CSQC_VAPORBEAMPARTICLE, bool isNew)
+{
+ Net_Accept(vortex_beam);
+ setthink(this, SUB_Remove);
+ this.nextthink = time + bound(0, autocvar_cl_vaporizerbeam_lifetime, 10);
+ this.draw = VaporizerBeam_Draw;
+ if (isNew) IL_PUSH(g_drawables, this);
+ this.drawmask = MASK_NORMAL;
+
+ this.vorg1_x = ReadCoord(); this.vorg1_y = ReadCoord(); this.vorg1_z = ReadCoord();
+ this.vorg2_x = ReadCoord(); this.vorg2_y = ReadCoord(); this.vorg2_z = ReadCoord();
+ this.cnt = ReadByte();
+ int myowner = ReadByte();
+ this.owner = playerslots[myowner - 1];
+ this.sv_entnum = myowner;
+ this.team = ReadByte() - 1;
+
+ pointparticles(EFFECT_VORTEX_MUZZLEFLASH, this.vorg1, normalize(this.vorg2 - this.vorg1) * 1000, 1);
+
+ if(autocvar_cl_vaporizerbeam_particle)
+ {
+ WarpZone_TrailParticles(NULL, particleeffectnum(((this.cnt) ? EFFECT_VAPORIZER_HIT(this.team) : EFFECT_VAPORIZER(this.team))), this.vorg1, this.vorg2);
+ this.draw = func_null;
+ this.drawmask = MASK_NORMAL;
+ delete(this);
+ }
+
+ return true;
+}
+#endif
+
#ifdef SVQC
-void spawnfunc_weapon_vaporizer(void) { weapon_defaultspawnfunc(WEP_VAPORIZER.m_id); }
-void spawnfunc_weapon_minstanex(void) { spawnfunc_weapon_vaporizer(); }
+spawnfunc(weapon_vaporizer) { weapon_defaultspawnfunc(this, WEP_VAPORIZER); }
+spawnfunc(weapon_minstanex) { spawnfunc_weapon_vaporizer(this); }
-void W_RocketMinsta_Explosion(vector loc)
-{SELFPARAM();
- if(accuracy_canbegooddamage(self))
- accuracy_add(self, WEP_DEVASTATOR.m_id, autocvar_g_rm_damage, 0);
+void W_RocketMinsta_Explosion(entity actor, vector loc)
+{
+ if(accuracy_canbegooddamage(actor))
+ accuracy_add(actor, WEP_DEVASTATOR.m_id, autocvar_g_rm_damage, 0);
entity dmgent = spawn();
- dmgent.owner = dmgent.realowner = self;
+ dmgent.owner = dmgent.realowner = actor;
setorigin(dmgent, loc);
- 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);
- remove(dmgent);
+ 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);
+ delete(dmgent);
}
-void W_Vaporizer_Attack(void)
-{SELFPARAM();
- bool flying = IsFlying(self); // do this BEFORE to make the trace values from FireRailgunBullet last
+void W_Vaporizer_Attack(Weapon thiswep, entity actor, .entity weaponentity)
+{
+ bool flying = IsFlying(actor); // do this BEFORE to make the trace values from FireRailgunBullet last
float vaporizer_damage = ((WEP_CVAR_PRI(vaporizer, damage) > 0) ? WEP_CVAR_PRI(vaporizer, damage) : 10000);
- W_SetupShot(self, true, 0, "", CH_WEAPON_A, vaporizer_damage);
+ W_SetupShot(actor, weaponentity, true, 0, SND_Null, CH_WEAPON_A, vaporizer_damage);
// handle sound separately so we can change the volume
// added bonus: no longer plays the strength sound (strength gives no bonus to instakill anyway)
- sound (self, CH_WEAPON_A, W_Sound("minstanexfire"), VOL_BASE * 0.8, ATTEN_NORM);
+ sound (actor, CH_WEAPON_A, SND_MINSTANEXFIRE, VOL_BASE * 0.8, ATTEN_NORM);
yoda = 0;
damage_goodhits = 0;
- FireRailgunBullet(w_shotorg, w_shotorg + w_shotdir * MAX_SHOT_DISTANCE, vaporizer_damage, 800, 0, 0, 0, 0, WEP_VAPORIZER.m_id);
+ FireRailgunBullet(actor, weaponentity, w_shotorg, w_shotorg + w_shotdir * MAX_SHOT_DISTANCE, vaporizer_damage, 800, 0, 0, 0, 0, WEP_VAPORIZER.m_id);
+
+ // do this now, as goodhits is disabled below
+ SendCSQCVaporizerBeamParticle(actor, damage_goodhits);
if(yoda && flying)
- Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_ACHIEVEMENT_YODA);
- if(damage_goodhits && self.vaporizer_lasthit)
+ Send_Notification(NOTIF_ONE, actor, MSG_ANNCE, ANNCE_ACHIEVEMENT_YODA);
+ if(damage_goodhits && actor.vaporizer_lasthit)
{
- Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_ACHIEVEMENT_IMPRESSIVE);
+ Send_Notification(NOTIF_ONE, actor, MSG_ANNCE, ANNCE_ACHIEVEMENT_IMPRESSIVE);
damage_goodhits = 0; // only every second time
}
- self.vaporizer_lasthit = damage_goodhits;
-
- Send_Effect(EFFECT_VORTEX_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
-
- // teamcolor / hit beam effect
- vector v;
- v = WarpZone_UnTransformOrigin(WarpZone_trace_transform, trace_endpos);
- switch(self.team)
- {
- case NUM_TEAM_1: // Red
- if(damage_goodhits)
- Send_Effect(EFFECT_VAPORIZER_RED_HIT, w_shotorg, v, 1);
- else
- Send_Effect(EFFECT_VAPORIZER_RED, w_shotorg, v, 1);
- break;
- case NUM_TEAM_2: // Blue
- if(damage_goodhits)
- Send_Effect(EFFECT_VAPORIZER_BLUE_HIT, w_shotorg, v, 1);
- else
- Send_Effect(EFFECT_VAPORIZER_BLUE, w_shotorg, v, 1);
- break;
- case NUM_TEAM_3: // Yellow
- if(damage_goodhits)
- Send_Effect(EFFECT_VAPORIZER_YELLOW_HIT, w_shotorg, v, 1);
- else
- Send_Effect(EFFECT_VAPORIZER_YELLOW, w_shotorg, v, 1);
- break;
- case NUM_TEAM_4: // Pink
- if(damage_goodhits)
- Send_Effect(EFFECT_VAPORIZER_PINK_HIT, w_shotorg, v, 1);
- else
- Send_Effect(EFFECT_VAPORIZER_PINK, w_shotorg, v, 1);
- break;
- default:
- if(damage_goodhits)
- Send_Effect_("TE_TEI_G3_HIT", w_shotorg, v, 1);
- else
- Send_Effect_("TE_TEI_G3", w_shotorg, v, 1);
- break;
- }
+ actor.vaporizer_lasthit = damage_goodhits;
if(autocvar_g_rm)
if(!(trace_dphitq3surfaceflags & (Q3SURFACEFLAG_SKY | Q3SURFACEFLAG_NOIMPACT)))
- W_RocketMinsta_Explosion(trace_endpos);
+ W_RocketMinsta_Explosion(actor, trace_endpos);
- W_DecreaseAmmo(((g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo)));
+ W_DecreaseAmmo(thiswep, actor, ((g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo)), weaponentity);
}
-void W_RocketMinsta_Laser_Explode (void)
-{SELFPARAM();
+void W_RocketMinsta_Laser_Explode (entity this)
+{
if(other.takedamage == DAMAGE_AIM)
if(IS_PLAYER(other))
- if(DIFF_TEAM(self.realowner, other))
- if(other.deadflag == DEAD_NO)
+ if(DIFF_TEAM(this.realowner, other))
+ if(!IS_DEAD(other))
if(IsFlying(other))
- Send_Notification(NOTIF_ONE, self.realowner, MSG_ANNCE, ANNCE_ACHIEVEMENT_ELECTROBITCH);
+ Send_Notification(NOTIF_ONE, this.realowner, MSG_ANNCE, ANNCE_ACHIEVEMENT_ELECTROBITCH);
- self.event_damage = func_null;
- self.takedamage = DAMAGE_NO;
- RadiusDamage (self, self.realowner, self.rm_damage, self.rm_edmg, autocvar_g_rm_laser_radius, world, world, self.rm_force, self.projectiledeathtype, other);
- remove(self);
+ this.event_damage = func_null;
+ this.takedamage = DAMAGE_NO;
+ RadiusDamage (this, this.realowner, this.rm_damage, this.rm_edmg, autocvar_g_rm_laser_radius, NULL, NULL, this.rm_force, this.projectiledeathtype, other);
+ delete(this);
}
-void W_RocketMinsta_Laser_Touch (void)
-{SELFPARAM();
- PROJECTILE_TOUCH;
+void W_RocketMinsta_Laser_Explode_use(entity this, entity actor, entity trigger)
+{
+ W_RocketMinsta_Laser_Explode(this);
+}
+
+void W_RocketMinsta_Laser_Touch(entity this, entity toucher)
+{
+ PROJECTILE_TOUCH(this, toucher);
//W_RocketMinsta_Laser_Explode ();
- RadiusDamage (self, self.realowner, self.rm_damage, self.rm_edmg, autocvar_g_rm_laser_radius, world, world, self.rm_force, self.projectiledeathtype, other);
- remove(self);
+ RadiusDamage(this, this.realowner, this.rm_damage, this.rm_edmg, autocvar_g_rm_laser_radius, NULL, NULL, this.rm_force, this.projectiledeathtype, toucher);
+ delete(this);
}
-void W_RocketMinsta_Attack2(void)
-{SELFPARAM();
- makevectors(self.v_angle);
+void W_RocketMinsta_Attack2(entity actor, .entity weaponentity)
+{
+ makevectors(actor.v_angle);
entity proj;
float counter = 0;
float spread = autocvar_g_rm_laser_spread;
float rndspread = autocvar_g_rm_laser_spread_random;
- float w = self.weapon;
- self.weapon = WEP_ELECTRO.m_id;
- W_SetupShot_ProjectileSize (self, '0 0 -3', '0 0 -3', false, 2, W_Sound("crylink_fire"), CH_WEAPON_A, autocvar_g_rm_laser_damage);
- self.weapon = w;
+ Weapon w = actor.(weaponentity).m_weapon;
+ actor.(weaponentity).m_weapon = WEP_ELECTRO;
+ W_SetupShot_ProjectileSize (actor, weaponentity, '0 0 -3', '0 0 -3', false, 2, SND_CRYLINK_FIRE, CH_WEAPON_A, autocvar_g_rm_laser_damage);
+ actor.(weaponentity).m_weapon = w;
Send_Effect(EFFECT_ELECTRO_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
while(counter < total)
{
- proj = spawn ();
- proj.classname = "plasma_prim";
- proj.owner = proj.realowner = self;
+ proj = new(plasma_prim);
+ proj.owner = proj.realowner = actor;
proj.bot_dodge = true;
proj.bot_dodgerating = autocvar_g_rm_laser_damage;
- proj.use = W_RocketMinsta_Laser_Explode;
- proj.think = adaptor_think2use_hittype_splash;
+ proj.use = W_RocketMinsta_Laser_Explode_use;
+ setthink(proj, adaptor_think2use_hittype_splash);
proj.nextthink = time + autocvar_g_rm_laser_lifetime;
PROJECTILE_MAKETRIGGER(proj);
proj.projectiledeathtype = WEP_ELECTRO.m_id;
//W_SetupProjectileVelocity(proj, autocvar_g_rm_laser_speed, spread * (rndspread ? random() : 1) * autocvar_g_rm_laser_speed);
- proj.movetype = MOVETYPE_BOUNCEMISSILE;
+ set_movetype(proj, MOVETYPE_BOUNCEMISSILE);
//W_SETUPPROJECTILEVELOCITY(proj, g_balance_minstanex_laser);
proj.velocity = (w_shotdir + (((counter + 0.5) / total) * 2 - 1) * v_right * (spread * (rndspread ? random() : 1))) * cvar("g_rm_laser_speed");
proj.velocity_z = proj.velocity_z + cvar("g_rm_laser_zspread") * (random() - 0.5);
- proj.velocity = W_CalculateProjectileVelocity(proj.realowner.velocity, proj.velocity, true);
+ proj.velocity = W_CalculateProjectileVelocity(actor, actor.velocity, proj.velocity, true);
proj.angles = vectoangles(proj.velocity);
- proj.touch = W_RocketMinsta_Laser_Touch;
+ settouch(proj, W_RocketMinsta_Laser_Touch);
setsize(proj, '0 0 -3', '0 0 -3');
proj.flags = FL_PROJECTILE;
+ IL_PUSH(g_projectiles, proj);
+ IL_PUSH(g_bot_dodge, proj);
proj.missile_flags = MIF_SPLASH;
CSQCProjectile(proj, true, PROJECTILE_ROCKETMINSTA_LASER, true);
- MUTATOR_CALLHOOK(EditProjectile, self, proj);
+ MUTATOR_CALLHOOK(EditProjectile, actor, proj);
counter++;
}
}
-void W_RocketMinsta_Attack3 (void)
-{SELFPARAM();
- makevectors(self.v_angle);
+void W_RocketMinsta_Attack3 (entity actor, .entity weaponentity)
+{
+ makevectors(actor.v_angle);
entity proj;
float counter = 0;
float total = 1;
- int w = self.weapon;
- self.weapon = WEP_ELECTRO.m_id;
- W_SetupShot_ProjectileSize (self, '0 0 -3', '0 0 -3', false, 2, W_Sound("electro_fire2"), CH_WEAPON_A, autocvar_g_rm_laser_damage);
- self.weapon = w;
+ Weapon w = actor.(weaponentity).m_weapon;
+ actor.(weaponentity).m_weapon = WEP_ELECTRO;
+ W_SetupShot_ProjectileSize (actor, weaponentity, '0 0 -3', '0 0 -3', false, 2, SND_ELECTRO_FIRE2, CH_WEAPON_A, autocvar_g_rm_laser_damage);
+ actor.(weaponentity).m_weapon = w;
Send_Effect(EFFECT_ELECTRO_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
while(counter < total)
{
- proj = spawn ();
- proj.classname = "plasma_prim";
- proj.owner = proj.realowner = self;
+ proj = new(plasma_prim);
+ proj.owner = proj.realowner = actor;
proj.bot_dodge = true;
proj.bot_dodgerating = autocvar_g_rm_laser_damage;
- proj.use = W_RocketMinsta_Laser_Explode;
- proj.think = adaptor_think2use_hittype_splash;
+ proj.use = W_RocketMinsta_Laser_Explode_use;
+ setthink(proj, adaptor_think2use_hittype_splash);
proj.nextthink = time + autocvar_g_rm_laser_lifetime;
PROJECTILE_MAKETRIGGER(proj);
proj.projectiledeathtype = WEP_ELECTRO.m_id;
//W_SetupProjectileVelocity(proj, autocvar_g_rm_laser_speed, spread * (rndspread ? random() : 1) * autocvar_g_rm_laser_speed);
- proj.movetype = MOVETYPE_BOUNCEMISSILE;
+ set_movetype(proj, MOVETYPE_BOUNCEMISSILE);
proj.velocity = w_shotdir * autocvar_g_rm_laser_speed;
- proj.velocity = W_CalculateProjectileVelocity(proj.realowner.velocity, proj.velocity, true);
+ proj.velocity = W_CalculateProjectileVelocity(actor, actor.velocity, proj.velocity, true);
proj.angles = vectoangles(proj.velocity);
- proj.touch = W_RocketMinsta_Laser_Touch;
+ settouch(proj, W_RocketMinsta_Laser_Touch);
setsize(proj, '0 0 -3', '0 0 -3');
proj.flags = FL_PROJECTILE;
+ IL_PUSH(g_projectiles, proj);
+ IL_PUSH(g_bot_dodge, proj);
proj.missile_flags = MIF_SPLASH;
CSQCProjectile(proj, true, PROJECTILE_ROCKETMINSTA_LASER, true);
- MUTATOR_CALLHOOK(EditProjectile, self, proj);
+ MUTATOR_CALLHOOK(EditProjectile, actor, proj);
counter++;
}
}
-float W_Vaporizer(float req)
-{SELFPARAM();
- float ammo_amount;
- float vaporizer_ammo;
- float rapid = autocvar_g_rm_laser_rapid;
-
- // now multiple WR_s use this
- vaporizer_ammo = ((g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo));
-
- switch(req)
- {
- case WR_AIM:
- {
- if(self.WEP_AMMO(VAPORIZER) > 0)
- self.BUTTON_ATCK = bot_aim(1000000, 0, 1, false);
- else
- self.BUTTON_ATCK2 = bot_aim(WEP_CVAR_SEC(vaporizer, speed), 0, WEP_CVAR_SEC(vaporizer, lifetime), false); // WEAPONTODO: replace with proper vaporizer cvars
-
- return true;
- }
- case WR_THINK:
- {
- // if the laser uses load, we also consider its ammo for reloading
- if(WEP_CVAR(vaporizer, reload_ammo) && WEP_CVAR_SEC(vaporizer, ammo) && self.clip_load < min(vaporizer_ammo, WEP_CVAR_SEC(vaporizer, ammo))) // forced reload
- WEP_ACTION(self.weapon, WR_RELOAD);
- else if(WEP_CVAR(vaporizer, reload_ammo) && self.clip_load < vaporizer_ammo) // forced reload
- WEP_ACTION(self.weapon, WR_RELOAD);
- if(self.BUTTON_ATCK && (self.ammo_cells || !autocvar_g_rm) && !forbidWeaponUse(self))
- {
- if(weapon_prepareattack(0, WEP_CVAR_PRI(vaporizer, refire)))
- {
- W_Vaporizer_Attack();
- weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(vaporizer, animtime), w_ready);
- }
- }
- if(self.BUTTON_ATCK2 || (self.BUTTON_ATCK && !self.ammo_cells && autocvar_g_rm))
- {
- if((autocvar_g_rm && autocvar_g_rm_laser) || autocvar_g_rm_laser == 2)
- {
- if(self.jump_interval <= time && !self.held_down)
- {
- if(rapid)
- self.held_down = true;
- self.jump_interval = time + autocvar_g_rm_laser_refire;
- self.jump_interval2 = time + autocvar_g_rm_laser_rapid_delay;
- damage_goodhits = 0;
- W_RocketMinsta_Attack2();
- }
- else if(rapid && self.jump_interval2 <= time && self.held_down)
- {
- self.jump_interval2 = time + autocvar_g_rm_laser_rapid_refire;
- damage_goodhits = 0;
- W_RocketMinsta_Attack3();
- //weapon_thinkf(WFRAME_FIRE2, autocvar_g_rm_laser_rapid_animtime, w_ready);
- }
- }
- else if (self.jump_interval <= time)
- {
- // handle refire manually, so that primary and secondary can be fired without conflictions (important for instagib)
- self.jump_interval = time + WEP_CVAR_SEC(vaporizer, refire) * W_WeaponRateFactor();
-
- // decrease ammo for the laser?
- if(WEP_CVAR_SEC(vaporizer, ammo))
- W_DecreaseAmmo(WEP_CVAR_SEC(vaporizer, ammo));
-
- // ugly instagib hack to reuse the fire mode of the laser
- makevectors(self.v_angle);
- int oldwep = self.weapon; // we can't avoid this hack
- self.weapon = WEP_BLASTER.m_id;
- W_Blaster_Attack(
- WEP_BLASTER.m_id | HITTYPE_SECONDARY,
- WEP_CVAR_SEC(vaporizer, shotangle),
- WEP_CVAR_SEC(vaporizer, damage),
- WEP_CVAR_SEC(vaporizer, edgedamage),
- WEP_CVAR_SEC(vaporizer, radius),
- WEP_CVAR_SEC(vaporizer, force),
- WEP_CVAR_SEC(vaporizer, speed),
- WEP_CVAR_SEC(vaporizer, spread),
- WEP_CVAR_SEC(vaporizer, delay),
- WEP_CVAR_SEC(vaporizer, lifetime)
- );
- self.weapon = oldwep;
-
- // now do normal refire
- weapon_thinkf(WFRAME_FIRE2, WEP_CVAR_SEC(vaporizer, animtime), w_ready);
- }
- }
- else
- self.held_down = false;
-
- return true;
- }
- case WR_INIT:
- {
- precache_model("models/nexflash.md3");
- precache_model(W_Model("g_minstanex.md3"));
- precache_model(W_Model("v_minstanex.md3"));
- precache_model(W_Model("h_minstanex.iqm"));
- precache_sound(W_Sound("minstanexfire"));
- precache_sound(W_Sound("nexwhoosh1"));
- precache_sound(W_Sound("nexwhoosh2"));
- precache_sound(W_Sound("nexwhoosh3"));
- //W_Blaster(WR_INIT); // Samual: Is this really the proper thing to do? Didn't we already run this previously?
- VAPORIZER_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
- return true;
- }
- case WR_SETUP:
- {
- self.ammo_field = WEP_AMMO(VAPORIZER);
- self.vaporizer_lasthit = 0;
- return true;
- }
- case WR_CHECKAMMO1:
- {
- ammo_amount = self.WEP_AMMO(VAPORIZER) >= vaporizer_ammo;
- ammo_amount += self.(weapon_load[WEP_VAPORIZER.m_id]) >= vaporizer_ammo;
- return ammo_amount;
- }
- case WR_CHECKAMMO2:
- {
- if(!WEP_CVAR_SEC(vaporizer, ammo))
- return true;
- ammo_amount = self.WEP_AMMO(VAPORIZER) >= WEP_CVAR_SEC(vaporizer, ammo);
- ammo_amount += self.(weapon_load[WEP_VAPORIZER.m_id]) >= WEP_CVAR_SEC(vaporizer, ammo);
- return ammo_amount;
- }
- case WR_CONFIG:
- {
- VAPORIZER_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
- return true;
- }
- case WR_RESETPLAYER:
- {
- self.vaporizer_lasthit = 0;
- return true;
- }
- case WR_RELOAD:
- {
- float used_ammo;
- if(WEP_CVAR_SEC(vaporizer, ammo))
- used_ammo = min(vaporizer_ammo, WEP_CVAR_SEC(vaporizer, ammo));
- else
- used_ammo = vaporizer_ammo;
-
- W_Reload(used_ammo, W_Sound("reload"));
- return true;
- }
- case WR_SUICIDEMESSAGE:
- {
- return WEAPON_THINKING_WITH_PORTALS;
- }
- case WR_KILLMESSAGE:
- {
- return WEAPON_VAPORIZER_MURDER;
- }
- }
- return false;
+METHOD(Vaporizer, wr_aim, void(entity thiswep, entity actor))
+{
+ if(actor.(thiswep.ammo_field) > 0)
+ PHYS_INPUT_BUTTON_ATCK(actor) = bot_aim(actor, 1000000, 0, 1, false);
+ else
+ 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
+}
+METHOD(Vaporizer, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
+{
+ float vaporizer_ammo = ((g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo));
+ // if the laser uses load, we also consider its ammo for reloading
+ if(WEP_CVAR(vaporizer, reload_ammo) && WEP_CVAR_SEC(vaporizer, ammo) && actor.clip_load < min(vaporizer_ammo, WEP_CVAR_SEC(vaporizer, ammo))) { // forced reload
+ thiswep.wr_reload(thiswep, actor, weaponentity);
+ } else if(WEP_CVAR(vaporizer, reload_ammo) && actor.clip_load < vaporizer_ammo) { // forced reload
+ thiswep.wr_reload(thiswep, actor, weaponentity);
+ }
+ if((fire & 1) && (actor.ammo_cells || !autocvar_g_rm) && !forbidWeaponUse(actor))
+ {
+ if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(vaporizer, refire)))
+ {
+ W_Vaporizer_Attack(thiswep, actor, weaponentity);
+ weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(vaporizer, animtime), w_ready);
+ }
+ }
+ if((fire & 2) || ((fire & 1) && !actor.ammo_cells && autocvar_g_rm))
+ {
+ if((autocvar_g_rm && autocvar_g_rm_laser) || autocvar_g_rm_laser == 2)
+ {
+ bool rapid = autocvar_g_rm_laser_rapid;
+ if(actor.(weaponentity).jump_interval <= time && !actor.(weaponentity).held_down)
+ {
+ if(rapid)
+ actor.(weaponentity).held_down = true;
+ actor.(weaponentity).jump_interval = time + autocvar_g_rm_laser_refire;
+ actor.(weaponentity).jump_interval2 = time + autocvar_g_rm_laser_rapid_delay;
+ damage_goodhits = 0;
+ W_RocketMinsta_Attack2(actor, weaponentity);
+ }
+ else if(rapid && actor.(weaponentity).jump_interval2 <= time && actor.(weaponentity).held_down)
+ {
+ actor.(weaponentity).jump_interval2 = time + autocvar_g_rm_laser_rapid_refire;
+ damage_goodhits = 0;
+ W_RocketMinsta_Attack3(actor, weaponentity);
+ //weapon_thinkf(actor, WFRAME_FIRE2, autocvar_g_rm_laser_rapid_animtime, w_ready);
+ }
+ }
+ else if (actor.(weaponentity).jump_interval <= time)
+ {
+ // handle refire manually, so that primary and secondary can be fired without conflictions (important for instagib)
+ actor.(weaponentity).jump_interval = time + WEP_CVAR_SEC(vaporizer, refire) * W_WeaponRateFactor(actor);
+
+ // decrease ammo for the laser?
+ if(WEP_CVAR_SEC(vaporizer, ammo))
+ W_DecreaseAmmo(thiswep, actor, WEP_CVAR_SEC(vaporizer, ammo), weaponentity);
+
+ // ugly instagib hack to reuse the fire mode of the laser
+ makevectors(actor.v_angle);
+ Weapon oldwep = actor.(weaponentity).m_weapon; // we can't avoid this hack
+ actor.(weaponentity).m_weapon = WEP_BLASTER;
+ W_Blaster_Attack(
+ actor,
+ weaponentity,
+ WEP_BLASTER.m_id | HITTYPE_SECONDARY,
+ WEP_CVAR_SEC(vaporizer, shotangle),
+ WEP_CVAR_SEC(vaporizer, damage),
+ WEP_CVAR_SEC(vaporizer, edgedamage),
+ WEP_CVAR_SEC(vaporizer, radius),
+ WEP_CVAR_SEC(vaporizer, force),
+ WEP_CVAR_SEC(vaporizer, speed),
+ WEP_CVAR_SEC(vaporizer, spread),
+ WEP_CVAR_SEC(vaporizer, delay),
+ WEP_CVAR_SEC(vaporizer, lifetime)
+ );
+ actor.(weaponentity).m_weapon = oldwep;
+
+ // now do normal refire
+ weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(vaporizer, animtime), w_ready);
+ }
+ }
+ else
+ actor.(weaponentity).held_down = false;
+}
+METHOD(Vaporizer, wr_setup, void(entity thiswep, entity actor))
+{
+ actor.ammo_field = (thiswep.ammo_field);
+ actor.vaporizer_lasthit = 0;
+}
+METHOD(Vaporizer, wr_checkammo1, bool(entity thiswep, entity actor, .entity weaponentity))
+{
+ float vaporizer_ammo = ((g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo));
+ float ammo_amount = actor.(thiswep.ammo_field) >= vaporizer_ammo;
+ ammo_amount += actor.(weapon_load[WEP_VAPORIZER.m_id]) >= vaporizer_ammo;
+ return ammo_amount;
+}
+METHOD(Vaporizer, wr_checkammo2, bool(entity thiswep, entity actor, .entity weaponentity))
+{
+ if(!WEP_CVAR_SEC(vaporizer, ammo))
+ return true;
+ float ammo_amount = actor.(thiswep.ammo_field) >= WEP_CVAR_SEC(vaporizer, ammo);
+ ammo_amount += actor.(weapon_load[WEP_VAPORIZER.m_id]) >= WEP_CVAR_SEC(vaporizer, ammo);
+ return ammo_amount;
+}
+METHOD(Vaporizer, wr_resetplayer, void(entity thiswep, entity actor))
+{
+ actor.vaporizer_lasthit = 0;
+}
+METHOD(Vaporizer, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
+{
+ float vaporizer_ammo = ((g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo));
+ float used_ammo;
+ if(WEP_CVAR_SEC(vaporizer, ammo))
+ used_ammo = min(vaporizer_ammo, WEP_CVAR_SEC(vaporizer, ammo));
+ else
+ used_ammo = vaporizer_ammo;
+
+ W_Reload(actor, weaponentity, used_ammo, SND_RELOAD);
+}
+METHOD(Vaporizer, wr_suicidemessage, Notification(entity thiswep))
+{
+ return WEAPON_THINKING_WITH_PORTALS;
}
+METHOD(Vaporizer, wr_killmessage, Notification(entity thiswep))
+{
+ return WEAPON_VAPORIZER_MURDER;
+}
+
#endif
#ifdef CSQC
-float W_Vaporizer(float req)
-{SELFPARAM();
- switch(req)
- {
- case WR_IMPACTEFFECT:
- {
- vector org2 = w_org + w_backoff * 6;
- if(w_deathtype & HITTYPE_SECONDARY)
- {
- pointparticles(particleeffectnum(EFFECT_BLASTER_IMPACT), org2, w_backoff * 1000, 1);
- if(!w_issilent) { sound(self, CH_SHOTS, W_Sound("laserimpact"), VOL_BASE, ATTN_NORM); }
- }
- else
- {
- pointparticles(particleeffectnum(EFFECT_VORTEX_IMPACT), org2, '0 0 0', 1);
- if(!w_issilent) { sound(self, CH_SHOTS, W_Sound("neximpact"), VOL_BASE, ATTN_NORM); }
- }
- return true;
- }
- case WR_INIT:
- {
- precache_sound(W_Sound("laserimpact"));
- precache_sound(W_Sound("neximpact"));
- if(autocvar_cl_reticle && autocvar_cl_reticle_weapon)
- {
- precache_pic("gfx/reticle_nex");
- }
- return true;
- }
- case WR_ZOOMRETICLE:
- {
- if(button_zoom || zoomscript_caught)
- {
- reticle_image = "gfx/reticle_nex";
- return true;
- }
- else
- {
- // no weapon specific image for this weapon
- return false;
- }
- }
- }
- return false;
+
+METHOD(Vaporizer, wr_impacteffect, void(entity thiswep, entity actor))
+{
+ vector org2 = w_org + w_backoff * 6;
+ if(w_deathtype & HITTYPE_SECONDARY)
+ {
+ pointparticles(EFFECT_BLASTER_IMPACT, org2, w_backoff * 1000, 1);
+ if(!w_issilent) { sound(actor, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTN_NORM); }
+ }
+ else
+ {
+ pointparticles(EFFECT_VORTEX_IMPACT, org2, '0 0 0', 1);
+ if(!w_issilent) { sound(actor, CH_SHOTS, SND_NEXIMPACT, VOL_BASE, ATTN_NORM); }
+ }
}
+METHOD(Vaporizer, wr_init, void(entity thiswep))
+{
+ if(autocvar_cl_reticle && autocvar_cl_reticle_weapon)
+ {
+ precache_pic("gfx/reticle_nex");
+ }
+}
+METHOD(Vaporizer, wr_zoomreticle, bool(entity thiswep))
+{
+ if(button_zoom || zoomscript_caught)
+ {
+ reticle_image = "gfx/reticle_nex";
+ return true;
+ }
+ else
+ {
+ // no weapon specific image for this weapon
+ return false;
+ }
+}
+
#endif
#endif