From 3f7c1a09ec02a66eb2c8f2e56c3333fcd8b86811 Mon Sep 17 00:00:00 2001 From: vortex Date: Sat, 24 Sep 2011 15:35:49 +0000 Subject: [PATCH] CSQC Getlight - added globals: vector getlight_dir; vector getlight_ambient; vector getlight_diffuse; git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11366 d7cf8633-e32d-0410-b094-e92efae38249 --- clvm_cmds.c | 8 +++++++- dpdefs/csprogsdefs.qc | 3 +++ prvm_offsets.h | 6 ++++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/clvm_cmds.c b/clvm_cmds.c index 0e3e515d..289d071c 100644 --- a/clvm_cmds.c +++ b/clvm_cmds.c @@ -681,7 +681,7 @@ static void VM_CL_getlight (void) vec3_t ambientcolor, diffusecolor, diffusenormal; vec_t *p; - VM_SAFEPARMCOUNTRANGE(1, 2, VM_CL_getlight); + VM_SAFEPARMCOUNTRANGE(1, 3, VM_CL_getlight); p = PRVM_G_VECTOR(OFS_PARM0); VectorClear(ambientcolor); @@ -692,6 +692,12 @@ static void VM_CL_getlight (void) else if (cl.worldmodel && cl.worldmodel->brush.LightPoint) cl.worldmodel->brush.LightPoint(cl.worldmodel, p, ambientcolor, diffusecolor, diffusenormal); VectorMA(ambientcolor, 0.5, diffusecolor, PRVM_G_VECTOR(OFS_RETURN)); + if (PRVM_clientglobalvector(getlight_ambient)) + VectorCopy(ambientcolor, PRVM_clientglobalvector(getlight_ambient)); + if (PRVM_clientglobalvector(getlight_diffuse)) + VectorCopy(diffusecolor, PRVM_clientglobalvector(getlight_diffuse)); + if (PRVM_clientglobalvector(getlight_dir)) + VectorCopy(diffusenormal, PRVM_clientglobalvector(getlight_dir)); } //============================================================================ diff --git a/dpdefs/csprogsdefs.qc b/dpdefs/csprogsdefs.qc index 1a08e588..bf284e05 100644 --- a/dpdefs/csprogsdefs.qc +++ b/dpdefs/csprogsdefs.qc @@ -399,6 +399,9 @@ void(vector v1, vector min, vector max, vector v2, float nomonsters, entity fore vector() randomvec = #91; vector(vector org) getlight = #92; vector(vector org, float lpflags) getlight2 = #92; +vector getlight_dir; +vector getlight_ambient; +vector getlight_diffuse; const float LP_LIGHTMAP = 1; const float LP_RTWORLD = 2; const float LP_DYNLIGHT = 4; diff --git a/prvm_offsets.h b/prvm_offsets.h index cfcf220a..3293081a 100644 --- a/prvm_offsets.h +++ b/prvm_offsets.h @@ -100,6 +100,9 @@ PRVM_DECLARE_clientglobalfloat(dmg_take) PRVM_DECLARE_clientglobalfloat(drawfont) PRVM_DECLARE_clientglobalfloat(frametime) PRVM_DECLARE_clientglobalfloat(gettaginfo_parent) +PRVM_DECLARE_clientglobalvector(getlight_ambient) +PRVM_DECLARE_clientglobalvector(getlight_diffuse) +PRVM_DECLARE_clientglobalvector(getlight_dir) PRVM_DECLARE_clientglobalfloat(input_buttons) PRVM_DECLARE_clientglobalfloat(input_timelength) PRVM_DECLARE_clientglobalfloat(intermission) @@ -438,6 +441,9 @@ PRVM_DECLARE_global(gettaginfo_offset) PRVM_DECLARE_global(gettaginfo_parent) PRVM_DECLARE_global(gettaginfo_right) PRVM_DECLARE_global(gettaginfo_up) +PRVM_DECLARE_global(getlight_ambient) +PRVM_DECLARE_global(getlight_diffuse) +PRVM_DECLARE_global(getlight_dir) PRVM_DECLARE_global(input_angles) PRVM_DECLARE_global(input_buttons) PRVM_DECLARE_global(input_movevalues) -- 2.39.2