}
ColorTranslateMode = autocvar_cl_stripcolorcodes;
+
+ // next WANTED weapon (for HUD)
switchweapon = getstati(STAT_SWITCHWEAPON);
+
+ // currently switching-to weapon (for crosshair)
+ switchingweapon = getstati(STAT_SWITCHINGWEAPON);
+
+ // actually active weapon (for zoom)
activeweapon = getstati(STAT_ACTIVEWEAPON);
+
f = (serverflags & SERVERFLAG_TEAMPLAY);
if(f != teamplay)
{
HUD_InitScores();
}
- if(last_weapon != activeweapon) {
+ if(last_switchweapon != switchweapon) {
weapontime = time;
- last_weapon = activeweapon;
+ last_switchweapon = switchweapon;
+ }
+ if(last_activeweapon != activeweapon) {
+ last_activeweapon = activeweapon;
e = get_weaponinfo(activeweapon);
if(e.netname != "")
float wcross_scale, wcross_blur;
if (autocvar_crosshair_per_weapon || autocvar_crosshair_color_per_weapon) {
- e = get_weaponinfo(activeweapon);
+ e = get_weaponinfo(switchingweapon);
if (e && e.netname != "")
{
wcross_wep = e.netname;
f = autocvar_crosshair_effect_speed;
if(f < 0)
- f *= -1 * g_weaponswitchdelay; // anim starts when weapon has been lowered and new weapon comes up
+ f *= -2 * g_weaponswitchdelay; // anim starts when weapon has been lowered and new weapon comes up
if(wcross_scale != wcross_scale_goal_prev || wcross_alpha != wcross_alpha_goal_prev || wcross_color != wcross_color_goal_prev)
{
wcross_changedonetime = time + f;
ring_image = "gfx/crosshair_ring.tga";
}
+ // if in weapon switch animation, fade ring out/in
+ if(g_weaponswitchdelay > 0)
+ {
+ f = (time - wcross_name_changestarttime) / g_weaponswitchdelay;
+ if(f > 0 && f < 2)
+ ring_alpha *= fabs(1 - f);
+ }
+
if (autocvar_crosshair_ring_inner && ring_inner_value) // lets draw a ring inside a ring so you can ring while you ring
DrawCircleClippedPic(wcross_origin, wcross_size_x * ring_scale, ring_inner_image, ring_inner_value, ring_inner_rgb, wcross_alpha * ring_inner_alpha, DRAWFLAG_ADDITIVE);
float ps_primary, ps_secondary;
float ts_primary, ts_secondary;
-float last_weapon;
+float last_switchweapon;
+float last_activeweapon;
float weapontime;
float weaponprevtime;
float button_attack2;
float activeweapon;
+float switchingweapon;
float switchweapon;
float current_viewzoom;
float zoomin_effect;
const float STAT_TYPEHIT_TIME = 55;
const float STAT_LAYED_MINES = 56;
const float STAT_HAGAR_LOAD = 57;
+const float STAT_SWITCHINGWEAPON = 58;
// see DP source, quakedef.h
const float STAT_MOVEVARS_AIRSPEEDLIMIT_NONQW = 222;
self.model = "";
self.modelindex = 0;
self.weapon = 0;
+ self.switchingweapon = 0;
self.weaponmodel = "";
self.weaponentity = world;
self.exteriorweaponentity = world;
self.switchweapon = w_getbestweapon(self);
self.cnt = self.switchweapon;
self.weapon = 0;
+ self.switchingweapon = 0;
if(!self.alivetime)
self.alivetime = time;
self.pressedkeys = spectatee.pressedkeys;
self.weapons = spectatee.weapons;
self.switchweapon = spectatee.switchweapon;
+ self.switchingweapon = spectatee.switchingweapon;
self.weapon = spectatee.weapon;
self.nex_charge = spectatee.nex_charge;
self.nex_chargepool_ammo = spectatee.nex_chargepool_ammo;
if(!self.switchweapon)
{
self.weapon = 0;
+ self.switchingweapon = 0;
self.weaponentity.state = WS_CLEAR;
self.weaponname = "";
self.items &~= IT_AMMO;
{
if (self.weaponentity.state == WS_CLEAR)
{
+ // end switching!
+ self.switchingweapon = self.switchweapon;
+
//setanim(self, self.anim_draw, FALSE, TRUE, TRUE);
self.weaponentity.state = WS_RAISE;
weapon_action(self.switchweapon, WR_SETUP);
weapon_thinkf(WFRAME_IDLE, autocvar_g_balance_weaponswitchdelay, w_ready);
weapon_boblayer1(PLAYER_WEAPONSELECTION_SPEED, '0 0 0');
}
+ else if (self.weaponentity.state == WS_DROP)
+ {
+ // in dropping phase we can switch at any time
+ self.switchingweapon = self.switchweapon;
+ }
else if (self.weaponentity.state == WS_READY)
{
+ // start switching!
+ self.switchingweapon = self.switchweapon;
+
#ifndef INDEPENDENT_ATTACK_FINISHED
if(ATTACK_FINISHED(self) <= time + self.weapon_frametime * 0.5)
{
void w_clear()
{
if (self.weapon != -1)
+ {
self.weapon = 0;
+ self.switchingweapon = 0;
+ }
if (self.weaponentity)
{
self.weaponentity.state = WS_CLEAR;
// the two weapon entities will notice this has changed and update their models
self.weapon = windex;
+ self.switchingweapon = windex; // to make sure
self.weaponname = e.mdl;
self.bulletcounter = 0;
};
.entity weaponentity;
.entity exteriorweaponentity;
.vector weaponentity_glowmod;
-.float switchweapon;
+
+//.float weapon; // current weapon
+.float switchweapon; // weapon requested to switch to
+.float switchingweapon; // weapon currently being switched to (is copied from switchweapon once switch is possible)
+
.float autoswitch;
float weapon_action(float wpn, float wrequest);
float client_hasweapon(entity cl, float wpn, float andammo, float complain);
addstat(STAT_WEAPONS, AS_INT, weapons);
addstat(STAT_SWITCHWEAPON, AS_INT, switchweapon);
+ addstat(STAT_SWITCHINGWEAPON, AS_INT, switchingweapon);
addstat(STAT_GAMESTARTTIME, AS_FLOAT, stat_game_starttime);
addstat(STAT_ALLOW_OLDNEXBEAM, AS_INT, stat_allow_oldnexbeam);
Nagger_Init();