void BG_BuildEntityDescription( char *str, size_t size, entityState_t *es ) { Q_snprintf(str, size, "%s #%i", Com_EntityTypeName( es->eType ), es->number ); str[ size -1 ] = '\0'; }
/* =================== Svcmd_EntityShow_f =================== */ void Svcmd_EntityShow_f() { int entityNum; int lastTargetIndex, targetIndex; gentity_t *selection; gentity_t *possibleTarget = nullptr; char argument[ 6 ]; if (trap_Argc() != 2) { G_Printf("usage: entityShow <entityId>\n"); return; } trap_Argv( 1, argument, sizeof( argument ) ); entityNum = atoi( argument ); if (entityNum >= level.num_entities || entityNum < MAX_CLIENTS) { G_Printf("entityId %d is out of range\n", entityNum); return; } selection = &g_entities[entityNum]; if (!selection->inuse) { G_Printf("entity slot %d is unused/free\n", entityNum); return; } G_Printf( "⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼\n" ); G_Printf( "^5#%3i^*: %16s", entityNum, Com_EntityTypeName( selection->s.eType ) ); if (IS_NON_NULL_VEC3(selection->s.origin)) { G_Printf("%26s", vtos( selection->s.origin ) ); } G_Printf( "\n⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼\n" ); G_Printf( "Classname: ^5%s^*\n", selection->classname ); G_Printf( "Capabilities:%s%s%s%s%s%s%s\n\n", selection->act ? " acts" : "", selection->think ? " thinks" : "", selection->pain ? " pains" : "", selection->die ? " dies" : "", selection->reset ? " resets" : "", selection->touch ? " touchable" : "", selection->use ? " usable" : ""); if (selection->names[0]) { G_Printf( "Names: "); G_PrintEntityNameList( selection ); } G_Printf("State: %s\n", selection->enabled ? "enabled" : "disabled"); if (selection->groupName) { G_Printf("Member of Group: %s%s\n", selection->groupName, !selection->groupMaster ? " [master]" : ""); } G_Printf( "\n"); if(selection->targetCount) { G_Printf( "Aims at\n"); while ((possibleTarget = G_IterateTargets(possibleTarget, &targetIndex, selection)) != nullptr ) { G_Printf(" • %s %s\n", etos( possibleTarget ), vtos( possibleTarget->s.origin)); } G_Printf( "\n"); } if(selection->callTargetCount) { lastTargetIndex = -1; while ((possibleTarget = G_IterateCallEndpoints(possibleTarget, &targetIndex, selection)) != nullptr ) { if(lastTargetIndex != targetIndex) { G_Printf("Calls %s \"%s:%s\"\n", selection->calltargets[ targetIndex ].event ? selection->calltargets[ targetIndex ].event : "onUnknown", selection->calltargets[ targetIndex ].name, selection->calltargets[ targetIndex ].action ? selection->calltargets[ targetIndex ].action : "default"); lastTargetIndex = targetIndex; } G_Printf(" • %s", etos(possibleTarget)); if(possibleTarget->names[1]) { G_Printf(" using \"%s\" ∈ ", selection->calltargets[ targetIndex ].name); G_PrintEntityNameList( possibleTarget ); } G_Printf("\n"); } } G_Printf( "\n" ); }
static inline void PrintEntityOverviewLine( gentity_t *entity ) { G_Printf( "%3i: %15s/^5%-24s^*%s%s\n", entity->s.number, Com_EntityTypeName( entity->s.eType ), entity->classname, entity->names[0] ? entity->names[0] : "", entity->names[1] ? " …" : ""); }
STATIC_INLINE void PrintEntityOverviewLine( gentity_t *entity ) { G_Printf( "%3i: %15s/" S_COLOR_CYAN "%-24s" S_COLOR_WHITE "%s%s\n", entity->s.number, Com_EntityTypeName( entity->s.eType ), entity->classname, entity->names[0] ? entity->names[0] : "", entity->names[1] ? " …" : ""); }