]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - cl_tent.c
added back r_speeds2, with masses of information (6 lines high), and made it print...
[xonotic/darkplaces.git] / cl_tent.c
index c633df63c81bd275af90a699e540e6b68d3e2d0d..e03e3aef9a1825c975ec7e4cd48a01740026d066 100644 (file)
--- a/cl_tent.c
+++ b/cl_tent.c
@@ -21,6 +21,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
 #include "quakedef.h"
 
+cvar_t r_glowinglightning = {"r_glowinglightning", "1", true};
+
 int                    num_temp_entities;
 entity_t       cl_temp_entities[MAX_TEMP_ENTITIES];
 beam_t         cl_beams[MAX_BEAMS];
@@ -40,6 +42,7 @@ CL_ParseTEnt
 */
 void CL_InitTEnts (void)
 {
+       Cvar_RegisterVariable(&r_glowinglightning);
        cl_sfx_wizhit = S_PrecacheSound ("wizard/hit.wav");
        cl_sfx_knighthit = S_PrecacheSound ("hknight/hit.wav");
        cl_sfx_tink1 = S_PrecacheSound ("weapons/tink1.wav");
@@ -99,11 +102,26 @@ void CL_ParseBeam (model_t *m)
        Con_Printf ("beam list overflow!\n");   
 }
 
-void R_BlastParticles(vec3_t org, vec_t radius, vec_t power);
+//void R_BlastParticles(vec3_t org, vec_t radius, vec_t power);
 void R_BloodShower (vec3_t mins, vec3_t maxs, float velspeed, int count);
 void R_ParticleCube (vec3_t mins, vec3_t maxs, vec3_t dir, int count, int colorbase, int gravity, int randomvel);
 void R_ParticleRain (vec3_t mins, vec3_t maxs, vec3_t dir, int count, int colorbase, int type);
 
