mirror of
https://github.com/ZDoom/gzdoom.git
synced 2025-01-19 16:11:23 +00:00
Added subclassing for use commands
Allows for finding subclasses when using the item commands that search the inventory. Can be either true/false or 0/1.
This commit is contained in:
parent
3bc54d3757
commit
d02f79d4be
1 changed files with 17 additions and 3 deletions
|
@ -476,11 +476,17 @@ CCMD(invquery)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
constexpr char True[] = "true";
|
||||||
|
|
||||||
CCMD (use)
|
CCMD (use)
|
||||||
{
|
{
|
||||||
if (argv.argc() > 1 && players[consoleplayer].mo != NULL)
|
if (argv.argc() > 1 && players[consoleplayer].mo != NULL)
|
||||||
{
|
{
|
||||||
SendItemUse = players[consoleplayer].mo->FindInventory(argv[1]);
|
bool subclass = false;
|
||||||
|
if (argv.argc() > 2)
|
||||||
|
subclass = !stricmp(argv[2], True) || atoi(argv[2]);
|
||||||
|
|
||||||
|
SendItemUse = players[consoleplayer].mo->FindInventory(argv[1], subclass);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -503,7 +509,11 @@ CCMD (drop)
|
||||||
{
|
{
|
||||||
if (argv.argc() > 1 && players[consoleplayer].mo != NULL)
|
if (argv.argc() > 1 && players[consoleplayer].mo != NULL)
|
||||||
{
|
{
|
||||||
SendItemDrop = players[consoleplayer].mo->FindInventory(argv[1]);
|
bool subclass = false;
|
||||||
|
if (argv.argc() > 3)
|
||||||
|
subclass = !stricmp(argv[3], True) || atoi(argv[3]);
|
||||||
|
|
||||||
|
SendItemDrop = players[consoleplayer].mo->FindInventory(argv[1], subclass);
|
||||||
SendItemDropAmount = argv.argc() > 2 ? atoi(argv[2]) : -1;
|
SendItemDropAmount = argv.argc() > 2 ? atoi(argv[2]) : -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -528,7 +538,11 @@ CCMD (select)
|
||||||
auto user = players[consoleplayer].mo;
|
auto user = players[consoleplayer].mo;
|
||||||
if (argv.argc() > 1)
|
if (argv.argc() > 1)
|
||||||
{
|
{
|
||||||
auto item = user->FindInventory(argv[1]);
|
bool subclass = false;
|
||||||
|
if (argv.argc() > 2)
|
||||||
|
subclass = !stricmp(argv[2], True) || atoi(argv[2]);
|
||||||
|
|
||||||
|
auto item = user->FindInventory(argv[1], subclass);
|
||||||
if (item != NULL)
|
if (item != NULL)
|
||||||
{
|
{
|
||||||
user->PointerVar<AActor>(NAME_InvSel) = item;
|
user->PointerVar<AActor>(NAME_InvSel) = item;
|
||||||
|
|
Loading…
Reference in a new issue