mirror of
https://github.com/yquake2/xatrix.git
synced 2025-02-23 20:31:40 +00:00
Faster weapon switching with 'cycleweap'
Allows to skip elements on the weapon list by tapping the same bound key
This commit is contained in:
parent
f4643f174f
commit
5e31017f49
1 changed files with 12 additions and 2 deletions
14
src/g_cmds.c
14
src/g_cmds.c
|
@ -1461,6 +1461,7 @@ cycle_weapon(edict_t *ent)
|
||||||
int i;
|
int i;
|
||||||
int start;
|
int start;
|
||||||
int num_weaps;
|
int num_weaps;
|
||||||
|
const char *weapname = NULL;
|
||||||
|
|
||||||
if (!ent)
|
if (!ent)
|
||||||
{
|
{
|
||||||
|
@ -1477,11 +1478,20 @@ cycle_weapon(edict_t *ent)
|
||||||
num_weaps = gi.argc();
|
num_weaps = gi.argc();
|
||||||
|
|
||||||
/* find where we want to start the search for the next eligible weapon */
|
/* find where we want to start the search for the next eligible weapon */
|
||||||
if (cl->pers.weapon)
|
if (cl->newweapon)
|
||||||
|
{
|
||||||
|
weapname = cl->newweapon->classname;
|
||||||
|
}
|
||||||
|
else if (cl->pers.weapon)
|
||||||
|
{
|
||||||
|
weapname = cl->pers.weapon->classname;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (weapname)
|
||||||
{
|
{
|
||||||
for (i = 1; i < num_weaps; i++)
|
for (i = 1; i < num_weaps; i++)
|
||||||
{
|
{
|
||||||
if (Q_stricmp(cl->pers.weapon->classname, gi.argv(i)) == 0)
|
if (Q_stricmp(weapname, gi.argv(i)) == 0)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue