Permalink
Browse files

cgame: don't allow scoped in cg.switchbackWeapon and instead use the …

…unscoped
  • Loading branch information...
Aranud committed Dec 5, 2017
1 parent f11345b commit 2c2a33882f30c7637badb21d383a78ef206a9e81
Showing with 20 additions and 2 deletions.
  1. +20 −2 src/cgame/cg_weapons.c
View
@@ -3779,6 +3779,10 @@ void CG_FinishWeaponChange(int lastweap, int newweap)
{
cg.switchbackWeapon = lastweap;
}
else
{
cg.switchbackWeapon = GetWeaponTableData(lastweap)->weapAlts;
}
}
else
{
@@ -3787,12 +3791,26 @@ void CG_FinishWeaponChange(int lastweap, int newweap)
// selected weapon will become the switchback
if (cg.switchbackWeapon == newweap)
{
cg.switchbackWeapon = lastweap;
if (!GetWeaponTableData(lastweap)->isScoped)
{
cg.switchbackWeapon = lastweap;
}
else
{
cg.switchbackWeapon = GetWeaponTableData(lastweap)->weapAlts;
}
}
// this fixes cg.switchbackWeapon=0 after very first spawn and switching weapon for the first time
else if (cg.switchbackWeapon == WP_NONE && CG_WeaponSelectable(lastweap)) // ensure last weapon is available
{
cg.switchbackWeapon = lastweap;
if (!GetWeaponTableData(lastweap)->isScoped)
{
cg.switchbackWeapon = lastweap;
}
else
{
cg.switchbackWeapon = GetWeaponTableData(lastweap)->weapAlts;
}
}
}

0 comments on commit 2c2a338

Please sign in to comment.