From 487018e74a3d4099baf296b57a5a12f0eee00f32 Mon Sep 17 00:00:00 2001 From: cloudwalk Date: Fri, 24 Jul 2020 16:00:53 +0000 Subject: [PATCH] prvm_edict: Implement PRVM_ED_FindGlobalEval git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12873 d7cf8633-e32d-0410-b094-e92efae38249 --- progsvm.h | 1 + prvm_edict.c | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/progsvm.h b/progsvm.h index 06588fd4..82cb66c8 100644 --- a/progsvm.h +++ b/progsvm.h @@ -815,6 +815,7 @@ void PRVM_GarbageCollection(prvm_prog_t *prog); ddef_t *PRVM_ED_FindField(prvm_prog_t *prog, const char *name); ddef_t *PRVM_ED_FindGlobal(prvm_prog_t *prog, const char *name); +prvm_eval_t *PRVM_ED_FindGlobalEval(prvm_prog_t *prog, const char *name); mfunction_t *PRVM_ED_FindFunction(prvm_prog_t *prog, const char *name); int PRVM_ED_FindFieldOffset(prvm_prog_t *prog, const char *name); diff --git a/prvm_edict.c b/prvm_edict.c index 61649a25..3ca385a8 100644 --- a/prvm_edict.c +++ b/prvm_edict.c @@ -395,6 +395,16 @@ ddef_t *PRVM_ED_FindGlobal (prvm_prog_t *prog, const char *name) return NULL; } +/* +============ +PRVM_ED_FindGlobalEval +============ +*/ +prvm_eval_t *PRVM_ED_FindGlobalEval(prvm_prog_t *prog, const char *name) +{ + ddef_t *def = PRVM_ED_FindGlobal(prog, name); + return def ? (prvm_eval_t *) &prog->globals.fp[def->ofs] : NULL; +} /* ============ -- 2.39.2