zoomdir = button_zoom;
if(hud == HUD_NORMAL)
- if((getstati(STAT_ACTIVEWEAPON) == WEP_NEX && nex_scope) || (getstati(STAT_ACTIVEWEAPON) == WEP_RIFLE && rifle_scope)) // do NOT use switchweapon here
+ if((activeweapon == WEP_NEX && nex_scope) || (activeweapon == WEP_RIFLE && rifle_scope)) // do NOT use switchweapon here
zoomdir += button_attack2;
if(spectatee_status > 0 || isdemo())
{
}
ColorTranslateMode = autocvar_cl_stripcolorcodes;
- activeweapon = getstati(STAT_SWITCHWEAPON);
+
+ // 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 *= -2 * g_weaponswitchdelay;
+ 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);