]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - cl_tent.c
Borland C++ makefile for Darkplaces. Does NOT use asm objs yet, but works otherwise.
[xonotic/darkplaces.git] / cl_tent.c
index bbb48121066c68f142bf5d2de79843e4c151b6bc..d6d424757680cff6308836b318dc01037c1b2e70 100644 (file)
--- a/cl_tent.c
+++ b/cl_tent.c
@@ -99,10 +99,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_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
@@ -144,7 +160,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);
@@ -164,7 +180,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);
@@ -191,7 +207,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);
@@ -211,7 +227,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);
@@ -241,7 +257,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 ();
@@ -251,7 +273,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
@@ -317,7 +339,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;
 
@@ -325,7 +347,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;
@@ -338,7 +360,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);
                dl = CL_AllocDlight (0);
                VectorCopy (pos, dl->origin);
                dl->radius = 350;
@@ -352,7 +376,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);
                dl = CL_AllocDlight (0);
                VectorCopy (pos, dl->origin);
                dl->radius = 600;
@@ -367,6 +393,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);
@@ -382,7 +409,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);
                dl = CL_AllocDlight (0);
                VectorCopy (pos, dl->origin);
                dl->radius = 350;
@@ -396,7 +425,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);
                dl = CL_AllocDlight (0);
                VectorCopy (pos, dl->origin);
                dl->radius = 350;
@@ -410,8 +441,17 @@ 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);
 
+               S_StartSound (-1, 0, cl_sfx_r_exp3, pos, 1, 1);
+               dl = CL_AllocDlight (0);
+               VectorCopy (pos, dl->origin);
+               dl->radius = 600;
+               dl->die = cl.time + 0.5;
+               dl->decay = 1200;
+               dl->color[0] = 0.8;dl->color[1] = 0.4;dl->color[2] = 1.0;
                S_StartSound (-1, 0, cl_sfx_r_exp3, pos, 1, 1);
                break;
 
@@ -433,7 +473,7 @@ void CL_ParseTEnt (void)
                break;
 // PGM 01/21/97
 
-// LordHavoc: ONLY for compatibility with the Nehahra movie... hack hack hack
+// LordHavoc: for compatibility with the Nehahra movie...
        case TE_LIGHTNING4NEH:
                CL_ParseBeam (Mod_ForName(MSG_ReadString(), true));
                break;
@@ -456,21 +496,23 @@ 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);
                dl = CL_AllocDlight (0);
                VectorCopy (pos, dl->origin);
                dl->radius = 350;
                dl->die = cl.time + 0.5;
                dl->decay = 700;
-               tempcolor = (byte *)&d_8to24table[colorStart+(colorLength >> 1)];
-               dl->color[0] = tempcolor[0];dl->color[1] = tempcolor[1];dl->color[2] = tempcolor[2];
+               tempcolor = (byte *)&d_8to24table[(rand()%colorLength) + colorStart];
+               dl->color[0] = tempcolor[0] * (1.0f / 255.0f);dl->color[1] = tempcolor[1] * (1.0f / 255.0f);dl->color[2] = tempcolor[2] * (1.0f / 255.0f);
                S_StartSound (-1, 0, cl_sfx_r_exp3, pos, 1, 1);
                break;
                
        default:
-               Sys_Error ("CL_ParseTEnt: bad type");
+               Host_Error ("CL_ParseTEnt: bad type %d", type);
        }
 }
 
@@ -494,7 +536,7 @@ entity_t *CL_NewTempEntity (void)
        cl_visedicts[cl_numvisedicts] = ent;
        cl_numvisedicts++;
 
-       ent->colormap = vid.colormap;
+       ent->colormap = -1; // no special coloring
        ent->scale = 1;
        ent->alpha = 1;
        ent->colormod[0] = ent->colormod[1] = ent->colormod[2] = 1;
@@ -576,8 +618,7 @@ void CL_UpdateTEnts (void)
                        dl->die = cl.time + 0.001;
                        dl->color[0] = 1;dl->color[1] = 1;dl->color[2] = 1;
 
-                       for (i=0 ; i<3 ; i++)
-                               org[i] += dist[i]*30;
+                       VectorMA(org, 30, dist, org);
                        d -= 30;
                }
        }