From 3a0181d5cae98fbc78fe37facfe45a0de790bd87 Mon Sep 17 00:00:00 2001 From: TimeServ Date: Fri, 26 Aug 2005 21:59:36 +0000 Subject: [PATCH] exec permission demote fix to r_explosionlight few sound fixes to csqc standard effects (not done yet) git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@1246 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/client/cl_tent.c | 57 +++++++++++++++++++++------------------ engine/client/pr_csqc.c | 60 ++++++++++++++++++++++++++++++++++++++--- engine/common/cmd.c | 5 ++-- 3 files changed, 91 insertions(+), 31 deletions(-) diff --git a/engine/client/cl_tent.c b/engine/client/cl_tent.c index 5c4ab0b74..96f853c21 100644 --- a/engine/client/cl_tent.c +++ b/engine/client/cl_tent.c @@ -828,19 +828,20 @@ void CL_ParseTEnt (void) P_ParticleExplosion (pos); // light - dl = CL_AllocDlight (0); - VectorCopy (pos, dl->origin); - dl->radius = 350; - dl->die = cl.time + 1; - dl->decay = 300; - - dl->color[0] = 0.2; - dl->color[1] = 0.155; - dl->color[2] = 0.05; - dl->channelfade[0] = 0.196; - dl->channelfade[1] = 0.23; - dl->channelfade[2] = 0.12; - + if (r_explosionlight.value) { + dl = CL_AllocDlight (0); + VectorCopy (pos, dl->origin); + dl->radius = 150 + bound(0, r_explosionlight.value, 1)*200; + dl->die = cl.time + 1; + dl->decay = 300; + + dl->color[0] = 0.2; + dl->color[1] = 0.155; + dl->color[2] = 0.05; + dl->channelfade[0] = 0.196; + dl->channelfade[1] = 0.23; + dl->channelfade[2] = 0.12; + } // sound @@ -885,21 +886,25 @@ void CL_ParseTEnt (void) pos[0] = MSG_ReadCoord (); pos[1] = MSG_ReadCoord (); pos[2] = MSG_ReadCoord (); - P_ParticleExplosion (pos); + if (P_RunParticleEffectTypeString(pos, NULL, 1, "te_bigexplosion")) + P_ParticleExplosion (pos); // light - dl = CL_AllocDlight (0); - VectorCopy (pos, dl->origin); - dl->radius = 500; - dl->die = cl.time + 1; - dl->decay = 500; - - dl->color[0] = 0.4f; - dl->color[1] = 0.3f; - dl->color[2] = 0.15f; - dl->channelfade[0] = 0; - dl->channelfade[1] = 0; - dl->channelfade[2] = 0; + if (r_explosionlight.value) { + dl = CL_AllocDlight (0); + VectorCopy (pos, dl->origin); + // no point in doing this the fuh/ez way + dl->radius = 500*bound(0, r_explosionlight.value, 1); + dl->die = cl.time + 1; + dl->decay = 500; + + dl->color[0] = 0.4f; + dl->color[1] = 0.3f; + dl->color[2] = 0.15f; + dl->channelfade[0] = 0; + dl->channelfade[1] = 0; + dl->channelfade[2] = 0; + } S_StartSound (-2, 0, cl_sfx_r_exp3, pos, 1, 1); break; diff --git a/engine/client/pr_csqc.c b/engine/client/pr_csqc.c index ba9053301..a0f9d9e49 100644 --- a/engine/client/pr_csqc.c +++ b/engine/client/pr_csqc.c @@ -30,6 +30,16 @@ cvar_t cl_csqcdebug = {"cl_csqcdebug", "0"}; //prints entity numbers which arriv cvar_t cl_nocsqc = {"cl_nocsqc", "0"}; cvar_t pr_csqc_coreonerror = {"pr_csqc_coreonerror", "1"}; +// standard effect cvars/sounds +extern cvar_t r_explosionlight; +extern sfx_t *cl_sfx_wizhit; +extern sfx_t *cl_sfx_knighthit; +extern sfx_t *cl_sfx_tink1; +extern sfx_t *cl_sfx_ric1; +extern sfx_t *cl_sfx_ric2; +extern sfx_t *cl_sfx_ric3; +extern sfx_t *cl_sfx_r_exp3; + //If I do it like this, I'll never forget to register something... #define csqcglobals \ globalfunction(init_function, "CSQC_Init"); \ @@ -2204,24 +2214,51 @@ static void PF_cl_te_superspike (progfuncs_t *prinst, struct globalvars_s *pr_gl static void PF_cl_te_explosion (progfuncs_t *prinst, struct globalvars_s *pr_globals) { float *pos = G_VECTOR(OFS_PARM0); + + // light + if (r_explosionlight.value) { + dlight_t *dl; + + dl = CL_AllocDlight (0); + VectorCopy (pos, dl->origin); + dl->radius = 150 + bound(0, r_explosionlight.value, 1)*200; + dl->die = cl.time + 1; + dl->decay = 300; + + dl->color[0] = 0.2; + dl->color[1] = 0.155; + dl->color[2] = 0.05; + dl->channelfade[0] = 0.196; + dl->channelfade[1] = 0.23; + dl->channelfade[2] = 0.12; + } + P_ParticleExplosion(pos); + + S_StartSound (-2, 0, cl_sfx_r_exp3, pos, 1, 1); } static void PF_cl_te_tarexplosion (progfuncs_t *prinst, struct globalvars_s *pr_globals) { float *pos = G_VECTOR(OFS_PARM0); P_BlobExplosion (pos); + + S_StartSound (-2, 0, cl_sfx_r_exp3, pos, 1, 1); } static void PF_cl_te_wizspike (progfuncs_t *prinst, struct globalvars_s *pr_globals) { float *pos = G_VECTOR(OFS_PARM0); if (P_RunParticleEffectType(pos, NULL, 1, pt_wizspike)) P_RunParticleEffect (pos, vec3_origin, 20, 30); + + S_StartSound (-2, 0, cl_sfx_knighthit, pos, 1, 1); } static void PF_cl_te_knightspike (progfuncs_t *prinst, struct globalvars_s *pr_globals) { float *pos = G_VECTOR(OFS_PARM0); if (P_RunParticleEffectType(pos, NULL, 1, pt_knightspike)) P_RunParticleEffect (pos, vec3_origin, 226, 20); + + S_StartSound (-2, 0, cl_sfx_knighthit, pos, 1, 1); } static void PF_cl_te_lavasplash (progfuncs_t *prinst, struct globalvars_s *pr_globals) { @@ -2263,8 +2300,27 @@ static void PF_cl_te_explosionquad (progfuncs_t *prinst, struct globalvars_s *pr if (P_RunParticleEffectTypeString(pos, vec3_origin, 1, "te_explosionquad")) { P_ParticleExplosion(pos); - P_ParticleExplosion(pos); } + + // light + if (r_explosionlight.value) { + dlight_t *dl; + + dl = CL_AllocDlight (0); + VectorCopy (pos, dl->origin); + dl->radius = 150 + bound(0, r_explosionlight.value, 1)*200; + dl->die = cl.time + 1; + dl->decay = 300; + + dl->color[0] = 0.2; + dl->color[1] = 0.155; + dl->color[2] = 0.05; + dl->channelfade[0] = 0.196; + dl->channelfade[1] = 0.23; + dl->channelfade[2] = 0.12; + } + + S_StartSound (-2, 0, cl_sfx_r_exp3, pos, 1, 1); } //void(vector org, float radius, float lifetime, vector color) te_customflash @@ -2352,8 +2408,6 @@ static void PF_cl_te_explosionrgb (progfuncs_t *prinst, struct globalvars_s *pr_ float *colour = G_VECTOR(OFS_PARM1); dlight_t *dl; - extern cvar_t r_explosionlight; - extern sfx_t *cl_sfx_r_exp3; P_ParticleExplosion (org); diff --git a/engine/common/cmd.c b/engine/common/cmd.c index 29341ff76..782bedf56 100644 --- a/engine/common/cmd.c +++ b/engine/common/cmd.c @@ -502,8 +502,9 @@ void Cmd_Exec_f (void) if (cl_warncmd.value || developer.value) Con_TPrintf (TL_EXECING,name); - Cbuf_InsertText ("\n", Cmd_ExecLevel); //well this is inefficient... - Cbuf_InsertText (f, Cmd_ExecLevel); + // don't execute anything as if it was from server + Cbuf_InsertText ("\n", Cmd_FromGamecode() ? RESTRICT_INSECURE : Cmd_ExecLevel); + Cbuf_InsertText (f, Cmd_FromGamecode() ? RESTRICT_INSECURE : Cmd_ExecLevel); BZ_Free(f); }