1
0
Fork 0
forked from fte/fteqw

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
This commit is contained in:
Spoike 2018-03-05 11:35:58 +00:00
parent e221c6b5ca
commit aa18ab9c01
2 changed files with 30 additions and 6 deletions

View file

@ -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 *org = G_VECTOR(OFS_PARM0);
float radius = G_FLOAT(OFS_PARM1); float radius = G_FLOAT(OFS_PARM1);
@ -1272,7 +1272,7 @@ void QCBUILTIN PF_R_DynamicLight_Add(pubprogfuncs_t *prinst, struct globalvars_s
#ifdef RTLIGHTS #ifdef RTLIGHTS
// float *ambientdiffusespec = (prinst->callargc > 5)?{0,1,1}:G_VECTOR(OFS_PARM6); // 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 #endif
wedict_t *self; wedict_t *self;
@ -1287,8 +1287,22 @@ void QCBUILTIN PF_R_DynamicLight_Add(pubprogfuncs_t *prinst, struct globalvars_s
else else
dlkey = 0; dlkey = 0;
//if the org matches self, then attach it. if (isstatic)
dl = CL_NewDlight (dlkey, org, radius, -0.1, rgb[0], rgb[1], rgb[2]); {
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) 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; 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) static void QCBUILTIN PF_R_AddEntityMask(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{ {
int mask = G_FLOAT(OFS_PARM0); int mask = G_FLOAT(OFS_PARM0);
@ -6198,7 +6221,7 @@ static struct {
{"setproperty", PF_R_SetViewFlag, 303}, // #303 float(float property, ...) setproperty (EXT_CSQC) {"setproperty", PF_R_SetViewFlag, 303}, // #303 float(float property, ...) setproperty (EXT_CSQC)
{"renderscene", PF_R_RenderScene, 304}, // #304 void() renderscene (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_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_???) {"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}, // {"readsingleentitystate", PF_ReadSingleEntityState, 370},
{"deltalisten", PF_DeltaListen, 371}, // #371 float(string modelname, float flags) deltalisten (EXT_CSQC_1) {"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_get", PF_R_DynamicLight_Get, 372},
{"dynamiclight_set", PF_R_DynamicLight_Set, 373}, {"dynamiclight_set", PF_R_DynamicLight_Set, 373},
{"particleeffectquery", PF_cs_particleeffectquery, 374}, {"particleeffectquery", PF_cs_particleeffectquery, 374},

View file

@ -10556,7 +10556,7 @@ BuiltinList_t BuiltinList[] = { //nq qw h2 ebfs
// {"readsingleentitystate",PF_Fixme,0, 0, 0, 370}, // {"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) {"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_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.")}, {"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.")}, {"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.")},