mirror of
https://github.com/yquake2/rogue.git
synced 2025-02-20 19:12:04 +00:00
Weapon preview for cycleweap
'Pickup style' just like weapprev/weapnext, only works when cycleweap is called with 3 or more parameters.
This commit is contained in:
parent
7cf6cad6ac
commit
61f1fdbbfd
1 changed files with 18 additions and 10 deletions
28
src/g_cmds.c
28
src/g_cmds.c
|
@ -1639,29 +1639,37 @@ void
|
||||||
Cmd_CycleWeap_f(edict_t *ent)
|
Cmd_CycleWeap_f(edict_t *ent)
|
||||||
{
|
{
|
||||||
gitem_t *weap;
|
gitem_t *weap;
|
||||||
|
gclient_t *cl;
|
||||||
|
int num_weaps;
|
||||||
|
|
||||||
if (!ent)
|
if (!ent)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gi.argc() <= 1)
|
num_weaps = gi.argc();
|
||||||
|
if (num_weaps <= 1)
|
||||||
{
|
{
|
||||||
gi.cprintf(ent, PRINT_HIGH, "Usage: cycleweap classname1 classname2 .. classnameN\n");
|
gi.cprintf(ent, PRINT_HIGH, "Usage: cycleweap classname1 classname2 .. classnameN\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
weap = cycle_weapon(ent);
|
weap = cycle_weapon(ent);
|
||||||
if (weap)
|
if (!weap) return;
|
||||||
|
|
||||||
|
cl = ent->client;
|
||||||
|
if (cl->pers.inventory[ITEM_INDEX(weap)] <= 0)
|
||||||
{
|
{
|
||||||
if (ent->client->pers.inventory[ITEM_INDEX(weap)] <= 0)
|
gi.cprintf(ent, PRINT_HIGH, "Out of item: %s\n", weap->pickup_name);
|
||||||
{
|
return;
|
||||||
gi.cprintf(ent, PRINT_HIGH, "Out of item: %s\n", weap->pickup_name);
|
}
|
||||||
}
|
|
||||||
else
|
weap->use(ent, weap);
|
||||||
{
|
if (num_weaps > 3 && cl->newweapon == weap)
|
||||||
weap->use(ent, weap);
|
{
|
||||||
}
|
cl->ps.stats[STAT_PICKUP_ICON] = gi.imageindex(weap->icon);
|
||||||
|
cl->ps.stats[STAT_PICKUP_STRING] = CS_ITEMS + ITEM_INDEX(weap);
|
||||||
|
cl->pickup_msg_time = level.time + 0.7f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue