mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-24 13:01:47 +00:00
- Improvements to some of the actor debug CCMDs.
- 'monster' and 'items' can now filter the list if an argument is passed (like with 'kill'); - added 'countitems', which will show only the 'count items' in the current map, with the same filter parameter as 'monster' and 'items'. - reorganize the code to reduce the duplication.
This commit is contained in:
parent
21314fe867
commit
66b090cd44
1 changed files with 56 additions and 22 deletions
|
@ -889,21 +889,42 @@ CCMD(info)
|
|||
"the NOBLOCKMAP flag or have height/radius of 0.\n");
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
CCMD(monster)
|
||||
{
|
||||
AActor * mo;
|
||||
typedef bool (*ActorTypeChecker) (AActor *);
|
||||
|
||||
if (CheckCheatmode ()) return;
|
||||
static bool IsActorAMonster(AActor *mo)
|
||||
{
|
||||
return mo->flags3&MF3_ISMONSTER && !(mo->flags&MF_CORPSE) && !(mo->flags&MF_FRIENDLY);
|
||||
}
|
||||
|
||||
static bool IsActorAnItem(AActor *mo)
|
||||
{
|
||||
return mo->IsKindOf(RUNTIME_CLASS(AInventory)) && mo->flags&MF_SPECIAL;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
AActor *mo;
|
||||
const PClass *FilterClass = NULL;
|
||||
|
||||
if (FilterName != NULL)
|
||||
{
|
||||
FilterClass = PClass::FindClass(FilterName);
|
||||
if (FilterClass == NULL || FilterClass->ActorInfo == NULL)
|
||||
{
|
||||
Printf("%s is not an actor class.\n", FilterName);
|
||||
return;
|
||||
}
|
||||
}
|
||||
TThinkerIterator<AActor> it;
|
||||
|
||||
while ( (mo = it.Next()) )
|
||||
{
|
||||
if (mo->flags3&MF3_ISMONSTER && !(mo->flags&MF_CORPSE) && !(mo->flags&MF_FRIENDLY))
|
||||
if ((FilterClass == NULL || mo->IsA(FilterClass)) && IsActorType(mo))
|
||||
{
|
||||
Printf ("%s at (%d,%d,%d)\n",
|
||||
mo->GetClass()->TypeName.GetChars(),
|
||||
|
@ -912,6 +933,18 @@ CCMD(monster)
|
|||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
CCMD(monster)
|
||||
{
|
||||
if (CheckCheatmode ()) return;
|
||||
|
||||
PrintFilteredActorList(IsActorAMonster, argv.argc() > 1 ? argv[1] : NULL);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
|
@ -919,20 +952,21 @@ CCMD(monster)
|
|||
//-----------------------------------------------------------------------------
|
||||
CCMD(items)
|
||||
{
|
||||
AActor * mo;
|
||||
|
||||
if (CheckCheatmode ()) return;
|
||||
TThinkerIterator<AActor> it;
|
||||
|
||||
while ( (mo = it.Next()) )
|
||||
{
|
||||
if (mo->IsKindOf(RUNTIME_CLASS(AInventory)) && mo->flags&MF_SPECIAL)
|
||||
{
|
||||
Printf ("%s at (%d,%d,%d)\n",
|
||||
mo->GetClass()->TypeName.GetChars(),
|
||||
mo->x >> FRACBITS, mo->y >> FRACBITS, mo->z >> FRACBITS);
|
||||
}
|
||||
}
|
||||
PrintFilteredActorList(IsActorAnItem, argv.argc() > 1 ? argv[1] : NULL);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
CCMD(countitems)
|
||||
{
|
||||
if (CheckCheatmode ()) return;
|
||||
|
||||
PrintFilteredActorList(IsActorACountItem, argv.argc() > 1 ? argv[1] : NULL);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
Loading…
Reference in a new issue