+// attempts to find the nearest non-solid location, used for explosions mainly
+void FindNonSolidLocation(vec3_t pos)
+{
+       if (SV_HullPointContents (cl.worldmodel->hulls, 0, pos) != CONTENTS_SOLID) return;
+       pos[0]-=1;if (SV_HullPointContents (cl.worldmodel->hulls, 0, pos) != CONTENTS_SOLID) return;
+       pos[0]+=2;if (SV_HullPointContents (cl.worldmodel->hulls, 0, pos) != CONTENTS_SOLID) return;
+       pos[0]-=1;
+       pos[1]-=1;if (SV_HullPointContents (cl.worldmodel->hulls, 0, pos) != CONTENTS_SOLID) return;
+       pos[1]+=2;if (SV_HullPointContents (cl.worldmodel->hulls, 0, pos) != CONTENTS_SOLID) return;
+       pos[1]-=1;
+       pos[2]-=1;if (SV_HullPointContents (cl.worldmodel->hulls, 0, pos) != CONTENTS_SOLID) return;
+       pos[2]+=2;if (SV_HullPointContents (cl.worldmodel->hulls, 0, pos) != CONTENTS_SOLID) return;
+       pos[2]-=1;
+}
+
 /*
 =================
 CL_ParseTEnt
@@ -145,7 +163,7 @@ void CL_ParseTEnt (void)
                pos[1] = MSG_ReadCoord ();
                pos[2] = MSG_ReadCoord ();
                // LordHavoc: changed to spark shower
-               R_SparkShower(pos, vec3_origin, 15, 0);
+               R_SparkShower(pos, vec3_origin, 15);
                //R_RunParticleEffect (pos, vec3_origin, 0, 10);
                if ( rand() % 5 )
                        S_StartSound (-1, 0, cl_sfx_tink1, pos, 1, 1);
@@ -165,7 +183,7 @@ void CL_ParseTEnt (void)
                pos[1] = MSG_ReadCoord ();
                pos[2] = MSG_ReadCoord ();
                // LordHavoc: changed to spark shower
-               R_SparkShower(pos, vec3_origin, 15, 0);
+               R_SparkShower(pos, vec3_origin, 15);
                //R_RunParticleEffect (pos, vec3_origin, 0, 10);
                dl = CL_AllocDlight (0);
                VectorCopy (pos, dl->origin);
@@ -192,7 +210,7 @@ void CL_ParseTEnt (void)
                pos[1] = MSG_ReadCoord ();
                pos[2] = MSG_ReadCoord ();
                // LordHavoc: changed to dust shower
-               R_SparkShower(pos, vec3_origin, 30, 0);
+               R_SparkShower(pos, vec3_origin, 30);
                //R_RunParticleEffect (pos, vec3_origin, 0, 20);
                if ( rand() % 5 )
                        S_StartSound (-1, 0, cl_sfx_tink1, pos, 1, 1);
@@ -212,7 +230,7 @@ void CL_ParseTEnt (void)
                pos[1] = MSG_ReadCoord ();
                pos[2] = MSG_ReadCoord ();
                // LordHavoc: changed to dust shower
-               R_SparkShower(pos, vec3_origin, 30, 0);
+               R_SparkShower(pos, vec3_origin, 30);
                //R_RunParticleEffect (pos, vec3_origin, 0, 20);
                dl = CL_AllocDlight (0);
                VectorCopy (pos, dl->origin);
@@ -242,7 +260,13 @@ void CL_ParseTEnt (void)
                dir[1] = MSG_ReadChar ();
                dir[2] = MSG_ReadChar ();
                count = MSG_ReadByte (); // amount of particles
-               R_SparkShower(pos, dir, count, 1);
+               R_BloodPuff(pos);
+               break;
+       case TE_BLOOD2: // blood puff
+               pos[0] = MSG_ReadCoord ();
+               pos[1] = MSG_ReadCoord ();
+               pos[2] = MSG_ReadCoord ();
+               R_BloodPuff(pos);
                break;
        case TE_SPARK:  // spark shower
                pos[0] = MSG_ReadCoord ();
@@ -252,7 +276,7 @@ void CL_ParseTEnt (void)
                dir[1] = MSG_ReadChar ();
                dir[2] = MSG_ReadChar ();
                count = MSG_ReadByte (); // amount of particles
-               R_SparkShower(pos, dir, count, 0);
+               R_SparkShower(pos, dir, count);
                break;
                // LordHavoc: added for improved gore
        case TE_BLOODSHOWER:    // vaporized body
@@ -318,7 +342,7 @@ void CL_ParseTEnt (void)
                pos[1] = MSG_ReadCoord ();
                pos[2] = MSG_ReadCoord ();
                // LordHavoc: changed to dust shower
-               R_SparkShower(pos, vec3_origin, 15, 0);
+               R_SparkShower(pos, vec3_origin, 15);
                //R_RunParticleEffect (pos, vec3_origin, 0, 20);
                break;
 
@@ -326,7 +350,7 @@ void CL_ParseTEnt (void)
                pos[0] = MSG_ReadCoord ();
                pos[1] = MSG_ReadCoord ();
                pos[2] = MSG_ReadCoord ();
-               R_SparkShower(pos, vec3_origin, 15, 0);
+               R_SparkShower(pos, vec3_origin, 15);
                dl = CL_AllocDlight (0);
                VectorCopy (pos, dl->origin);
                dl->radius = 200;
@@ -339,8 +363,9 @@ void CL_ParseTEnt (void)
                pos[0] = MSG_ReadCoord ();
                pos[1] = MSG_ReadCoord ();
                pos[2] = MSG_ReadCoord ();
+               FindNonSolidLocation(pos);
                R_ParticleExplosion (pos, false);
-               R_BlastParticles (pos, 120, 120);
+//             R_BlastParticles (pos, 120, 120);
                dl = CL_AllocDlight (0);
                VectorCopy (pos, dl->origin);
                dl->radius = 350;
@@ -354,8 +379,9 @@ void CL_ParseTEnt (void)
                pos[0] = MSG_ReadCoord ();
                pos[1] = MSG_ReadCoord ();
                pos[2] = MSG_ReadCoord ();
+               FindNonSolidLocation(pos);
                R_ParticleExplosion (pos, false);
-               R_BlastParticles (pos, 120, 480);
+//             R_BlastParticles (pos, 120, 480);
                dl = CL_AllocDlight (0);
                VectorCopy (pos, dl->origin);
                dl->radius = 600;
@@ -370,6 +396,7 @@ void CL_ParseTEnt (void)
                pos[0] = MSG_ReadCoord ();
                pos[1] = MSG_ReadCoord ();
                pos[2] = MSG_ReadCoord ();
+               FindNonSolidLocation(pos);
                R_ParticleExplosion (pos, true);
                dl = CL_AllocDlight (0);
                VectorCopy (pos, dl->origin);
@@ -385,8 +412,9 @@ void CL_ParseTEnt (void)
                pos[0] = MSG_ReadCoord ();
                pos[1] = MSG_ReadCoord ();
                pos[2] = MSG_ReadCoord ();
+               FindNonSolidLocation(pos);
                R_ParticleExplosion (pos, false);
-               R_BlastParticles (pos, 120, 120);
+//             R_BlastParticles (pos, 120, 120);
                dl = CL_AllocDlight (0);
                VectorCopy (pos, dl->origin);
                dl->radius = 350;
@@ -400,8 +428,9 @@ void CL_ParseTEnt (void)
                pos[0] = MSG_ReadCoord ();
                pos[1] = MSG_ReadCoord ();
                pos[2] = MSG_ReadCoord ();
+               FindNonSolidLocation(pos);
                R_ParticleExplosion (pos, false);
-               R_BlastParticles (pos, 120, 120);
+//             R_BlastParticles (pos, 120, 120);
                dl = CL_AllocDlight (0);
                VectorCopy (pos, dl->origin);
                dl->radius = 350;
@@ -415,8 +444,9 @@ void CL_ParseTEnt (void)
                pos[0] = MSG_ReadCoord ();
                pos[1] = MSG_ReadCoord ();
                pos[2] = MSG_ReadCoord ();
+               FindNonSolidLocation(pos);
                R_BlobExplosion (pos);
-               R_BlastParticles (pos, 120, 120);
+//             R_BlastParticles (pos, 120, 120);
 
                S_StartSound (-1, 0, cl_sfx_r_exp3, pos, 1, 1);
                dl = CL_AllocDlight (0);
@@ -469,10 +499,11 @@ void CL_ParseTEnt (void)
                pos[0] = MSG_ReadCoord ();
                pos[1] = MSG_ReadCoord ();
                pos[2] = MSG_ReadCoord ();
+               FindNonSolidLocation(pos);
                colorStart = MSG_ReadByte ();
                colorLength = MSG_ReadByte ();
                R_ParticleExplosion2 (pos, colorStart, colorLength);
-               R_BlastParticles (pos, 80, 80);
+//             R_BlastParticles (pos, 80, 80);
                dl = CL_AllocDlight (0);
                VectorCopy (pos, dl->origin);
                dl->radius = 350;
@@ -508,8 +539,7 @@ entity_t *CL_NewTempEntity (void)
        cl_visedicts[cl_numvisedicts] = ent;
        cl_numvisedicts++;
 
-//     ent->colormap = vid.colormap;
-       ent->colormap = 0;
+       ent->colormap = -1; // no special coloring
        ent->scale = 1;
        ent->alpha = 1;
        ent->colormod[0] = ent->colormod[1] = ent->colormod[2] = 1;
@@ -585,11 +615,14 @@ void CL_UpdateTEnts (void)
                        ent->angles[1] = yaw;
                        ent->angles[2] = rand()%360;
 
-                       dl = CL_AllocDlight (0);
-                       VectorCopy (ent->origin,  dl->origin);
-                       dl->radius = 100 + (rand()&31);
-                       dl->die = cl.time + 0.001;
-                       dl->color[0] = 1;dl->color[1] = 1;dl->color[2] = 1;
+                       if (r_glowinglightning.value)
+                       {
+                               dl = CL_AllocDlight (0);
+                               VectorCopy (ent->origin,  dl->origin);
+                               dl->radius = 100 + (rand()&31);
+                               dl->die = cl.time + 0.001;
+                               dl->color[0] = 1;dl->color[1] = 1;dl->color[2] = 1;
+                       }
 
                        VectorMA(org, 30, dist, org);
                        d -= 30;