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)
if(autocvar_cl_reticle)
{
- Weapon wep = wepent.activeweapon;
+ 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)
+ wep_zoomed += wep.wr_zoom(wep, NULL);
+ }
// 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; }
else { reticle_type = 0; }
METHOD(Weapon, wr_gonethink, void(Weapon this, entity actor, .entity weaponentity)) {}
/** (ALL) dump weapon cvars to config in data directory (see: sv_cmd dumpweapons) */
METHOD(Weapon, wr_config, void(Weapon this)) {}
- /** (CLIENT) weapon specific zoom reticle */
- METHOD(Weapon, wr_zoomreticle, bool(Weapon this)) {
+ /** (BOTH) weapon specific zoom reticle */
+ METHOD(Weapon, wr_zoom, bool(Weapon this, entity actor)) {
// no weapon specific image for this weapon
return false;
}
return WEAPON_RIFLE_MURDER;
}
}
+METHOD(Rifle, wr_zoom, bool(entity thiswep, entity actor))
+{
+ return PHYS_INPUT_BUTTON_ATCK2(actor) && WEP_CVAR(rifle, secondary) == 0;
+}
#endif
#ifdef CSQC
precache_pic("gfx/reticle_nex");
}
}
-METHOD(Rifle, wr_zoomreticle, bool(entity thiswep))
+METHOD(Rifle, wr_zoom, bool(entity thiswep, entity actor))
{
if(button_zoom || zoomscript_caught)
{
precache_pic("gfx/reticle_nex");
}
}
-METHOD(Vaporizer, wr_zoomreticle, bool(entity thiswep))
+METHOD(Vaporizer, wr_zoom, bool(entity thiswep, entity actor))
{
if(button_zoom || zoomscript_caught)
{
{
return WEAPON_VORTEX_MURDER;
}
+METHOD(Vortex, wr_zoom, bool(entity thiswep, entity actor))
+{
+ return PHYS_INPUT_BUTTON_ATCK2(actor);
+}
#endif
#ifdef CSQC
precache_pic("gfx/reticle_nex");
}
}
-METHOD(Vortex, wr_zoomreticle, bool(entity thiswep))
+METHOD(Vortex, wr_zoom, bool(entity thiswep, entity actor))
{
if(button_zoom || zoomscript_caught || (!WEP_CVAR(vortex, secondary) && button_attack2))
{
}
// WEAPONTODO: Add weapon request for this
- .entity weaponentity = weaponentities[0]; // TODO: unhardcode
if (!zoomstate_set) {
- SetZoomState(this,
- PHYS_INPUT_BUTTON_ZOOM(this) || PHYS_INPUT_BUTTON_ZOOMSCRIPT(this)
- || (PHYS_INPUT_BUTTON_ATCK2(this) && this.(weaponentity).m_weapon == WEP_VORTEX)
- || (PHYS_INPUT_BUTTON_ATCK2(this) && this.(weaponentity).m_weapon == WEP_RIFLE && WEP_CVAR(rifle, secondary) == 0)
- );
+ bool wep_zoomed = false;
+ for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
+ {
+ .entity weaponentity = weaponentities[slot];
+ Weapon thiswep = this.(weaponentity).m_weapon;
+ if(thiswep != WEP_Null && thiswep.wr_zoom)
+ wep_zoomed += thiswep.wr_zoom(thiswep, this);
+ }
+ SetZoomState(this, PHYS_INPUT_BUTTON_ZOOM(this) || PHYS_INPUT_BUTTON_ZOOMSCRIPT(this) || wep_zoomed);
}
if (this.teamkill_soundtime && time > this.teamkill_soundtime)
// WEAPONTODO: Move into weaponsystem somehow
// if a player goes unarmed after holding a loaded weapon, empty his clip size and remove the crosshair ammo ring
+ .entity weaponentity = weaponentities[0];
if (this.(weaponentity).m_weapon == WEP_Null)
this.clip_load = this.clip_size = 0;
}
string AppendItemcodes(string s, entity player)
{
- .entity weaponentity = weaponentities[0]; // TODO: unhardcode
-
- int w = player.(weaponentity).m_weapon.m_id;
- //if(w == 0)
- // w = player.switchweapon;
- if(w == 0)
- w = player.(weaponentity).cnt; // previous weapon!
- s = strcat(s, ftos(w));
+ for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
+ {
+ .entity weaponentity = weaponentities[slot];
+ int w = player.(weaponentity).m_weapon.m_id;
+ if(w == 0)
+ w = player.(weaponentity).cnt; // previous weapon
+ if(w != 0 || slot == 0)
+ s = strcat(s, ftos(w));
+ }
if(time < player.strength_finished)
s = strcat(s, "S");
if(time < player.invincible_finished)