From aa18ab9c01673416c540f1e5138e4902ab09c506 Mon Sep 17 00:00:00 2001 From: Spoike Date: Mon, 5 Mar 2018 11:35:58 +0000 Subject: [PATCH] finally got around to actually adding dynamiclight_spawnstatic git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5221 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/client/pr_csqc.c | 34 +++++++++++++++++++++++++++++----- engine/server/pr_cmds.c | 2 +- 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/engine/client/pr_csqc.c b/engine/client/pr_csqc.c index 72b36b8eb..3f8b98d5b 100644 --- a/engine/client/pr_csqc.c +++ b/engine/client/pr_csqc.c @@ -1261,7 +1261,7 @@ static void QCBUILTIN PF_R_DynamicLight_Get(pubprogfuncs_t *prinst, struct globa } } -void QCBUILTIN PF_R_DynamicLight_Add(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals) +static void PF_R_DynamicLight_AddInternal(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals, qboolean isstatic) { float *org = G_VECTOR(OFS_PARM0); float radius = G_FLOAT(OFS_PARM1); @@ -1272,7 +1272,7 @@ void QCBUILTIN PF_R_DynamicLight_Add(pubprogfuncs_t *prinst, struct globalvars_s #ifdef RTLIGHTS // float *ambientdiffusespec = (prinst->callargc > 5)?{0,1,1}:G_VECTOR(OFS_PARM6); -// fov, orientation, corona, coronascale, etc. gah +// fov, orientation, corona, coronascale, rotation, die, etc, just use dynamiclight_set #endif wedict_t *self; @@ -1287,8 +1287,22 @@ void QCBUILTIN PF_R_DynamicLight_Add(pubprogfuncs_t *prinst, struct globalvars_s else dlkey = 0; - //if the org matches self, then attach it. - dl = CL_NewDlight (dlkey, org, radius, -0.1, rgb[0], rgb[1], rgb[2]); + if (isstatic) + { + dl = CL_AllocSlight(); + dl->die = 0; + dl->flags = LFLAG_NORMALMODE|LFLAG_REALTIMEMODE; + } + else + { + dl = CL_AllocDlight(dlkey); + dl->die = cl.time + 0.1; + dl->flags = LFLAG_DYNAMIC; + } + + VectorCopy(org, dl->origin); + dl->radius = radius; + VectorCopy(rgb, dl->color); if (*dl->cubemapname) { @@ -1313,6 +1327,15 @@ void QCBUILTIN PF_R_DynamicLight_Add(pubprogfuncs_t *prinst, struct globalvars_s G_FLOAT(OFS_RETURN) = dl - cl_dlights; } +void QCBUILTIN PF_R_DynamicLight_AddStatic(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals) +{ + PF_R_DynamicLight_AddInternal(prinst, pr_globals, true); +} +void QCBUILTIN PF_R_DynamicLight_AddDynamic(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals) +{ + PF_R_DynamicLight_AddInternal(prinst, pr_globals, false); +} + static void QCBUILTIN PF_R_AddEntityMask(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals) { int mask = G_FLOAT(OFS_PARM0); @@ -6198,7 +6221,7 @@ static struct { {"setproperty", PF_R_SetViewFlag, 303}, // #303 float(float property, ...) setproperty (EXT_CSQC) {"renderscene", PF_R_RenderScene, 304}, // #304 void() renderscene (EXT_CSQC) - {"dynamiclight_add", PF_R_DynamicLight_Add, 305}, // #305 float(vector org, float radius, vector lightcolours) adddynamiclight (EXT_CSQC) + {"dynamiclight_add", PF_R_DynamicLight_AddDynamic, 305}, // #305 float(vector org, float radius, vector lightcolours) adddynamiclight (EXT_CSQC) {"R_BeginPolygon", PF_R_PolygonBegin, 306}, // #306 void(string texturename) R_BeginPolygon (EXT_CSQC_???) {"R_PolygonVertex", PF_R_PolygonVertex, 307}, // #307 void(vector org, vector texcoords, vector rgb, float alpha) R_PolygonVertex (EXT_CSQC_???) @@ -6306,6 +6329,7 @@ static struct { // {"readsingleentitystate", PF_ReadSingleEntityState, 370}, {"deltalisten", PF_DeltaListen, 371}, // #371 float(string modelname, float flags) deltalisten (EXT_CSQC_1) + {"dynamiclight_spawnstatic",PF_R_DynamicLight_AddStatic,0}, {"dynamiclight_get", PF_R_DynamicLight_Get, 372}, {"dynamiclight_set", PF_R_DynamicLight_Set, 373}, {"particleeffectquery", PF_cs_particleeffectquery, 374}, diff --git a/engine/server/pr_cmds.c b/engine/server/pr_cmds.c index e89b9bb27..eae7ad3cc 100644 --- a/engine/server/pr_cmds.c +++ b/engine/server/pr_cmds.c @@ -10556,7 +10556,7 @@ BuiltinList_t BuiltinList[] = { //nq qw h2 ebfs // {"readsingleentitystate",PF_Fixme,0, 0, 0, 370}, {"deltalisten", PF_Fixme, 0, 0, 0, 371, D("float(string modelname, float(float isnew) updatecallback, float flags)", "Specifies a per-modelindex callback to listen for engine-networking entity updates. Such entities are automatically interpolated by the engine (unless flags specifies not to).\nThe various standard entity fields will be overwritten each frame before the updatecallback function is called.")},// (EXT_CSQC_1) - {"dynamiclight_spawnstatic",PF_Fixme,0, 0, 0, 0, D("float(vector org, float radius, vector rgb)", "Retrieves a property from the given dynamic/rt light. Return type depends upon the light field requested.")}, + {"dynamiclight_spawnstatic",PF_Fixme,0, 0, 0, 0, D("float(vector org, float radius, vector rgb)", "Creates a static persistent light at the given position with the specified colour. Additional properties must be set via dynamiclight_set.")}, {"dynamiclight_get",PF_Fixme, 0, 0, 0, 372, D("__variant(float lno, float fld)", "Retrieves a property from the given dynamic/rt light. Return type depends upon the light field requested.")}, {"dynamiclight_set",PF_Fixme, 0, 0, 0, 373, D("void(float lno, float fld, __variant value)", "Changes a property on the given dynamic/rt light. Value type depends upon the light field to be changed.")}, {"particleeffectquery",PF_Fixme,0, 0, 0, 374, D("string(float efnum, float body)", "Retrieves either the name or the body of the effect with the given number. The effect body is regenerated from internal state, and can be changed before being reapplied via the localcmd builtin.")},