mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-11 15:21:51 +00:00
Added the following ccmds:
actorlist, actornum, monsternum, itemsnum, countitemsnum Modified the following ccmds: monster, items, countitems All commands with "num" at the end simply print a count of their respective filters, all other listed commands now print a list and a count.
This commit is contained in:
parent
0d27996a64
commit
ac70f77e44
1 changed files with 57 additions and 6 deletions
|
@ -923,10 +923,18 @@ static bool IsActorACountItem(AActor *mo)
|
|||
return mo->IsKindOf(RUNTIME_CLASS(AInventory)) && mo->flags&MF_SPECIAL && mo->flags&MF_COUNTITEM;
|
||||
}
|
||||
|
||||
static void PrintFilteredActorList(const ActorTypeChecker IsActorType, const char *FilterName)
|
||||
// [SP] for all actors
|
||||
static bool IsActor(AActor *mo)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// [SP] modified - now allows showing count only, new arg must be passed. Also now still counts regardless, if lists are printed.
|
||||
static void PrintFilteredActorList(const ActorTypeChecker IsActorType, const char *FilterName, bool countOnly)
|
||||
{
|
||||
AActor *mo;
|
||||
const PClass *FilterClass = NULL;
|
||||
int counter = 0;
|
||||
|
||||
if (FilterName != NULL)
|
||||
{
|
||||
|
@ -943,10 +951,32 @@ static void PrintFilteredActorList(const ActorTypeChecker IsActorType, const cha
|
|||
{
|
||||
if ((FilterClass == NULL || mo->IsA(FilterClass)) && IsActorType(mo))
|
||||
{
|
||||
Printf ("%s at (%f,%f,%f)\n",
|
||||
mo->GetClass()->TypeName.GetChars(), mo->X(), mo->Y(), mo->Z());
|
||||
counter++;
|
||||
if (!countOnly)
|
||||
Printf ("%s at (%f,%f,%f)\n",
|
||||
mo->GetClass()->TypeName.GetChars(), mo->X(), mo->Y(), mo->Z());
|
||||
}
|
||||
}
|
||||
Printf("%i match(s) found.\n", counter);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
CCMD(actorlist) // [SP] print all actors (this can get quite big?)
|
||||
{
|
||||
if (CheckCheatmode ()) return;
|
||||
|
||||
PrintFilteredActorList(IsActor, argv.argc() > 1 ? argv[1] : NULL, false);
|
||||
}
|
||||
|
||||
CCMD(actornum) // [SP] count all actors
|
||||
{
|
||||
if (CheckCheatmode ()) return;
|
||||
|
||||
PrintFilteredActorList(IsActor, argv.argc() > 1 ? argv[1] : NULL, true);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -958,7 +988,14 @@ CCMD(monster)
|
|||
{
|
||||
if (CheckCheatmode ()) return;
|
||||
|
||||
PrintFilteredActorList(IsActorAMonster, argv.argc() > 1 ? argv[1] : NULL);
|
||||
PrintFilteredActorList(IsActorAMonster, argv.argc() > 1 ? argv[1] : NULL, false);
|
||||
}
|
||||
|
||||
CCMD(monsternum) // [SP] count monsters
|
||||
{
|
||||
if (CheckCheatmode ()) return;
|
||||
|
||||
PrintFilteredActorList(IsActorAMonster, argv.argc() > 1 ? argv[1] : NULL, true);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -970,7 +1007,14 @@ CCMD(items)
|
|||
{
|
||||
if (CheckCheatmode ()) return;
|
||||
|
||||
PrintFilteredActorList(IsActorAnItem, argv.argc() > 1 ? argv[1] : NULL);
|
||||
PrintFilteredActorList(IsActorAnItem, argv.argc() > 1 ? argv[1] : NULL, false);
|
||||
}
|
||||
|
||||
CCMD(itemsnum) // [SP] # of any items
|
||||
{
|
||||
if (CheckCheatmode ()) return;
|
||||
|
||||
PrintFilteredActorList(IsActorAnItem, argv.argc() > 1 ? argv[1] : NULL, true);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -982,7 +1026,14 @@ CCMD(countitems)
|
|||
{
|
||||
if (CheckCheatmode ()) return;
|
||||
|
||||
PrintFilteredActorList(IsActorACountItem, argv.argc() > 1 ? argv[1] : NULL);
|
||||
PrintFilteredActorList(IsActorACountItem, argv.argc() > 1 ? argv[1] : NULL, false);
|
||||
}
|
||||
|
||||
CCMD(countitemsnum) // [SP] # of counted items
|
||||
{
|
||||
if (CheckCheatmode ()) return;
|
||||
|
||||
PrintFilteredActorList(IsActorACountItem, argv.argc() > 1 ? argv[1] : NULL, true);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
Loading…
Reference in a new issue