diff --git a/src/g_cmds.c b/src/g_cmds.c index bc2cfea..4d83197 100644 --- a/src/g_cmds.c +++ b/src/g_cmds.c @@ -759,14 +759,22 @@ Cmd_WeapPrev_f(edict_t *ent) cl = ent->client; - if (!cl->pers.weapon) + if (g_quick_weap->value && cl->newweapon) + { + it = cl->newweapon; + } + else if (cl->pers.weapon) + { + it = cl->pers.weapon; + } + else { return; } - selected_weapon = ITEM_INDEX(cl->pers.weapon); + selected_weapon = ITEM_INDEX(it); - /* scan for the next valid one */ + /* scan for the next valid one */ for (i = 1; i <= MAX_ITEMS; i++) { index = (selected_weapon + MAX_ITEMS - i) % MAX_ITEMS; @@ -778,12 +786,7 @@ Cmd_WeapPrev_f(edict_t *ent) it = &itemlist[index]; - if (!it->use) - { - continue; - } - - if (!(it->flags & IT_WEAPON)) + if (!it->use || !(it->flags & IT_WEAPON)) { continue; } @@ -812,14 +815,22 @@ Cmd_WeapNext_f(edict_t *ent) cl = ent->client; - if (!cl->pers.weapon) + if (g_quick_weap->value && cl->newweapon) + { + it = cl->newweapon; + } + else if (cl->pers.weapon) + { + it = cl->pers.weapon; + } + else { return; } - selected_weapon = ITEM_INDEX(cl->pers.weapon); + selected_weapon = ITEM_INDEX(it); - /* scan for the next valid one */ + /* scan for the next valid one */ for (i = 1; i <= MAX_ITEMS; i++) { index = (selected_weapon + i) % MAX_ITEMS; @@ -831,12 +842,7 @@ Cmd_WeapNext_f(edict_t *ent) it = &itemlist[index]; - if (!it->use) - { - continue; - } - - if (!(it->flags & IT_WEAPON)) + if (!it->use || !(it->flags & IT_WEAPON)) { continue; } diff --git a/src/g_main.c b/src/g_main.c index 3eaba6d..47890ff 100644 --- a/src/g_main.c +++ b/src/g_main.c @@ -68,6 +68,7 @@ cvar_t *gib_on; cvar_t *aimfix; cvar_t *g_machinegun_norecoil; +cvar_t *g_quick_weap; cvar_t *g_swap_speed; void SpawnEntities(char *mapname, char *entities, char *spawnpoint); diff --git a/src/header/local.h b/src/header/local.h index 034abcd..c046a76 100644 --- a/src/header/local.h +++ b/src/header/local.h @@ -542,6 +542,7 @@ extern cvar_t *sv_maplist; extern cvar_t *aimfix; extern cvar_t *g_machinegun_norecoil; +extern cvar_t *g_quick_weap; extern cvar_t *g_swap_speed; #define world (&g_edicts[0]) diff --git a/src/savegame/savegame.c b/src/savegame/savegame.c index 465a46b..2ff26b1 100644 --- a/src/savegame/savegame.c +++ b/src/savegame/savegame.c @@ -251,6 +251,7 @@ InitGame(void) /* others */ aimfix = gi.cvar("aimfix", "0", CVAR_ARCHIVE); g_machinegun_norecoil = gi.cvar("g_machinegun_norecoil", "0", CVAR_ARCHIVE); + g_quick_weap = gi.cvar("g_quick_weap", "0", CVAR_ARCHIVE); g_swap_speed = gi.cvar("g_swap_speed", "1", 0); /* items */