From 466225b89fdce48d972af81ac7d7bb6567417cdb Mon Sep 17 00:00:00 2001 From: Andrei Drexler Date: Mon, 19 Feb 2024 22:58:07 +0100 Subject: [PATCH] Show classname in edict entity fields (from Ironwail) --- Quake/pr_edict.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Quake/pr_edict.c b/Quake/pr_edict.c index f9d96b7d..9b1f0511 100644 --- a/Quake/pr_edict.c +++ b/Quake/pr_edict.c @@ -271,7 +271,7 @@ PR_DoubleFormat */ static const char *PR_DoubleFormat (double d) { - return abs (d - round (d)) < 0.05 ? "% 13.0f " : "% 15.1f"; + return abs (d - round (d)) < 0.05 ? "% 13.0lf " : "% 15.1lf"; } /* @@ -284,10 +284,12 @@ Returns a string describing *data in a type specific manner */ static const char *PR_ValueString (int type, eval_t *val) { - static char line[512]; - char fmt[64]; + static char line[512]; + char fmt[64]; + const char *str; ddef_t *def; - dfunction_t *f; + dfunction_t *f; + edict_t *ed; type &= ~DEF_SAVEGLOBAL; @@ -297,7 +299,9 @@ static const char *PR_ValueString (int type, eval_t *val) q_snprintf (line, sizeof (line), "%s", PR_GetString (val->string)); break; case ev_entity: - q_snprintf (line, sizeof (line), "entity %i", NUM_FOR_EDICT (PROG_TO_EDICT (val->edict))); + ed = PROG_TO_EDICT(val->edict); + str = PR_GetString(ed->v.classname); + q_snprintf (line, sizeof(line), *str ? "entity %i (%s)" : "entity %i", NUM_FOR_EDICT(ed), PR_GetString(ed->v.classname)); break; case ev_function: f = qcvm->functions + val->function;