Allow poking entity fields in weird fun cheaty ways. Useful for debugging.

This commit is contained in:
Shpoike 2020-04-07 00:54:29 +01:00
parent 3650f85e8e
commit 0d8c45168f
1 changed files with 15 additions and 1 deletions

View File

@ -564,7 +564,21 @@ static void ED_PrintEdict_f (void)
if (i < 0 || i >= qcvm->num_edicts)
Con_Printf("Bad edict number\n");
else
ED_PrintNum (i);
{
if (Cmd_Argc() == 2 || svs.maxclients != 1) //edict N
ED_PrintNum (i);
else //edict N FLD ...
{
ddef_t *def = ED_FindField(Cmd_Argv(2));
if (!def)
Con_Printf("Field %s not defined\n", Cmd_Argv(2));
else if (Cmd_Argc() < 4)
Con_Printf("Edict %u.%s==%s\n", i, PR_GetString(def->s_name), PR_UglyValueString(def->type&~DEF_SAVEGLOBAL, (eval_t *)((char *)&EDICT_NUM(i)->v + def->ofs*4)));
else
ED_ParseEpair((void *)&EDICT_NUM(i)->v, def, Cmd_Argv(3));
}
}
PR_SwitchQCVM(NULL);
}