vector targpos;
// check to see if we can still continue, otherwise give up now
- if((self.realowner.deadflag != DEAD_NO) && WEP_CVAR(shockwave, melee_no_doubleslap))
+ if(IS_DEAD(self.realowner) && WEP_CVAR(shockwave, melee_no_doubleslap))
{
remove(self);
return;
sound(actor, CH_WEAPON_A, SND_SHOTGUN_MELEE, VOL_BASE, ATTN_NORM);
weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR(shockwave, melee_animtime), w_ready);
- entity meleetemp = new(meleetemp);
- make_pure(meleetemp);
+ entity meleetemp = new_pure(meleetemp);
meleetemp.owner = meleetemp.realowner = actor;
meleetemp.think = W_Shockwave_Melee_Think;
meleetemp.nextthink = time + WEP_CVAR(shockwave, melee_delay) * W_WeaponRateFactor();
- W_SetupShot_Range(actor, true, 0, "", 0, WEP_CVAR(shockwave, melee_damage), WEP_CVAR(shockwave, melee_range));
+ W_SetupShot_Range(actor, true, 0, SND_Null, 0, WEP_CVAR(shockwave, melee_damage), WEP_CVAR(shockwave, melee_range));
}
// SHOCKWAVE ATTACK MODE
float i, queue = 0;
// set up the shot direction
- W_SetupShot(self, false, 3, SND(LASERGUN_FIRE), CH_WEAPON_B, WEP_CVAR(shockwave, blast_damage));
+ W_SetupShot(self, false, 3, SND_LASERGUN_FIRE, CH_WEAPON_B, WEP_CVAR(shockwave, blast_damage));
vector attack_endpos = (w_shotorg + (w_shotdir * WEP_CVAR(shockwave, blast_distance)));
WarpZone_TraceLine(w_shotorg, attack_endpos, MOVE_NOMONSTERS, self);
vector attack_hitpos = trace_endpos;
}
}
- METHOD(Shockwave, wr_aim, void(entity thiswep))
- {
- if(vlen(self.origin - self.enemy.origin) <= WEP_CVAR(shockwave, melee_range))
- { self.BUTTON_ATCK2 = bot_aim(1000000, 0, 0.001, false); }
- else
- { self.BUTTON_ATCK = bot_aim(1000000, 0, 0.001, false); }
- }
- METHOD(Shockwave, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
- {
- if(fire & 1)
- {
- if(time >= actor.shockwave_blasttime) // handle refire separately so the secondary can be fired straight after a primary
- {
- if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(shockwave, blast_animtime)))
- {
- W_Shockwave_Attack();
- actor.shockwave_blasttime = time + WEP_CVAR(shockwave, blast_refire) * W_WeaponRateFactor();
- weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(shockwave, blast_animtime), w_ready);
- }
- }
- }
- else if(fire & 2)
- {
- //if(actor.clip_load >= 0) // we are not currently reloading
- if(!actor.crouch) // no crouchmelee please
- if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR(shockwave, melee_refire)))
- {
- // attempt forcing playback of the anim by switching to another anim (that we never play) here...
- weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, 0, W_Shockwave_Melee);
- }
- }
- }
- METHOD(Shockwave, wr_checkammo1, bool(entity thiswep))
- {
- return true; // infinite ammo
- }
- METHOD(Shockwave, wr_checkammo2, bool(entity thiswep))
- {
- // shockwave has infinite ammo
- return true;
- }
- METHOD(Shockwave, wr_suicidemessage, int(entity thiswep))
- {
- return WEAPON_THINKING_WITH_PORTALS;
- }
- METHOD(Shockwave, wr_killmessage, int(entity thiswep))
- {
- if(w_deathtype & HITTYPE_SECONDARY)
- return WEAPON_SHOCKWAVE_MURDER_SLAP;
- else
- return WEAPON_SHOCKWAVE_MURDER;
- }
+METHOD(Shockwave, wr_aim, void(entity thiswep))
+{
+ SELFPARAM();
+ if(vlen(self.origin - self.enemy.origin) <= WEP_CVAR(shockwave, melee_range))
+ { PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(self, 1000000, 0, 0.001, false); }
+ else
+ { PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(self, 1000000, 0, 0.001, false); }
+}
+METHOD(Shockwave, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
+{
+ if(fire & 1)
+ {
+ if(time >= actor.shockwave_blasttime) // handle refire separately so the secondary can be fired straight after a primary
+ {
+ if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(shockwave, blast_animtime)))
+ {
+ W_Shockwave_Attack();
+ actor.shockwave_blasttime = time + WEP_CVAR(shockwave, blast_refire) * W_WeaponRateFactor();
+ weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(shockwave, blast_animtime), w_ready);
+ }
+ }
+ }
+ else if(fire & 2)
+ {
+ //if(actor.clip_load >= 0) // we are not currently reloading
+ if(!actor.crouch) // no crouchmelee please
+ if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR(shockwave, melee_refire)))
+ {
+ // attempt forcing playback of the anim by switching to another anim (that we never play) here...
+ weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, 0, W_Shockwave_Melee);
+ }
+ }
+}
+METHOD(Shockwave, wr_checkammo1, bool(entity thiswep))
+{
+ return true; // infinite ammo
+}
+METHOD(Shockwave, wr_checkammo2, bool(entity thiswep))
+{
+ // shockwave has infinite ammo
+ return true;
+}
+METHOD(Shockwave, wr_suicidemessage, Notification(entity thiswep))
+{
+ return WEAPON_THINKING_WITH_PORTALS;
+}
+METHOD(Shockwave, wr_killmessage, Notification(entity thiswep))
+{
+ if(w_deathtype & HITTYPE_SECONDARY)
+ return WEAPON_SHOCKWAVE_MURDER_SLAP;
+ else
+ return WEAPON_SHOCKWAVE_MURDER;
+}
#endif
#ifdef CSQC
void Draw_Shockwave(entity this)
{
// fading/removal control
- float a = bound(0, (SW_MAXALPHA - ((time - self.sw_time) / SW_FADETIME)), SW_MAXALPHA);
- if(a < ALPHA_MIN_VISIBLE) { remove(self); }
+ float a = bound(0, (SW_MAXALPHA - ((time - this.sw_time) / SW_FADETIME)), SW_MAXALPHA);
+ if(a < ALPHA_MIN_VISIBLE) { remove(this); }
// WEAPONTODO: save this only once when creating the entity
- vector sw_color = entcs_GetColor(self.sv_entnum - 1); // GetTeamRGB(entcs_GetTeam(self.sv_entnum));
+ vector sw_color = entcs_GetColor(this.sv_entnum - 1); // GetTeamRGB(entcs_GetTeam(this.sv_entnum));
// WEAPONTODO: trace to find what we actually hit
- vector endpos = (self.sw_shotorg + (self.sw_shotdir * self.sw_distance));
+ vector endpos = (this.sw_shotorg + (this.sw_shotdir * this.sw_distance));
- vectorvectors(self.sw_shotdir);
+ vectorvectors(this.sw_shotdir);
vector right = v_right; // save this for when we do makevectors later
vector up = v_up; // save this for when we do makevectors later
// WEAPONTODO: combine and simplify these calculations
- vector min_end = ((self.sw_shotorg + (self.sw_shotdir * SW_DISTTOMIN)) + (up * self.sw_spread_min));
- vector max_end = (endpos + (up * self.sw_spread_max));
- float spread_to_min = vlen(normalize(min_end - self.sw_shotorg) - self.sw_shotdir);
- float spread_to_max = vlen(normalize(max_end - min_end) - self.sw_shotdir);
+ vector min_end = ((this.sw_shotorg + (this.sw_shotdir * SW_DISTTOMIN)) + (up * this.sw_spread_min));
+ vector max_end = (endpos + (up * this.sw_spread_max));
+ float spread_to_min = vlen(normalize(min_end - this.sw_shotorg) - this.sw_shotdir);
+ float spread_to_max = vlen(normalize(max_end - min_end) - this.sw_shotdir);
vector first_min_end = '0 0 0', prev_min_end = '0 0 0', new_min_end = '0 0 0';
vector first_max_end = '0 0 0', prev_max_end = '0 0 0', new_max_end = '0 0 0';
// first do the spread_to_min effect
deviation = angle * spread_to_min;
- deviation = ((self.sw_shotdir + (right * deviation.y) + (up * deviation.z)));
+ deviation = ((this.sw_shotdir + (right * deviation.y) + (up * deviation.z)));
new_min_dist = SW_DISTTOMIN;
- new_min_end = (self.sw_shotorg + (deviation * new_min_dist));
- //te_lightning2(world, new_min_end, self.sw_shotorg);
+ new_min_end = (this.sw_shotorg + (deviation * new_min_dist));
+ //te_lightning2(world, new_min_end, this.sw_shotorg);
// then calculate spread_to_max effect
deviation = angle * spread_to_max;
- deviation = ((self.sw_shotdir + (right * deviation.y) + (up * deviation.z)));
+ deviation = ((this.sw_shotdir + (right * deviation.y) + (up * deviation.z)));
new_max_dist = vlen(new_min_end - endpos);
new_max_end = (new_min_end + (deviation * new_max_dist));
//te_lightning2(world, new_end, prev_min_end);
R_BeginPolygon("", DRAWFLAG_NORMAL);
R_PolygonVertex(prev_min_end, '0 0 0', sw_color, a);
R_PolygonVertex(new_min_end, '0 0 0', sw_color, a);
- R_PolygonVertex(self.sw_shotorg, '0 0 0', sw_color, a);
+ R_PolygonVertex(this.sw_shotorg, '0 0 0', sw_color, a);
R_EndPolygon();
// draw from min spread radius to max spread radius
R_BeginPolygon("", DRAWFLAG_NORMAL);
R_PolygonVertex(prev_min_end, '0 0 0', sw_color, a);
R_PolygonVertex(first_min_end, '0 0 0', sw_color, a);
- R_PolygonVertex(self.sw_shotorg, '0 0 0', sw_color, a);
+ R_PolygonVertex(this.sw_shotorg, '0 0 0', sw_color, a);
R_EndPolygon();
// draw from min spread radius to max spread radius
shockwave.sw_time = time;
}
- METHOD(Shockwave, wr_impacteffect, void(entity thiswep))
- {
- // handled by Net_ReadShockwaveParticle
- //vector org2;
- //org2 = w_org + w_backoff * 2;
- //pointparticles(EFFECT_BLASTER_IMPACT, org2, w_backoff * 1000, 1);
- }
+METHOD(Shockwave, wr_impacteffect, void(entity thiswep))
+{
+ // handled by Net_ReadShockwaveParticle
+ //vector org2;
+ //org2 = w_org + w_backoff * 2;
+ //pointparticles(EFFECT_BLASTER_IMPACT, org2, w_backoff * 1000, 1);
+}
#endif
#endif