zoomspeed = 3.5;
zoomdir = button_zoom;
- entity wepent = viewmodels[0]; // TODO: unhardcode
if(hud == HUD_NORMAL && !spectatee_status)
- if(wepent.switchweapon == wepent.activeweapon)
- if((wepent.activeweapon == WEP_VORTEX && !WEP_CVAR(vortex, secondary)) || (wepent.activeweapon == WEP_RIFLE && !WEP_CVAR(rifle, secondary))) // do NOT use switchweapon here
- zoomdir += button_attack2;
+ {
+ for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
+ {
+ entity wepent = viewmodels[slot];
+ if(wepent.switchweapon == wepent.activeweapon)
+ if((wepent.activeweapon == WEP_VORTEX && !WEP_CVAR(vortex, secondary)) || (wepent.activeweapon == WEP_RIFLE && !WEP_CVAR(rifle, secondary))) // do NOT use switchweapon here
+ zoomdir += button_attack2;
+ }
+ }
if(spectatee_status > 0 || isdemo())
{
if(spectatorbutton_zoom)
const float CAMERA_FREE = 1;
const float CAMERA_CHASE = 2;
float reticle_type;
-string reticle_image;
string NextFrameCommand;
vector freeze_org, freeze_ang;
if(autocvar_cl_reticle)
{
- Weapon wep = wepent.activeweapon;
+ string reticle_image = wepent.activeweapon.w_reticle;
+ bool wep_zoomed = false;
+ for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
+ {
+ entity wepe = viewmodels[slot];
+ Weapon wep = wepe.activeweapon;
+ if(wep != WEP_Null && wep.wr_zoom)
+ {
+ bool do_zoom = wep.wr_zoom(wep, NULL);
+ reticle_image = wep.w_reticle;
+ wep_zoomed += do_zoom;
+ }
+ }
// Draw the aiming reticle for weapons that use it
// reticle_type is changed to the item we are zooming / aiming with, to decide which reticle to use
// It must be a persisted float for fading out to work properly (you let go of the zoom button for
// no zoom reticle while dead
reticle_type = 0;
}
- else if(wep.wr_zoomreticle(wep) && autocvar_cl_reticle_weapon)
+ else if(wep_zoomed && autocvar_cl_reticle_weapon)
{
- if(reticle_image != "") { reticle_type = 2; }
+ if(reticle_image && reticle_image != "") { reticle_type = 2; }
else { reticle_type = 0; }
}
else if(button_zoom || zoomscript_caught)