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(wepent.switchweapon != wepent.activeweapon)
+ continue;
+ Weapon wep = wepent.activeweapon;
+ if(wep != WEP_Null && wep.wr_zoomdir)
+ {
+ bool do_zoom = wep.wr_zoomdir(wep); // TODO: merge this with wr_zoom?
+ zoomdir += do_zoom;
+ }
}
}
if(spectatee_status > 0 || isdemo())
// no weapon specific image for this weapon
return false;
}
+ /** (CLIENT) check whether the weapon should zoom (special handling) */
+ METHOD(Weapon, wr_zoomdir, bool(Weapon this)) {return false;}
/** (CLIENT) weapon specific view model */
METHOD(Weapon, wr_viewmodel, string(Weapon this, entity wep)) { return string_null; }
/** (CLIENT) weapon specific glow */
return false;
}
}
+METHOD(Rifle, wr_zoomdir, bool(entity thiswep))
+{
+ return button_attack2 && !WEP_CVAR(rifle, secondary);
+}
#endif
return false;
}
}
+METHOD(Vortex, wr_zoomdir, bool(entity thiswep))
+{
+ return button_attack2 && !WEP_CVAR(vortex, secondary);
+}
#endif