float t;
t = 1.0 / g_weaponratefactor;
- if(g_runematch)
- {
- if(self.runes & RUNE_SPEED)
- {
- if(self.runes & CURSE_SLOW)
- t = t * autocvar_g_balance_rune_speed_combo_atkrate;
- else
- t = t * autocvar_g_balance_rune_speed_atkrate;
- }
- else if(self.runes & CURSE_SLOW)
- {
- t = t * autocvar_g_balance_curse_slow_atkrate;
- }
- }
-
return t;
}
lag = ANTILAG_LATENCY(player);
if(lag < 0.001)
lag = 0;
- if(clienttype(player) != CLIENTTYPE_REAL)
+ if not(IS_REAL_CLIENT(player))
lag = 0; // only antilag for clients
org = player.origin + player.view_ofs;
traceline_antilag_force(player, org, org + screenforward * MAX_SHOT_DISTANCE, MOVE_NORMAL, player, lag);
- if(trace_ent.flags & FL_CLIENT)
+ if(IS_CLIENT(trace_ent))
{
antilag_takeback(trace_ent, time - lag);
hitplot = W_HitPlotNormalizedUntransform(org, trace_ent, screenforward, screenright, screenup, trace_endpos);
.float prevstrengthsoundattempt;
void W_PlayStrengthSound(entity player) // void W_PlayStrengthSound
{
- if((!g_minstagib)
- && (player.items & IT_STRENGTH)
- && ((time > player.prevstrengthsound + autocvar_sv_strengthsound_antispam_time) // prevent insane sound spam
- || (time > player.prevstrengthsoundattempt + autocvar_sv_strengthsound_antispam_refire_threshold)))
+ if((player.items & IT_STRENGTH)
+ && ((time > player.prevstrengthsound + autocvar_sv_strengthsound_antispam_time) // prevent insane sound spam
+ || (time > player.prevstrengthsoundattempt + autocvar_sv_strengthsound_antispam_refire_threshold)))
{
sound(player, CH_TRIGGER, "weapons/strength_fire.wav", VOL_BASE, ATTN_NORM);
player.prevstrengthsound = time;
if (!trace_ent.takedamage)
{
traceline_antilag_force (ent, w_shotorg, w_shotorg + w_shotdir * range, MOVE_NORMAL, ent, ANTILAG_LATENCY(ent));
- if (trace_ent.takedamage && trace_ent.classname == "player")
+ if (trace_ent.takedamage && IS_PLAYER(trace_ent))
{
entity e;
e = trace_ent;
if (ent.cursor_trace_ent) // client was aiming at someone
if (ent.cursor_trace_ent != ent) // just to make sure
if (ent.cursor_trace_ent.takedamage) // and that person is killable
- if (ent.cursor_trace_ent.classname == "player") // and actually a player
+ if (IS_PLAYER(ent.cursor_trace_ent)) // and actually a player
{
// verify that the shot would miss without antilag
// (avoids an issue where guns would always shoot at their origin)
float CL_Weaponentity_CustomizeEntityForClient()
{
self.viewmodelforclient = self.owner;
- if(other.classname == "spectator")
+ if(IS_SPEC(other))
if(other.enemy == self.owner)
self.viewmodelforclient = other;
return TRUE;
setmodel(self, strcat("models/weapons/h_", name, ".iqm")); // precision set below
// preset some defaults that work great for renamed zym files (which don't need an animinfo)
- self.anim_fire1 = animfixfps(self, '0 1 0.01');
- self.anim_fire2 = animfixfps(self, '1 1 0.01');
- self.anim_idle = animfixfps(self, '2 1 0.01');
- self.anim_reload = animfixfps(self, '3 1 0.01');
+ self.anim_fire1 = animfixfps(self, '0 1 0.01', '0 0 0');
+ self.anim_fire2 = animfixfps(self, '1 1 0.01', '0 0 0');
+ self.anim_idle = animfixfps(self, '2 1 0.01', '0 0 0');
+ self.anim_reload = animfixfps(self, '3 1 0.01', '0 0 0');
// if we have a "weapon" tag, let's attach the v_ model to it ("invisible hand" style model)
// if we don't, this is a "real" animated model
}
self.angles = '0 0 0';
- float f;
+
+ float f = (self.owner.weapon_nextthink - time);
if (self.state == WS_RAISE && !intermission_running)
{
- f = (self.owner.weapon_nextthink - time) * g_weaponratefactor / autocvar_g_balance_weaponswitchdelay;
+ entity newwep = get_weaponinfo(self.owner.switchweapon);
+ f = f * g_weaponratefactor / max(f, cvar(sprintf("g_balance_%s_switchdelay_raise", newwep.netname)));
+ //print(sprintf("CL_Weaponentity_Think(): cvar: %s, value: %f, nextthink: %f\n", sprintf("g_balance_%s_switchdelay_raise", newwep.netname), cvar(sprintf("g_balance_%s_switchdelay_raise", newwep.netname)), (self.owner.weapon_nextthink - time)));
self.angles_x = -90 * f * f;
}
else if (self.state == WS_DROP && !intermission_running)
{
- f = 1 - (self.owner.weapon_nextthink - time) * g_weaponratefactor / autocvar_g_balance_weaponswitchdelay;
+ entity oldwep = get_weaponinfo(self.owner.weapon);
+ f = 1 - f * g_weaponratefactor / max(f, cvar(sprintf("g_balance_%s_switchdelay_drop", oldwep.netname)));
+ //print(sprintf("CL_Weaponentity_Think(): cvar: %s, value: %f, nextthink: %f\n", sprintf("g_balance_%s_switchdelay_drop", oldwep.netname), cvar(sprintf("g_balance_%s_switchdelay_drop", oldwep.netname)), (self.owner.weapon_nextthink - time)));
self.angles_x = -90 * f * f;
}
else if (self.state == WS_CLEAR)
void CL_ExteriorWeaponentity_Think()
{
float tag_found;
- vector ang;
self.nextthink = time;
if (self.owner.exteriorweaponentity != self)
{
setattachment(self, self.owner, "bip01 r hand");
}
self.effects = self.owner.effects;
- if(sv_pitch_min == sv_pitch_max)
- self.effects |= EF_LOWPRECISION;
- else
- self.effects &~= EF_LOWPRECISION;
+ self.effects |= EF_LOWPRECISION;
self.effects = self.effects & EFMASK_CHEAP; // eat performance
if(self.owner.alpha == default_player_alpha)
self.alpha = default_weapon_alpha;
else
self.alpha = 1;
- if (!intermission_running)
- {
- ang_x = bound(sv_pitch_min, self.owner.v_angle_x, sv_pitch_max);
- ang_y = 0;
- ang_z = 0;
-
- if(sv_pitch_fixyaw) // workaround for stupid player models that don't aim forward
- {
- ang_y = self.owner.v_angle_y;
- makevectors(ang);
- var vector v = v_forward;
- var float t = self.tag_entity.frame1time;
- var float f = self.tag_entity.frame;
- self.tag_entity.frame1time = time;
- self.tag_entity.frame = self.tag_entity.anim_idle_x;
- gettaginfo(self.tag_entity, self.tag_index);
- self.tag_entity.frame1time = t;
- self.tag_entity.frame = f;
- // untransform v according to this coordinate space
- vector w;
- w_x = v_forward * v;
- w_y = -v_right * v;
- w_z = v_up * v;
- self.angles = vectoangles(w);
- }
- else
- {
- ang_x = -/* don't ask */ang_x;
- self.angles = ang;
- }
-
- if(autocvar_g_loituma)
- {
- vector modangles;
- float t;
-
- t = time * autocvar_g_loituma;
-
- modangles_x = t * 360;
- modangles_y = 90;
- modangles_z = 0;
-
- self.angles =
- AnglesTransform_ToAngles(
- AnglesTransform_Multiply(
- AnglesTransform_FromAngles(self.angles),
- AnglesTransform_FromAngles(modangles)
- )
- );
- }
- }
-
self.glowmod = self.owner.weaponentity_glowmod;
self.colormap = self.owner.colormap;
if (!f)
{
if (complain)
- if(clienttype(cl) == CLIENTTYPE_REAL)
+ if(IS_REAL_CLIENT(cl))
{
play2(cl, "weapons/unavailable.wav");
- sprint(cl, strcat("You don't have any ammo for the ^2", W_Name(wpn), "\n"));
Send_WeaponComplain (cl, wpn, W_Name(wpn), 0);
}
return FALSE;
// Report Proper Weapon Status / Modified Weapon Ownership Message
if (WEPSET_CONTAINS_AW(weaponsInMap, wpn))
{
- sprint(cl, strcat("You do not have the ^2", W_Name(wpn), "\n") );
- Send_WeaponComplain (cl, wpn, W_Name(wpn), 1);
+ Send_WeaponComplain(cl, wpn, W_Name(wpn), 1);
if(autocvar_g_showweaponspawns)
{
else
{
Send_WeaponComplain (cl, wpn, W_Name(wpn), 2);
- sprint(cl, strcat("The ^2", W_Name(wpn), "^7 is ^1NOT AVAILABLE^7 in this map\n") );
}
play2(cl, "weapons/unavailable.wav");
W_SwitchWeapon_Force(pl, ww);
}
-string PrimaryOrSecondary(float secondary)
-{
- if(secondary)
- return "secondary";
- else
- return "primary";
-}
-
.float prevdryfire;
.float prevwarntime;
float weapon_prepareattack_checkammo(float secondary)
{
if(time - self.prevwarntime > 1)
{
- sprint(self, strcat("^2", W_Name(self.weapon), " ", PrimaryOrSecondary(secondary), "^7 is unable to fire, but its ^2", PrimaryOrSecondary(1 - secondary), "^7 can.\n"));
+ Send_Notification(
+ NOTIF_ONE,
+ self,
+ MSG_MULTI,
+ ITEM_WEAPON_PRIMORSEC,
+ self.weapon,
+ secondary,
+ (1 - secondary)
+ );
}
self.prevwarntime = time;
}
if (self.weaponentity)
{
self.weaponentity.wframe = fr;
+ a = '0 0 0';
if (fr == WFRAME_IDLE)
a = self.weaponentity.anim_idle;
else if (fr == WFRAME_FIRE1)
a = self.weaponentity.anim_fire1;
else if (fr == WFRAME_FIRE2)
a = self.weaponentity.anim_fire2;
- else if (fr == WFRAME_RELOAD)
+ else // if (fr == WFRAME_RELOAD)
a = self.weaponentity.anim_reload;
a_z *= g_weaponratefactor;
setanim(self.weaponentity, a, restartanim == FALSE, restartanim, restartanim);
self.weapon_think = func;
//dprint("next ", ftos(self.weapon_nextthink), "\n");
- // The shoot animation looks TERRIBLE without animation blending! Yay for moonwalking while shooting!
- //anim = self.anim_shoot;
- if (restartanim)
- if (t)
- if (!self.crouch) // shoot anim stands up, this looks bad
+ if((fr == WFRAME_FIRE1 || fr == WFRAME_FIRE2) && t)
{
- vector anim;
- if(self.weapon == WEP_SHOTGUN && self.BUTTON_ATCK2)
- {
- anim = self.anim_melee;
- anim_z = anim_y / (t + sys_frametime);
- setanim(self, anim, FALSE, TRUE, TRUE);
- }
- else if (self.animstate_startframe == self.anim_idle_x) // only allow shoot anim to override idle animation until we have animation blending
- {
- anim = self.anim_shoot;
- anim_z = anim_y / (t + sys_frametime);
- setanim(self, anim, FALSE, TRUE, TRUE);
- }
+ if(self.weapon == WEP_SHOTGUN && fr == WFRAME_FIRE2)
+ animdecide_setaction(self, ANIMACTION_MELEE, restartanim);
+ else
+ animdecide_setaction(self, ANIMACTION_SHOOT, restartanim);
+ }
+ else
+ {
+ if(self.anim_upper_action == ANIMACTION_SHOOT || self.anim_upper_action == ANIMACTION_MELEE)
+ self.anim_upper_action = 0;
}
}
if(!self.(self.current_ammo) && self.reload_ammo_min)
if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
{
- if(clienttype(self) == CLIENTTYPE_REAL && self.reload_complain < time)
+ if(IS_REAL_CLIENT(self) && self.reload_complain < time)
{
play2(self, "weapons/unavailable.wav");
sprint(self, strcat("You don't have enough ammo to reload the ^2", W_Name(self.weapon), "\n"));