hud_fastswitch
command to match the behavior found in Half-Life Source.
slot1
thru slot5
) will cycle through its respective weapons rapidly, making response time in combat fast(er)!cl_dll/ammo.cpp
in the SDK and find the line:
bool fastSwitch = CVAR_GET_FLOAT( "hud_fastswitch" ) != 0;
Insert the code block right after:
if (fastSwitch)
{
// Switching between menus restarts count
if (gpLastSel && iSlot != gpLastSel->iSlot)
gpLastSel = NULL;
// No selection, start at top
if (!gpLastSel)
p = GetFirstPos( iSlot );
else
{
// Try next
p = GetNextActivePos( iSlot, gpLastSel->iSlotPos );
// End of list, start at top
if (!p)
p = GetFirstPos( iSlot );
}
// Found a weapon, store and switch
if (p)
{
PlaySound("wpn_select.wav", 1);
gpLastSel = p;
ServerCmd( p->szName );
g_weaponselect = p->iId;
}
return;
}
Following this added block, there is code that partially supports the swap. Remove these lines:
if ( p && fastSwitch ) // check for fast weapon switch mode
{
// if fast weapon switch is on, then weapons can be selected in a single keypress
// but only if there is only one item in the bucket
WEAPON *p2 = GetNextActivePos( p->iSlot, p->iSlotPos );
if ( !p2 )
{ // only one active item in bucket, so change directly to weapon
ServerCmd( p->szName );
g_weaponselect = p->iId;
return;
}
}
Then, change this line:
if ( !fastSwitch )
gpActiveSel = (WEAPON *)1;
else
gpActiveSel = NULL;
to:
gpActiveSel = (WEAPON *)1;
In summary, here is the entire pull request within our mod for reference.
hud_fastswitch 1
. Use sv_cheats 1
and impulse 101
for weapons, and then press binds for slot1
thru slot5
(typically, key 1 through 5). You'll see that it will quickly cycle through each set of weapons. Nice!
You must log in to post a comment. You can login or register a new account.