From dd2ce7ca1adfade0a96b9d5c84056cb44d2931a3 Mon Sep 17 00:00:00 2001 From: sago007 Date: Sat, 26 Nov 2016 21:14:39 +0100 Subject: [PATCH] No longer crashes on Linux 64 bit. I did not know why "cg_leiEnhancement 1" caused the game to crash. Before I started debugging I just ran through tr_particles.c and fixed a lot of warnings. This also fixed my problem. I think the critical part was: ``` -int reallyactive; +particle_t* reallyactive; ``` The diff makes it a bit hard but another change was: ``` else if (p->colortype = P_INDEXED) ``` to ``` else if (p->colortype == P_INDEXED) ``` and: ``` -vec3_t color; +vec4_t color; ``` --- code/renderer_oa/tr_particles.c | 2037 +++++++++++++++---------------- 1 file changed, 957 insertions(+), 1080 deletions(-) diff --git a/code/renderer_oa/tr_particles.c b/code/renderer_oa/tr_particles.c index 56ac46c8..f28871b1 100644 --- a/code/renderer_oa/tr_particles.c +++ b/code/renderer_oa/tr_particles.c @@ -76,20 +76,20 @@ typedef struct particle_s float alphavel; int type; shader_t *pshader; - + float height; float width; - + float endheight; float endwidth; - + float start; float end; float startfade; qboolean rotate; int snum; - + qboolean link; // Ridah @@ -99,7 +99,7 @@ typedef struct particle_s int accumroll; // leilei - float stretch; + float stretch; vec3_t angle; vec3_t avelocity; vec3_t src; @@ -134,7 +134,7 @@ static shader_t *addshock; static shader_t *subshock; static shader_t *modshock; static shader_t *alfshock; - + static shader_t *addball; static shader_t *subball; static shader_t *modball; @@ -189,7 +189,7 @@ typedef enum P_SPRITE, P_BEAM, // leilei - angle not calculated P_SPARK, // leilei - angle and length recalculated from velocity - P_QUAKESTATIC, + P_QUAKESTATIC, P_QUAKEGRAV, P_QUAKESLOWGRAV, P_QUAKEFIRE, @@ -197,7 +197,7 @@ typedef enum P_QUAKEEXPLODE2, P_QUAKEBLOB, P_QUAKEBLOB2, - P_QUAKE + P_QUAKE } particle_type_t; @@ -246,7 +246,7 @@ static imlazy_t cl; void CM_Trace( trace_t *results, const vec3_t start, const vec3_t end, vec3_t mins, vec3_t maxs, clipHandle_t model, const vec3_t origin, int brushmask, int capsule, sphere_t *sphere ); -static void P_Trace( trace_t *result, const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end, +static void P_Trace( trace_t *result, const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end, int skipNumber, int mask ) { CM_Trace(result, start, end, NULL, NULL, 0, start, mask, 0, NULL); @@ -296,14 +296,15 @@ void R_AddParticleToScene (particle_t *p, vec3_t org, float alpha) float height; float time, time2; float ratio; - int fogNum; + int fogNum = 0; float invratio; - vec3_t color; + vec4_t color; - time = 0; invratio = 0; // shut up gcc + time = 0; + invratio = 0; // shut up gcc VectorSet (color, p->cols[0][0], p->cols[1][0], p->cols[2][0]); - THEtime = backEnd.refdef.time; + THEtime = backEnd.refdef.time; // qarticle transitions cl.time = THEtime / 10; // quarticles @@ -322,482 +323,466 @@ void R_AddParticleToScene (particle_t *p, vec3_t org, float alpha) tess.numVertexes = 1; VectorCopy(org, tess.xyz[0]); tess.fogNum = p->fogNum; - + RB_CalcModulateColorsByFog(fogFactors); - + } } - {// create a front rotating facing polygon + { + // create a front rotating facing polygon // that can change colors // and........ something. vec3_t rr, ru; vec3_t rotate_ang; - if (p->colortype == P_LFX){ // Ramp + if (p->colortype == P_LFX) { + // Ramp - // hack to prevent that one long particle from going crazy in the world. - if (p->startfade > THEtime){ + // hack to prevent that one long particle from going crazy in the world. + if (p->startfade > THEtime){ + p->bounce = 0; p->bubbleit = 0; //no cpu expensive checks + return; + } - p->bounce = 0; p->bubbleit = 0; //no cpu expensive checks - return; + if (THEtime > p->startfade) { + float inv1,inv2,inv3,inv4; + invratio = 1 - ( (THEtime- p->startfade) / (p->endtime - p->startfade) ); - } - - - if (THEtime> p->startfade) - { - float inv1,inv2,inv3,inv4; - invratio = 1 - ( (THEtime- p->startfade) / (p->endtime - p->startfade) ); - - inv1 = invratio * 4.0; - inv2 = invratio * 4.0 - 1; - inv3 = invratio * 4.0 - 2; - inv4 = invratio * 4.0 - 3; - - if (inv1 > 1.0f) inv1 = 1.0f; - if (inv2 > 1.0f) inv2 = 1.0f; - if (inv3 > 1.0f) inv3 = 1.0f; - if (inv4 > 1.0f) inv4 = 1.0f; - - - { - int et; - vec4_t fcol; - - for(et=0;et<4;et++) - { - - - if (invratio < 0.25f) - fcol[et] = (p->cols[et][3] * inv1) + (p->cols[et][4] * (1 - inv1)); - else if (invratio < 0.50f) - fcol[et] = (p->cols[et][2] * inv2) + (p->cols[et][3] * (1 - inv2)); - else if (invratio < 0.75f) - fcol[et] = (p->cols[et][1] * inv3) + (p->cols[et][2] * (1 - inv3)); - else - fcol[et] = (p->cols[et][0] * inv4) + (p->cols[et][1] * (1 - inv4)); + inv1 = invratio * 4.0; + inv2 = invratio * 4.0 - 1; + inv3 = invratio * 4.0 - 2; + inv4 = invratio * 4.0 - 3; + if (inv1 > 1.0f) inv1 = 1.0f; + if (inv2 > 1.0f) inv2 = 1.0f; + if (inv3 > 1.0f) inv3 = 1.0f; + if (inv4 > 1.0f) inv4 = 1.0f; + { + int et; + vec4_t fcol; + for(et=0;et<4;et++) { + if (invratio < 0.25f) { + fcol[et] = (p->cols[et][3] * inv1) + (p->cols[et][4] * (1 - inv1)); + } + else if (invratio < 0.50f) { + fcol[et] = (p->cols[et][2] * inv2) + (p->cols[et][3] * (1 - inv2)); + } + else if (invratio < 0.75f) { + fcol[et] = (p->cols[et][1] * inv3) + (p->cols[et][2] * (1 - inv3)); + } + else { + fcol[et] = (p->cols[et][0] * inv4) + (p->cols[et][1] * (1 - inv4)); + } } - - - for(et=0;et<4;et++){ - if (fcol[et]>1)fcol[et]=1.0f; - if (fcol[et]<0)fcol[et]=0.0f; + for(et=0;et<4;et++){ + if (fcol[et]>1) { fcol[et]=1.0f; } + if (fcol[et]<0) { fcol[et]=0.0f; } } - - - - - color[0] = fcol[0]; - color[1] = fcol[1]; - color[2] = fcol[2]; - color[3] = fcol[3]; - + color[0] = fcol[0]; + color[1] = fcol[1]; + color[2] = fcol[2]; + color[3] = fcol[3]; + } } - - } - if (invratio > 4) - invratio = 4; + if (invratio > 4) { + invratio = 4; + } } - else if (p->colortype = P_INDEXED) - { + else if (p->colortype == P_INDEXED) { VectorSet(color, qpalette[p->qolor][0], qpalette[p->qolor][1], qpalette[p->qolor][2]); color[3] = 1.0f; } - else // simple - { - invratio = 1; - color[0] = p->cols[0][0]; - color[1] = p->cols[1][0]; - color[2] = p->cols[2][0]; - color[3] = p->alpha; + else { + // simple + invratio = 1; + color[0] = p->cols[0][0]; + color[1] = p->cols[1][0]; + color[2] = p->cols[2][0]; + color[3] = p->alpha; } - - if (p->rendertype == LFXSHOCK) - { // ORIENTED sprite - used for shockwaves, water waves, waves, etc. - vec3_t argles; - vec3_t right, up; - int ind=0; - vectoangles( p->dir, argles ); - AngleVectors ( argles, NULL, right, up); - width = p->width + ( ratio * ( p->endwidth - p->width) ); - height = p->height + ( ratio * ( p->endheight - p->height) ); - - if (p->roll) { - vectoangles( p->dir, rotate_ang ); - rotate_ang[ROLL] += p->roll; - AngleVectors ( rotate_ang, NULL, right, up); - } - - RB_BeginSurface( p->pshader, fogNum ); - VectorMA (org, -height, right, point); - VectorMA (point, -width, up, point); + if (p->rendertype == LFXSHOCK) { + // ORIENTED sprite - used for shockwaves, water waves, waves, etc. + vec3_t argles; + vec3_t right, up; + int ind=0; + vectoangles( p->dir, argles ); + AngleVectors ( argles, NULL, right, up); - + width = p->width + ( ratio * ( p->endwidth - p->width) ); + height = p->height + ( ratio * ( p->endheight - p->height) ); - VectorCopy (point, tess.xyz[tess.numVertexes] ); - tess.texCoords[tess.numVertexes][0][0] = 0; - tess.texCoords[tess.numVertexes][0][1] = 0; - tess.vertexColors[tess.numVertexes][0] = 255 * color[0]; - tess.vertexColors[tess.numVertexes][1] = 255 * color[1]; - tess.vertexColors[tess.numVertexes][2] = 255 * color[2]; - tess.vertexColors[tess.numVertexes][3] = 255 * invratio; - tess.numVertexes++; - - VectorMA( point, 2*height, up, point); - VectorCopy (point, tess.xyz[tess.numVertexes]); - tess.texCoords[tess.numVertexes][0][0] = 0; - tess.texCoords[tess.numVertexes][0][1] = 1; - tess.vertexColors[tess.numVertexes][0] = 255 * color[0]; - tess.vertexColors[tess.numVertexes][1] = 255 * color[1]; - tess.vertexColors[tess.numVertexes][2] = 255 * color[2]; - tess.vertexColors[tess.numVertexes][3] = 255 * invratio; - tess.numVertexes++; - - - VectorMA( point, 2*width, right, point ); - VectorCopy (point, tess.xyz[tess.numVertexes]); - tess.texCoords[tess.numVertexes][0][0] = 1; - tess.texCoords[tess.numVertexes][0][1] = 1; - tess.vertexColors[tess.numVertexes][0] = 255 * color[0]; - tess.vertexColors[tess.numVertexes][1] = 255 * color[1]; - tess.vertexColors[tess.numVertexes][2] = 255 * color[2]; - tess.vertexColors[tess.numVertexes][3] = 255 * invratio; - tess.numVertexes++; - - - VectorMA( point, -2*height, up, point ); - VectorCopy (point, tess.xyz[tess.numVertexes]); - tess.texCoords[tess.numVertexes][0][0] = 1; - tess.texCoords[tess.numVertexes][0][1] = 0; - tess.vertexColors[tess.numVertexes][0] = 255 * color[0]; - tess.vertexColors[tess.numVertexes][1] = 255 * color[1]; - tess.vertexColors[tess.numVertexes][2] = 255 * color[2]; - tess.vertexColors[tess.numVertexes][3] = 255 * invratio; - tess.numVertexes++; + if (p->roll) { + vectoangles( p->dir, rotate_ang ); + rotate_ang[ROLL] += p->roll; + AngleVectors ( rotate_ang, NULL, right, up); + } - tess.indexes[tess.numIndexes++] = 0; - tess.indexes[tess.numIndexes++] = 1; - tess.indexes[tess.numIndexes++] = 2; - tess.indexes[tess.numIndexes++] = 0; - tess.indexes[tess.numIndexes++] = 2; - tess.indexes[tess.numIndexes++] = 3; + RB_BeginSurface( p->pshader, fogNum ); + VectorMA (org, -height, right, point); + VectorMA (point, -width, up, point); - ind+=4; - RB_EndSurface(); + + + VectorCopy (point, tess.xyz[tess.numVertexes] ); + tess.texCoords[tess.numVertexes][0][0] = 0; + tess.texCoords[tess.numVertexes][0][1] = 0; + tess.vertexColors[tess.numVertexes][0] = 255 * color[0]; + tess.vertexColors[tess.numVertexes][1] = 255 * color[1]; + tess.vertexColors[tess.numVertexes][2] = 255 * color[2]; + tess.vertexColors[tess.numVertexes][3] = 255 * invratio; + tess.numVertexes++; + + VectorMA( point, 2*height, up, point); + VectorCopy (point, tess.xyz[tess.numVertexes]); + tess.texCoords[tess.numVertexes][0][0] = 0; + tess.texCoords[tess.numVertexes][0][1] = 1; + tess.vertexColors[tess.numVertexes][0] = 255 * color[0]; + tess.vertexColors[tess.numVertexes][1] = 255 * color[1]; + tess.vertexColors[tess.numVertexes][2] = 255 * color[2]; + tess.vertexColors[tess.numVertexes][3] = 255 * invratio; + tess.numVertexes++; + + + VectorMA( point, 2*width, right, point ); + VectorCopy (point, tess.xyz[tess.numVertexes]); + tess.texCoords[tess.numVertexes][0][0] = 1; + tess.texCoords[tess.numVertexes][0][1] = 1; + tess.vertexColors[tess.numVertexes][0] = 255 * color[0]; + tess.vertexColors[tess.numVertexes][1] = 255 * color[1]; + tess.vertexColors[tess.numVertexes][2] = 255 * color[2]; + tess.vertexColors[tess.numVertexes][3] = 255 * invratio; + tess.numVertexes++; + + + VectorMA( point, -2*height, up, point ); + VectorCopy (point, tess.xyz[tess.numVertexes]); + tess.texCoords[tess.numVertexes][0][0] = 1; + tess.texCoords[tess.numVertexes][0][1] = 0; + tess.vertexColors[tess.numVertexes][0] = 255 * color[0]; + tess.vertexColors[tess.numVertexes][1] = 255 * color[1]; + tess.vertexColors[tess.numVertexes][2] = 255 * color[2]; + tess.vertexColors[tess.numVertexes][3] = 255 * invratio; + tess.numVertexes++; + + tess.indexes[tess.numIndexes++] = 0; + tess.indexes[tess.numIndexes++] = 1; + tess.indexes[tess.numIndexes++] = 2; + tess.indexes[tess.numIndexes++] = 0; + tess.indexes[tess.numIndexes++] = 2; + tess.indexes[tess.numIndexes++] = 3; + + ind+=4; + RB_EndSurface(); } - else if (p->rendertype == LFXSPARK) - { // STRETCHY SPARK sprite - used for sparks etc - vec3_t argles; - vec3_t right, up, fwd; - vec3_t line; - float len, begin, end; - vec3_t start, finish; - int ind=0; - vec3_t oldorgstretch; - vectoangles( p->dir, argles ); - AngleVectors ( argles, NULL, right, up); + else if (p->rendertype == LFXSPARK) { + // STRETCHY SPARK sprite - used for sparks etc + vec3_t argles; + vec3_t right, up, fwd; + vec3_t line; + float len, begin, end; + vec3_t start, finish; + int ind=0; + vec3_t oldorgstretch; + vectoangles( p->dir, argles ); + AngleVectors ( argles, NULL, right, up); // Set up the 'beam' - - - oldorgstretch[0] = org[0] + ((p->vel[0] ) * 0.005); - oldorgstretch[1] = org[1] + ((p->vel[1]) * 0.005); - oldorgstretch[2] = org[2] + ((p->vel[2] ) * 0.005); - VectorSubtract( org, oldorgstretch, fwd ); + oldorgstretch[0] = org[0] + ((p->vel[0] ) * 0.005); + oldorgstretch[1] = org[1] + ((p->vel[1]) * 0.005); + oldorgstretch[2] = org[2] + ((p->vel[2] ) * 0.005); - len = VectorNormalize( fwd ); - //len = DotProduct(p->vel);// * (5 / (THEtime- oldTime)) ; - len *= p->height + p->width; - len *= 7; // doesn't look good in low framerates :/ - begin = -len / 2; - end = len / 2; - + VectorSubtract( org, oldorgstretch, fwd ); + + len = VectorNormalize( fwd ); + //len = DotProduct(p->vel);// * (5 / (THEtime- oldTime)) ; + len *= p->height + p->width; + + len *= 7; // doesn't look good in low framerates :/ + begin = -len / 2; + end = len / 2; + // Set up the particle - width = p->width + ( ratio * ( p->endwidth - p->width) ); - height = p->height + ( ratio * ( p->endheight - p->height) ); - - - VectorMA( org, begin, fwd, start ); - VectorMA( org, end, fwd, finish ); - - line[0] = DotProduct( fwd, backEnd.refdef.viewaxis[1] ); - line[1] = DotProduct( fwd, backEnd.refdef.viewaxis[2] ); - - VectorScale( backEnd.refdef.viewaxis[1], line[1], right ); - VectorMA( right, -line[0], backEnd.refdef.viewaxis[2], right ); - VectorNormalize( right ); - - RB_BeginSurface( p->pshader, fogNum ); - - VectorMA( finish, width, right, tess.xyz[tess.numVertexes] ); - tess.texCoords[tess.numVertexes][0][0] = 0; - tess.texCoords[tess.numVertexes][0][1] = 0; - tess.vertexColors[tess.numVertexes][0] = 255 * color[0]; - tess.vertexColors[tess.numVertexes][1] = 255 * color[1]; - tess.vertexColors[tess.numVertexes][2] = 255 * color[2]; - tess.vertexColors[tess.numVertexes][3] = 255 * invratio; - tess.numVertexes++; - - VectorMA( finish, -width, right, tess.xyz[tess.numVertexes] ); - tess.texCoords[tess.numVertexes][0][0] = 0; - tess.texCoords[tess.numVertexes][0][1] = 1; - tess.vertexColors[tess.numVertexes][0] = 255 * color[0]; - tess.vertexColors[tess.numVertexes][1] = 255 * color[1]; - tess.vertexColors[tess.numVertexes][2] = 255 * color[2]; - tess.vertexColors[tess.numVertexes][3] = 255 * invratio; - tess.numVertexes++; - - - VectorMA( start, -width, right, tess.xyz[tess.numVertexes] ); - tess.texCoords[tess.numVertexes][0][0] = 1; - tess.texCoords[tess.numVertexes][0][1] = 1; - tess.vertexColors[tess.numVertexes][0] = 255 * color[0]; - tess.vertexColors[tess.numVertexes][1] = 255 * color[1]; - tess.vertexColors[tess.numVertexes][2] = 255 * color[2]; - tess.vertexColors[tess.numVertexes][3] = 255 * invratio; - tess.numVertexes++; - - - VectorMA( start, width, right, tess.xyz[tess.numVertexes] ); - tess.texCoords[tess.numVertexes][0][0] = 1; - tess.texCoords[tess.numVertexes][0][1] = 0; - tess.vertexColors[tess.numVertexes][0] = 255 * color[0]; - tess.vertexColors[tess.numVertexes][1] = 255 * color[1]; - tess.vertexColors[tess.numVertexes][2] = 255 * color[2]; - tess.vertexColors[tess.numVertexes][3] = 255 * invratio; - tess.numVertexes++; - - tess.indexes[tess.numIndexes++] = 0; - tess.indexes[tess.numIndexes++] = 1; - tess.indexes[tess.numIndexes++] = 2; - tess.indexes[tess.numIndexes++] = 0; - tess.indexes[tess.numIndexes++] = 2; - tess.indexes[tess.numIndexes++] = 3; - - ind+=4; - RB_EndSurface(); + width = p->width + ( ratio * ( p->endwidth - p->width) ); + height = p->height + ( ratio * ( p->endheight - p->height) ); - // center glow of softness? Enable for 2002 particleset? + VectorMA( org, begin, fwd, start ); + VectorMA( org, end, fwd, finish ); + + line[0] = DotProduct( fwd, backEnd.refdef.viewaxis[1] ); + line[1] = DotProduct( fwd, backEnd.refdef.viewaxis[2] ); + + VectorScale( backEnd.refdef.viewaxis[1], line[1], right ); + VectorMA( right, -line[0], backEnd.refdef.viewaxis[2], right ); + VectorNormalize( right ); + + RB_BeginSurface( p->pshader, fogNum ); + + VectorMA( finish, width, right, tess.xyz[tess.numVertexes] ); + tess.texCoords[tess.numVertexes][0][0] = 0; + tess.texCoords[tess.numVertexes][0][1] = 0; + tess.vertexColors[tess.numVertexes][0] = 255 * color[0]; + tess.vertexColors[tess.numVertexes][1] = 255 * color[1]; + tess.vertexColors[tess.numVertexes][2] = 255 * color[2]; + tess.vertexColors[tess.numVertexes][3] = 255 * invratio; + tess.numVertexes++; + + VectorMA( finish, -width, right, tess.xyz[tess.numVertexes] ); + tess.texCoords[tess.numVertexes][0][0] = 0; + tess.texCoords[tess.numVertexes][0][1] = 1; + tess.vertexColors[tess.numVertexes][0] = 255 * color[0]; + tess.vertexColors[tess.numVertexes][1] = 255 * color[1]; + tess.vertexColors[tess.numVertexes][2] = 255 * color[2]; + tess.vertexColors[tess.numVertexes][3] = 255 * invratio; + tess.numVertexes++; + + + VectorMA( start, -width, right, tess.xyz[tess.numVertexes] ); + tess.texCoords[tess.numVertexes][0][0] = 1; + tess.texCoords[tess.numVertexes][0][1] = 1; + tess.vertexColors[tess.numVertexes][0] = 255 * color[0]; + tess.vertexColors[tess.numVertexes][1] = 255 * color[1]; + tess.vertexColors[tess.numVertexes][2] = 255 * color[2]; + tess.vertexColors[tess.numVertexes][3] = 255 * invratio; + tess.numVertexes++; + + + VectorMA( start, width, right, tess.xyz[tess.numVertexes] ); + tess.texCoords[tess.numVertexes][0][0] = 1; + tess.texCoords[tess.numVertexes][0][1] = 0; + tess.vertexColors[tess.numVertexes][0] = 255 * color[0]; + tess.vertexColors[tess.numVertexes][1] = 255 * color[1]; + tess.vertexColors[tess.numVertexes][2] = 255 * color[2]; + tess.vertexColors[tess.numVertexes][3] = 255 * invratio; + tess.numVertexes++; + + tess.indexes[tess.numIndexes++] = 0; + tess.indexes[tess.numIndexes++] = 1; + tess.indexes[tess.numIndexes++] = 2; + tess.indexes[tess.numIndexes++] = 0; + tess.indexes[tess.numIndexes++] = 2; + tess.indexes[tess.numIndexes++] = 3; + + ind+=4; + RB_EndSurface(); + + + // center glow of softness? Enable for 2002 particleset? } - else if (p->rendertype == LFXBURST) - { // STRETCHY BURST sprite - used for explosions + else if (p->rendertype == LFXBURST) { + // STRETCHY BURST sprite - used for explosions // like spark but origin doesnt change. it just keeps stretching // from where it was spawned. - vec3_t argles; - vec3_t right, up, fwd; - vec3_t line; - float len, begin, end; - vec3_t start, finish; - int ind=0; - vec3_t oldorgstretch; - vectoangles( p->dir, argles ); - AngleVectors ( argles, NULL, right, up); + vec3_t argles; + vec3_t right, up, fwd; + vec3_t line; + float len, begin, end; + vec3_t start, finish; + int ind=0; + vec3_t oldorgstretch; + vectoangles( p->dir, argles ); + AngleVectors ( argles, NULL, right, up); // Set up the 'beam' - - - oldorgstretch[0] = p->torg[0][0]; - oldorgstretch[1] = p->torg[0][1]; - oldorgstretch[2] = p->torg[0][2]; - VectorSubtract( org, oldorgstretch, fwd ); + oldorgstretch[0] = p->torg[0][0]; + oldorgstretch[1] = p->torg[0][1]; + oldorgstretch[2] = p->torg[0][2]; - len = VectorNormalize( fwd ); - //len = DotProduct(p->vel);// * (5 / (THEtime- oldTime)) ; - len *= p->height + p->width; - len *= 1; // doesn't look good in low framerates :/ - begin = 0; - end = len; - + VectorSubtract( org, oldorgstretch, fwd ); + + len = VectorNormalize( fwd ); + //len = DotProduct(p->vel);// * (5 / (THEtime- oldTime)) ; + len *= p->height + p->width; + + len *= 1; // doesn't look good in low framerates :/ + begin = 0; + end = len; + // Set up the particle - width = p->width + ( ratio * ( p->endwidth - p->width) ); - height = p->height + ( ratio * ( p->endheight - p->height) ); - + width = p->width + ( ratio * ( p->endwidth - p->width) ); + height = p->height + ( ratio * ( p->endheight - p->height) ); - VectorMA( org, begin, fwd, start ); - VectorMA( org, end, fwd, finish ); - line[0] = DotProduct( fwd, backEnd.refdef.viewaxis[1] ); - line[1] = DotProduct( fwd, backEnd.refdef.viewaxis[2] ); + VectorMA( org, begin, fwd, start ); + VectorMA( org, end, fwd, finish ); - VectorScale( backEnd.refdef.viewaxis[1], line[1], right ); - VectorMA( right, -line[0], backEnd.refdef.viewaxis[2], right ); - VectorNormalize( right ); + line[0] = DotProduct( fwd, backEnd.refdef.viewaxis[1] ); + line[1] = DotProduct( fwd, backEnd.refdef.viewaxis[2] ); - RB_BeginSurface( p->pshader, fogNum ); + VectorScale( backEnd.refdef.viewaxis[1], line[1], right ); + VectorMA( right, -line[0], backEnd.refdef.viewaxis[2], right ); + VectorNormalize( right ); - VectorMA( finish, width, right, tess.xyz[tess.numVertexes] ); - tess.texCoords[tess.numVertexes][0][0] = 0; - tess.texCoords[tess.numVertexes][0][1] = 0; - tess.vertexColors[tess.numVertexes][0] = 255 * color[0]; - tess.vertexColors[tess.numVertexes][1] = 255 * color[1]; - tess.vertexColors[tess.numVertexes][2] = 255 * color[2]; - tess.vertexColors[tess.numVertexes][3] = 255 * invratio; - tess.numVertexes++; - - VectorMA( finish, -width, right, tess.xyz[tess.numVertexes] ); - tess.texCoords[tess.numVertexes][0][0] = 0; - tess.texCoords[tess.numVertexes][0][1] = 1; - tess.vertexColors[tess.numVertexes][0] = 255 * color[0]; - tess.vertexColors[tess.numVertexes][1] = 255 * color[1]; - tess.vertexColors[tess.numVertexes][2] = 255 * color[2]; - tess.vertexColors[tess.numVertexes][3] = 255 * invratio; - tess.numVertexes++; - - - VectorMA( start, -width, right, tess.xyz[tess.numVertexes] ); - tess.texCoords[tess.numVertexes][0][0] = 1; - tess.texCoords[tess.numVertexes][0][1] = 1; - tess.vertexColors[tess.numVertexes][0] = 255 * color[0]; - tess.vertexColors[tess.numVertexes][1] = 255 * color[1]; - tess.vertexColors[tess.numVertexes][2] = 255 * color[2]; - tess.vertexColors[tess.numVertexes][3] = 255 * invratio; - tess.numVertexes++; - - - VectorMA( start, width, right, tess.xyz[tess.numVertexes] ); - tess.texCoords[tess.numVertexes][0][0] = 1; - tess.texCoords[tess.numVertexes][0][1] = 0; - tess.vertexColors[tess.numVertexes][0] = 255 * color[0]; - tess.vertexColors[tess.numVertexes][1] = 255 * color[1]; - tess.vertexColors[tess.numVertexes][2] = 255 * color[2]; - tess.vertexColors[tess.numVertexes][3] = 255 * invratio; - tess.numVertexes++; + RB_BeginSurface( p->pshader, fogNum ); - tess.indexes[tess.numIndexes++] = 0; - tess.indexes[tess.numIndexes++] = 1; - tess.indexes[tess.numIndexes++] = 2; - tess.indexes[tess.numIndexes++] = 0; - tess.indexes[tess.numIndexes++] = 2; - tess.indexes[tess.numIndexes++] = 3; + VectorMA( finish, width, right, tess.xyz[tess.numVertexes] ); + tess.texCoords[tess.numVertexes][0][0] = 0; + tess.texCoords[tess.numVertexes][0][1] = 0; + tess.vertexColors[tess.numVertexes][0] = 255 * color[0]; + tess.vertexColors[tess.numVertexes][1] = 255 * color[1]; + tess.vertexColors[tess.numVertexes][2] = 255 * color[2]; + tess.vertexColors[tess.numVertexes][3] = 255 * invratio; + tess.numVertexes++; - ind+=4; - RB_EndSurface(); + VectorMA( finish, -width, right, tess.xyz[tess.numVertexes] ); + tess.texCoords[tess.numVertexes][0][0] = 0; + tess.texCoords[tess.numVertexes][0][1] = 1; + tess.vertexColors[tess.numVertexes][0] = 255 * color[0]; + tess.vertexColors[tess.numVertexes][1] = 255 * color[1]; + tess.vertexColors[tess.numVertexes][2] = 255 * color[2]; + tess.vertexColors[tess.numVertexes][3] = 255 * invratio; + tess.numVertexes++; + + + VectorMA( start, -width, right, tess.xyz[tess.numVertexes] ); + tess.texCoords[tess.numVertexes][0][0] = 1; + tess.texCoords[tess.numVertexes][0][1] = 1; + tess.vertexColors[tess.numVertexes][0] = 255 * color[0]; + tess.vertexColors[tess.numVertexes][1] = 255 * color[1]; + tess.vertexColors[tess.numVertexes][2] = 255 * color[2]; + tess.vertexColors[tess.numVertexes][3] = 255 * invratio; + tess.numVertexes++; + + + VectorMA( start, width, right, tess.xyz[tess.numVertexes] ); + tess.texCoords[tess.numVertexes][0][0] = 1; + tess.texCoords[tess.numVertexes][0][1] = 0; + tess.vertexColors[tess.numVertexes][0] = 255 * color[0]; + tess.vertexColors[tess.numVertexes][1] = 255 * color[1]; + tess.vertexColors[tess.numVertexes][2] = 255 * color[2]; + tess.vertexColors[tess.numVertexes][3] = 255 * invratio; + tess.numVertexes++; + + tess.indexes[tess.numIndexes++] = 0; + tess.indexes[tess.numIndexes++] = 1; + tess.indexes[tess.numIndexes++] = 2; + tess.indexes[tess.numIndexes++] = 0; + tess.indexes[tess.numIndexes++] = 2; + tess.indexes[tess.numIndexes++] = 3; + + ind+=4; + RB_EndSurface(); } - - else if (p->rendertype == LFXTRAIL) - { // STRETCHY TRAIL sprite - used for..... i dunno + else if (p->rendertype == LFXTRAIL) { + // STRETCHY TRAIL sprite - used for..... i dunno // like burst but splits into more trails when the certain length is achieved // TO RETURN } + else { + // VP PARALLEL sprite + // trace_t pt1, pt2, pt3, pt4; + // float avgfrac; + int ind=0; + width = p->width + ( ratio * ( p->endwidth - p->width) ); + height = p->height + ( ratio * ( p->endheight - p->height) ); - else - // VP PARALLEL sprite - { - // trace_t pt1, pt2, pt3, pt4; - // float avgfrac; - int ind=0; - width = p->width + ( ratio * ( p->endwidth - p->width) ); - height = p->height + ( ratio * ( p->endheight - p->height) ); - - if (p->roll) { - vectoangles( backEnd.refdef.viewaxis[0], rotate_ang ); - rotate_ang[ROLL] += p->roll; - AngleVectors ( rotate_ang, NULL, rr, ru); - } - - if (p->roll) { - VectorMA (org, -height, ru, point); - VectorMA (point, -width, rr, point); - } else { - VectorMA (org, -height, pvup, point); - VectorMA (point, -width, pvright, point); - } - - // Faded clipping test. we don't need dx10 after all :) + if (p->roll) { + vectoangles( backEnd.refdef.viewaxis[0], rotate_ang ); + rotate_ang[ROLL] += p->roll; + AngleVectors ( rotate_ang, NULL, rr, ru); + } - - RB_BeginSurface( p->pshader, fogNum ); + if (p->roll) { + VectorMA (org, -height, ru, point); + VectorMA (point, -width, rr, point); + } else { + VectorMA (org, -height, pvup, point); + VectorMA (point, -width, pvright, point); + } - VectorCopy (point, tess.xyz[tess.numVertexes] ); - tess.texCoords[tess.numVertexes][0][0] = 0; - tess.texCoords[tess.numVertexes][0][1] = 0; - tess.vertexColors[tess.numVertexes][0] = 255 * color[0]; - tess.vertexColors[tess.numVertexes][1] = 255 * color[1]; - tess.vertexColors[tess.numVertexes][2] = 255 * color[2]; - tess.vertexColors[tess.numVertexes][3] = 255 * invratio; - tess.numVertexes++; - - if (p->roll) { - VectorMA (point, 2*height, ru, point); - } else { - VectorMA (point, 2*height, pvup, point); - } - VectorCopy (point, tess.xyz[tess.numVertexes] ); - tess.texCoords[tess.numVertexes][0][0] = 0; - tess.texCoords[tess.numVertexes][0][1] = 1; - tess.vertexColors[tess.numVertexes][0] = 255 * color[0]; - tess.vertexColors[tess.numVertexes][1] = 255 * color[1]; - tess.vertexColors[tess.numVertexes][2] = 255 * color[2]; - tess.vertexColors[tess.numVertexes][3] = 255 * invratio; - tess.numVertexes++; - - if (p->roll) { - VectorMA (point, 2*width, rr, point); - } else { - VectorMA (point, 2*width, pvright, point); - } - VectorCopy (point, tess.xyz[tess.numVertexes] ); - tess.texCoords[tess.numVertexes][0][0] = 1; - tess.texCoords[tess.numVertexes][0][1] = 1; - tess.vertexColors[tess.numVertexes][0] = 255 * color[0]; - tess.vertexColors[tess.numVertexes][1] = 255 * color[1]; - tess.vertexColors[tess.numVertexes][2] = 255 * color[2]; - tess.vertexColors[tess.numVertexes][3] = 255 * invratio; - tess.numVertexes++; - - if (p->roll) { - VectorMA (point, -2*height, ru, point); - } else { - VectorMA (point, -2*height, pvup, point); - } - VectorCopy (point, tess.xyz[tess.numVertexes] ); - tess.texCoords[tess.numVertexes][0][0] = 1; - tess.texCoords[tess.numVertexes][0][1] = 0; - tess.vertexColors[tess.numVertexes][0] = 255 * color[0]; - tess.vertexColors[tess.numVertexes][1] = 255 * color[1]; - tess.vertexColors[tess.numVertexes][2] = 255 * color[2]; - tess.vertexColors[tess.numVertexes][3] = 255 * invratio; - tess.numVertexes++; + // Faded clipping test. we don't need dx10 after all :) - tess.indexes[tess.numIndexes++] = 0; - tess.indexes[tess.numIndexes++] = 1; - tess.indexes[tess.numIndexes++] = 2; - tess.indexes[tess.numIndexes++] = 0; - tess.indexes[tess.numIndexes++] = 2; - tess.indexes[tess.numIndexes++] = 3; - ind+=4; - RB_EndSurface(); + RB_BeginSurface( p->pshader, fogNum ); - } + VectorCopy (point, tess.xyz[tess.numVertexes] ); + tess.texCoords[tess.numVertexes][0][0] = 0; + tess.texCoords[tess.numVertexes][0][1] = 0; + tess.vertexColors[tess.numVertexes][0] = 255 * color[0]; + tess.vertexColors[tess.numVertexes][1] = 255 * color[1]; + tess.vertexColors[tess.numVertexes][2] = 255 * color[2]; + tess.vertexColors[tess.numVertexes][3] = 255 * invratio; + tess.numVertexes++; + + if (p->roll) { + VectorMA (point, 2*height, ru, point); + } else { + VectorMA (point, 2*height, pvup, point); + } + VectorCopy (point, tess.xyz[tess.numVertexes] ); + tess.texCoords[tess.numVertexes][0][0] = 0; + tess.texCoords[tess.numVertexes][0][1] = 1; + tess.vertexColors[tess.numVertexes][0] = 255 * color[0]; + tess.vertexColors[tess.numVertexes][1] = 255 * color[1]; + tess.vertexColors[tess.numVertexes][2] = 255 * color[2]; + tess.vertexColors[tess.numVertexes][3] = 255 * invratio; + tess.numVertexes++; + + if (p->roll) { + VectorMA (point, 2*width, rr, point); + } else { + VectorMA (point, 2*width, pvright, point); + } + VectorCopy (point, tess.xyz[tess.numVertexes] ); + tess.texCoords[tess.numVertexes][0][0] = 1; + tess.texCoords[tess.numVertexes][0][1] = 1; + tess.vertexColors[tess.numVertexes][0] = 255 * color[0]; + tess.vertexColors[tess.numVertexes][1] = 255 * color[1]; + tess.vertexColors[tess.numVertexes][2] = 255 * color[2]; + tess.vertexColors[tess.numVertexes][3] = 255 * invratio; + tess.numVertexes++; + + if (p->roll) { + VectorMA (point, -2*height, ru, point); + } else { + VectorMA (point, -2*height, pvup, point); + } + VectorCopy (point, tess.xyz[tess.numVertexes] ); + tess.texCoords[tess.numVertexes][0][0] = 1; + tess.texCoords[tess.numVertexes][0][1] = 0; + tess.vertexColors[tess.numVertexes][0] = 255 * color[0]; + tess.vertexColors[tess.numVertexes][1] = 255 * color[1]; + tess.vertexColors[tess.numVertexes][2] = 255 * color[2]; + tess.vertexColors[tess.numVertexes][3] = 255 * invratio; + tess.numVertexes++; + + tess.indexes[tess.numIndexes++] = 0; + tess.indexes[tess.numIndexes++] = 1; + tess.indexes[tess.numIndexes++] = 2; + tess.indexes[tess.numIndexes++] = 0; + tess.indexes[tess.numIndexes++] = 2; + tess.indexes[tess.numIndexes++] = 3; + + ind+=4; + RB_EndSurface(); + + } } - + if (!p->pshader) { // force a shader. p->pshader = alfball; @@ -813,7 +798,7 @@ void R_AddParticleToScene (particle_t *p, vec3_t org, float alpha) static float roll = 0.0; #define MINe(p,q) ((p <= q) ? p : q) -int reallyactive; +particle_t* reallyactive; void R_AddParticles (void) { @@ -832,8 +817,6 @@ void R_AddParticles (void) float f; - int intheworld = 0; - if (!initparticles) R_ClearParticles (); @@ -852,7 +835,7 @@ void R_AddParticles (void) grav = PARTICLE_GRAVITY; dvel = 4*frametime; - time = frametime; + time = frametime; VectorCopy( backEnd.refdef.viewaxis[0], pvforward ); @@ -863,30 +846,21 @@ void R_AddParticles (void) roll += ((THEtime- oldTime) * 0.1) ; rotate_ang[ROLL] += (roll*0.9); AngleVectors ( rotate_ang, rforward, rright, rup); - + oldTime = THEtime; active = NULL; tail = NULL; - + // Intended to keep physics calculations under control, but it doens't work properly. :( //if ((!backEnd.doneParticles) && !(tr.refdef.rdflags & RDF_NOWORLDMODEL)) - for (p=active_particles ; p ; p=next) - { - + for (p=active_particles ; p ; p=next) { next = p->next; - - //time = (THEtime- p->time)*0.001; - VectorCopy(p->org, oldorg); - - - - // if we're told to die, it's most likely a quake particle. - if (p->die) - { + // if we're told to die, it's most likely a quake particle. + if (p->die) { int scal = 2.6f; p->endtime = THEtime + (p->die); p->die = 0; @@ -910,24 +884,17 @@ void R_AddParticles (void) - if (p->rendertype != LFXQUAKE){ - p->vel[0] += p->accel[0]*frametime; - p->vel[1] += p->accel[1]*frametime; - p->vel[2] += p->accel[2]*frametime; + if (p->rendertype != LFXQUAKE){ + p->vel[0] += p->accel[0]*frametime; + p->vel[1] += p->accel[1]*frametime; + p->vel[2] += p->accel[2]*frametime; } - - - - else - { - - p->vel[0] += frametime; - p->vel[1] += frametime; - p->vel[2] += frametime; - + else { + p->vel[0] += frametime; + p->vel[1] += frametime; + p->vel[2] += frametime; int i; - switch (p->type) - { + switch (p->type) { case pt_static: break; case pt_fire: @@ -938,7 +905,7 @@ void R_AddParticles (void) p->color = ramp3[(int)p->ramp]; p->vel[2] += grav; break; - + case pt_explode: p->ramp += time2; if (p->ramp >=8) @@ -949,7 +916,7 @@ void R_AddParticles (void) p->vel[i] += p->vel[i]*dvel; p->vel[2] -= grav; break; - + case pt_explode2: p->ramp += time3; if (p->ramp >=8) @@ -960,33 +927,29 @@ void R_AddParticles (void) p->vel[i] -= p->vel[i]*frametime; p->vel[2] -= grav; break; - + case pt_blob: for (i=0 ; i<3 ; i++) p->vel[i] += p->vel[i]*dvel; p->vel[2] -= grav; break; - + case pt_blob2: for (i=0 ; i<2 ; i++) p->vel[i] -= p->vel[i]*dvel; p->vel[2] -= grav; break; - + case pt_grav: p->vel[2] -= grav * 20; break; - + case pt_slowgrav: p->accel[2] -= grav; break; - } + } - - - - if (THEtime> p->endtime) - { + if (THEtime> p->endtime) { p->next = free_particles; free_particles = p; p->type = 0; @@ -999,26 +962,26 @@ void R_AddParticles (void) p->rollvel = 0; p->rollfriction = 0; //p->qarticle = 0; - p->cols[0][0] = 0; - p->cols[1][0] = 0; - p->cols[2][0] = 0; - p->cols[3][0] = 0; - p->cols[0][1] = 0; - p->cols[1][1] = 0; - p->cols[2][1] = 0; - p->cols[3][1] = 0; - p->cols[0][2] = 0; - p->cols[1][2] = 0; - p->cols[2][2] = 0; - p->cols[3][2] = 0; - p->cols[0][3] = 0; - p->cols[1][3] = 0; - p->cols[2][3] = 0; - p->cols[3][3] = 0; - p->cols[0][4] = 0; - p->cols[1][4] = 0; - p->cols[2][4] = 0; - p->cols[3][4] = 0; + p->cols[0][0] = 0; + p->cols[1][0] = 0; + p->cols[2][0] = 0; + p->cols[3][0] = 0; + p->cols[0][1] = 0; + p->cols[1][1] = 0; + p->cols[2][1] = 0; + p->cols[3][1] = 0; + p->cols[0][2] = 0; + p->cols[1][2] = 0; + p->cols[2][2] = 0; + p->cols[3][2] = 0; + p->cols[0][3] = 0; + p->cols[1][3] = 0; + p->cols[2][3] = 0; + p->cols[3][3] = 0; + p->cols[0][4] = 0; + p->cols[1][4] = 0; + p->cols[2][4] = 0; + p->cols[3][4] = 0; p->airfriction = 0; p->bounce = 0; p->bubbleit = 0; @@ -1026,62 +989,48 @@ void R_AddParticles (void) p->active_trail = 0; continue; } - } oldorg[0] = p->org[0]; oldorg[1] = p->org[1]; oldorg[2] = p->org[2]; - - - - - p->org[0] += p->vel[0]*frametime; p->org[1] += p->vel[1]*frametime; p->org[2] += p->vel[2]*frametime; - - if (p->rendertype != LFXQUAKE) - { - if (alpha > 1.0) - alpha = 1; - if (p->rollfriction){ - f = 1.0f - MINe(p->rollfriction * frametime, 1); - p->rollvel *= f; - } - - if (p->airfriction){ - f = 1.0f - MINe(p->airfriction * frametime, 1); - VectorScale(p->vel, f, p->vel); - } + if (p->rendertype != LFXQUAKE) { + if (alpha > 1.0) + alpha = 1; + if (p->rollfriction){ + f = 1.0f - MINe(p->rollfriction * frametime, 1); + p->rollvel *= f; + } + + if (p->airfriction){ + f = 1.0f - MINe(p->airfriction * frametime, 1); + VectorScale(p->vel, f, p->vel); + } + p->roll += (p->rollvel*frametime); + alpha = p->alpha + time*p->alphavel; - p->roll += (p->rollvel*frametime); - - - - alpha = p->alpha + time*p->alphavel; - // hack to prevent that one long particle from going crazy in the world. if (p->startfade > THEtime){ p->alpha = -1; // kill it - } - - if (alpha <= 0) - { // faded out - p->next = free_particles; - free_particles = p; - p->type = 0; - p->airfriction = 0; - p->color = 0; - p->alpha = 0; - p->endtime = THEtime- 0.1; - p->active_trail = 0; - continue; - } + } + if (alpha <= 0) { + // faded out + p->next = free_particles; + free_particles = p; + p->type = 0; + p->airfriction = 0; + p->color = 0; + p->alpha = 0; + p->endtime = THEtime- 0.1; + p->active_trail = 0; + continue; + } - if (THEtime> p->endtime || p->alpha < 0.0f) - { + if (THEtime> p->endtime || p->alpha < 0.0f) { p->next = free_particles; free_particles = p; p->type = 0; @@ -1094,26 +1043,26 @@ void R_AddParticles (void) p->rollvel = 0; p->rollfriction = 0; //p->qarticle = 0; - p->cols[0][0] = 0; - p->cols[1][0] = 0; - p->cols[2][0] = 0; - p->cols[3][0] = 0; - p->cols[0][1] = 0; - p->cols[1][1] = 0; - p->cols[2][1] = 0; - p->cols[3][1] = 0; - p->cols[0][2] = 0; - p->cols[1][2] = 0; - p->cols[2][2] = 0; - p->cols[3][2] = 0; - p->cols[0][3] = 0; - p->cols[1][3] = 0; - p->cols[2][3] = 0; - p->cols[3][3] = 0; - p->cols[0][4] = 0; - p->cols[1][4] = 0; - p->cols[2][4] = 0; - p->cols[3][4] = 0; + p->cols[0][0] = 0; + p->cols[1][0] = 0; + p->cols[2][0] = 0; + p->cols[3][0] = 0; + p->cols[0][1] = 0; + p->cols[1][1] = 0; + p->cols[2][1] = 0; + p->cols[3][1] = 0; + p->cols[0][2] = 0; + p->cols[1][2] = 0; + p->cols[2][2] = 0; + p->cols[3][2] = 0; + p->cols[0][3] = 0; + p->cols[1][3] = 0; + p->cols[2][3] = 0; + p->cols[3][3] = 0; + p->cols[0][4] = 0; + p->cols[1][4] = 0; + p->cols[2][4] = 0; + p->cols[3][4] = 0; p->airfriction = 0; p->bounce = 0; p->bubbleit = 0; @@ -1121,27 +1070,21 @@ void R_AddParticles (void) p->active_trail = 0; continue; } - - } - - - - p->next = NULL; - if (!tail) + if (!tail) { active = tail = p; - else - { + } + else { tail->next = p; tail = p; } - // leilei - trail stuffs + // leilei - trail stuffs vectoangles( p->vel, p->angle ); p->stretch = 34; @@ -1155,74 +1098,67 @@ void R_AddParticles (void) // leilei - bubble conversion - if(p->bubbleit && p->type != LFXBUBBLE) - { - int contents = CM_PointContents( p->org, 0 ); - if ( contents & ( CONTENTS_WATER | CONTENTS_SLIME ) ) { - p->type = LFXBUBBLE; - p->pshader = watbubble; - p->airfriction = 2.0f; - p->accel[0] = 0; - p->accel[1] = 0; - p->accel[2] = 66; - p->cols[0][0] = 1; p->cols[0][1] = 1; p->cols[0][2] = 1; - p->cols[1][0] = 1; p->cols[1][1] = 1; p->cols[1][2] = 1; - p->cols[2][0] = 1; p->cols[2][1] = 1; p->cols[2][2] = 1; - p->cols[3][0] = 1; p->cols[3][1] = 1; p->cols[3][2] = 1; - p->endtime += 1000; // last it a wile - } - + if (p->bubbleit && p->type != LFXBUBBLE) { + int contents = CM_PointContents( p->org, 0 ); + if ( contents & ( CONTENTS_WATER | CONTENTS_SLIME ) ) { + p->type = LFXBUBBLE; + p->pshader = watbubble; + p->airfriction = 2.0f; + p->accel[0] = 0; + p->accel[1] = 0; + p->accel[2] = 66; + p->cols[0][0] = 1; p->cols[0][1] = 1; p->cols[0][2] = 1; + p->cols[1][0] = 1; p->cols[1][1] = 1; p->cols[1][2] = 1; + p->cols[2][0] = 1; p->cols[2][1] = 1; p->cols[2][2] = 1; + p->cols[3][0] = 1; p->cols[3][1] = 1; p->cols[3][2] = 1; + p->endtime += 1000; // last it a wile + } + } - if(p->type == LFXBUBBLE) - { - int contents = CM_PointContents( p->org, 0 ); - if ( contents | ( CONTENTS_WATER | CONTENTS_SLIME ) ) { - p->endtime = THEtime; - } - else - { - p->accel[0] = (crandom() * 4 - 2); - p->accel[1] = (crandom() * 4 - 2); - p->accel[2] = 66; - - } - + if(p->type == LFXBUBBLE) { + int contents = CM_PointContents( p->org, 0 ); + if ( contents | ( CONTENTS_WATER | CONTENTS_SLIME ) ) { + p->endtime = THEtime; + } + else { + p->accel[0] = (crandom() * 4 - 2); + p->accel[1] = (crandom() * 4 - 2); + p->accel[2] = 66; + + } } - + // leilei - bounce physics - if(p->bounce > 0) + if (p->bounce > 0) { + trace_t trace; + float dist; + + // Do the trace of truth + P_Trace (&trace, oldorg, NULL, NULL, p->org, -1, CONTENTS_SOLID); { - trace_t trace; - float dist; - - // Do the trace of truth - P_Trace (&trace, oldorg, NULL, NULL, p->org, -1, CONTENTS_SOLID); - { - if (trace.fraction < 1){ - - VectorCopy(trace.endpos, p->org); // particle where we've hit from - - if (p->bounce < 0) - { - // bounce -1 means remove on impact - p->endtime = THEtime; - } - - // anything else - bounce off solid - dist = DotProduct(p->vel, trace.plane.normal) * -p->bounce; - VectorMA(p->vel, dist, trace.plane.normal, p->vel); - // lets roll - //p->vel[2] = 7; - if(p->bounce < 0.2f) - p->alpha = -5; // kill! - } - } + if (trace.fraction < 1){ + VectorCopy(trace.endpos, p->org); // particle where we've hit from + if (p->bounce < 0) { + // bounce -1 means remove on impact + p->endtime = THEtime; + } + // anything else - bounce off solid + dist = DotProduct(p->vel, trace.plane.normal) * -p->bounce; + VectorMA(p->vel, dist, trace.plane.normal, p->vel); + // lets roll + //p->vel[2] = 7; + if(p->bounce < 0.2f) { + // kill! + p->alpha = -5; + } + } + } } - + //R_AddParticleToScene (p, p->org, alpha); - + } active_particles = active; @@ -1236,20 +1172,6 @@ void R_AddParticles (void) void R_RenderParticles (void) { particle_t *p, *next; - float alpha; - float time, time2; - vec3_t oldorg; // leilei - particle_t *active, *tail; - vec3_t rotate_ang; - - float frametime; - float time3; - float time1; - float dvel; - float grav; - - float f; - if (!initparticles) return; @@ -1259,13 +1181,12 @@ void R_RenderParticles (void) active_particles = reallyactive; - for (p=active_particles ; p ; p=next) - { + for (p=active_particles ; p ; p=next) { next = p->next; R_AddParticleToScene (p, p->org, p->alpha); } - + } @@ -1300,7 +1221,7 @@ void R_RenderParticles (void) // -void R_LFX_Blood (vec3_t org, vec3_t dir, float pressure) +void R_LFX_Blood (vec3_t org, vec3_t dir, float pressure) { int i, j; int count = pressure * 4; @@ -1335,7 +1256,7 @@ void R_LFX_Blood (vec3_t org, vec3_t dir, float pressure) p->colortype = P_LFX; - + VectorCopy(org, p->org); p->bounce = 1.1f; for (j = 0; j < 3; j++) { @@ -1351,7 +1272,7 @@ void R_LFX_Blood (vec3_t org, vec3_t dir, float pressure) p->airfriction = 0; // p->org[j] = org[j] + (rand()&((count))-(count)); - // p->vel[j] = dir[j]*(rand()*(count*0.5))-(count) * 0.7; + // p->vel[j] = dir[j]*(rand()*(count*0.5))-(count) * 0.7; // p->vel[2] += (i / 5); // } @@ -1378,10 +1299,10 @@ void R_LFX_Smoke (vec3_t org, vec3_t dir, float spread, float speed, vec4_t colo p->next = active_particles; active_particles = p; p->time = THEtime; - + p->endtime = THEtime+ duration; p->startfade = THEtime; - + p->rendertype = LFXSMOKE; p->alpha = 0.1f; p->alphavel = 0.0f; @@ -1391,31 +1312,31 @@ void R_LFX_Smoke (vec3_t org, vec3_t dir, float spread, float speed, vec4_t colo p->endwidth = p->width + scaleup; - // Manage random roll and + // Manage random roll and p->rotate = qtrue; p->roll = crandom()*179; - - p->cols[0][0] = color1[0]; + + p->cols[0][0] = color1[0]; p->cols[1][0] = color1[1]; p->cols[2][0] = color1[2]; p->cols[3][0] = color1[3]; - p->cols[0][1] = color2[0]; + p->cols[0][1] = color2[0]; p->cols[1][1] = color2[1]; p->cols[2][1] = color2[2]; p->cols[3][1] = color2[3]; - p->cols[0][2] = color3[0]; + p->cols[0][2] = color3[0]; p->cols[1][2] = color3[1]; p->cols[2][2] = color3[2]; p->cols[3][2] = color3[3]; - p->cols[0][3] = color4[0]; + p->cols[0][3] = color4[0]; p->cols[1][3] = color4[1]; p->cols[2][3] = color4[2]; p->cols[3][3] = color4[3]; - p->cols[0][4] = color5[0]; + p->cols[0][4] = color5[0]; p->cols[1][4] = color5[1]; p->cols[2][4] = color5[2]; p->cols[3][4] = color5[3]; @@ -1433,7 +1354,7 @@ void R_LFX_Smoke (vec3_t org, vec3_t dir, float spread, float speed, vec4_t colo p->pshader = alfsmoke; p->colortype = P_LFX; - + VectorCopy(org, p->org); // Manage spread of origin and velocity @@ -1473,10 +1394,10 @@ void R_LFX_Smoke2 (vec3_t org, vec3_t dir, float spread, float speed, vec4_t col p->next = active_particles; active_particles = p; p->time = THEtime; - + p->endtime = THEtime+ duration; p->startfade = THEtime; - p->bubbleit = 1; + p->bubbleit = 1; p->rendertype = LFXSMOKE; p->alpha = 0.1f; p->alphavel = 0.0f; @@ -1486,31 +1407,31 @@ void R_LFX_Smoke2 (vec3_t org, vec3_t dir, float spread, float speed, vec4_t col p->endwidth = p->width + scaleup; - // Manage random roll and + // Manage random roll and p->rotate = qtrue; p->roll = crandom()*179; - p->cols[0][0] = color1[0]; + p->cols[0][0] = color1[0]; p->cols[1][0] = color1[1]; p->cols[2][0] = color1[2]; p->cols[3][0] = color1[3]; - p->cols[0][1] = color2[0]; + p->cols[0][1] = color2[0]; p->cols[1][1] = color2[1]; p->cols[2][1] = color2[2]; p->cols[3][1] = color2[3]; - p->cols[0][2] = color3[0]; + p->cols[0][2] = color3[0]; p->cols[1][2] = color3[1]; p->cols[2][2] = color3[2]; p->cols[3][2] = color3[3]; - p->cols[0][3] = color4[0]; + p->cols[0][3] = color4[0]; p->cols[1][3] = color4[1]; p->cols[2][3] = color4[2]; p->cols[3][3] = color4[3]; - p->cols[0][4] = color5[0]; + p->cols[0][4] = color5[0]; p->cols[1][4] = color5[1]; p->cols[2][4] = color5[2]; p->cols[3][4] = color5[3]; @@ -1528,7 +1449,7 @@ void R_LFX_Smoke2 (vec3_t org, vec3_t dir, float spread, float speed, vec4_t col p->pshader = alfsmoke; p->colortype = P_LFX; - + VectorCopy(org, p->org); /* // Manage spread of origin and velocity @@ -1577,12 +1498,12 @@ void R_LFX_Shock (vec3_t org, vec3_t dir, float spread, float speed, vec4_t colo p->next = active_particles; active_particles = p; p->time = THEtime; - + p->endtime = THEtime+ duration; p->startfade = THEtime; p->bubbleit = 0; p->rendertype = LFXSHOCK; - + // p->rendertype = BLOODRED; // note - not actually bloodred. p->alpha = 0.1f; p->alphavel = 0.0f; @@ -1593,37 +1514,37 @@ void R_LFX_Shock (vec3_t org, vec3_t dir, float spread, float speed, vec4_t colo p->endwidth = p->width + scaleup; - // Manage random roll and + // Manage random roll and p->rotate = qtrue; //p->rotate = qtrue; p->roll = crandom()*179; //p->roll = rand()%179; - p->dir[0] = dir[0]; - p->dir[1] = dir[1]; - p->dir[2] = dir[2]; + p->dir[0] = dir[0]; + p->dir[1] = dir[1]; + p->dir[2] = dir[2]; - p->cols[0][0] = color1[0]; + p->cols[0][0] = color1[0]; p->cols[1][0] = color1[1]; p->cols[2][0] = color1[2]; p->cols[3][0] = color1[3]; - p->cols[0][1] = color2[0]; + p->cols[0][1] = color2[0]; p->cols[1][1] = color2[1]; p->cols[2][1] = color2[2]; p->cols[3][1] = color2[3]; - p->cols[0][2] = color3[0]; + p->cols[0][2] = color3[0]; p->cols[1][2] = color3[1]; p->cols[2][2] = color3[2]; p->cols[3][2] = color3[3]; - p->cols[0][3] = color4[0]; + p->cols[0][3] = color4[0]; p->cols[1][3] = color4[1]; p->cols[2][3] = color4[2]; p->cols[3][3] = color4[3]; - p->cols[0][4] = color5[0]; + p->cols[0][4] = color5[0]; p->cols[1][4] = color5[1]; p->cols[2][4] = color5[2]; p->cols[3][4] = color5[3]; @@ -1642,7 +1563,7 @@ void R_LFX_Shock (vec3_t org, vec3_t dir, float spread, float speed, vec4_t colo p->pshader = alfshock; p->colortype = P_LFX; - + VectorCopy(org, p->org); // Manage spread of origin and velocity @@ -1662,8 +1583,8 @@ void R_LFX_Shock (vec3_t org, vec3_t dir, float spread, float speed, vec4_t colo // } - - + + //p->accel[0] = p->accel[1] = p->accel[2] = 0; //p->accel[2] = -(PARTICLE_GRAVITY / 2); @@ -1688,10 +1609,10 @@ void R_LFX_Spark (vec3_t org, vec3_t dir, float spread, float speed, vec4_t colo p->next = active_particles; active_particles = p; p->time = THEtime; - + p->endtime = THEtime+ duration; p->startfade = THEtime; - + p->rendertype = LFXSPARK; //p->color = EMISIVEFADE; p->alpha = 1.0f; @@ -1705,33 +1626,33 @@ void R_LFX_Spark (vec3_t org, vec3_t dir, float spread, float speed, vec4_t colo p->rotate = qfalse; // sparks don't rotate p->roll = 0; // sparks don't roll - + p->accel[0] = p->accel[1] = p->accel[2] = 0; p->bubbleit = 1; - p->cols[0][0] = color1[0]; + p->cols[0][0] = color1[0]; p->cols[1][0] = color1[1]; p->cols[2][0] = color1[2]; p->cols[3][0] = color1[3]; - p->cols[0][1] = color2[0]; + p->cols[0][1] = color2[0]; p->cols[1][1] = color2[1]; p->cols[2][1] = color2[2]; p->cols[3][1] = color2[3]; - p->cols[0][2] = color3[0]; + p->cols[0][2] = color3[0]; p->cols[1][2] = color3[1]; p->cols[2][2] = color3[2]; p->cols[3][2] = color3[3]; - p->cols[0][3] = color4[0]; + p->cols[0][3] = color4[0]; p->cols[1][3] = color4[1]; p->cols[2][3] = color4[2]; p->cols[3][3] = color4[3]; - p->cols[0][4] = color5[0]; + p->cols[0][4] = color5[0]; p->cols[1][4] = color5[1]; p->cols[2][4] = color5[2]; p->cols[3][4] = color5[3]; @@ -1754,7 +1675,7 @@ void R_LFX_Spark (vec3_t org, vec3_t dir, float spread, float speed, vec4_t colo // p->colortype = P_LFX; - + VectorCopy(org, p->org); @@ -1785,7 +1706,7 @@ void R_LFX_Spark (vec3_t org, vec3_t dir, float spread, float speed, vec4_t colo p->vel[2] += (speed * 0.4f); - + p->accel[0] = p->accel[1] = p->accel[2] = 0; p->accel[2] = -(800 * 0.5f); // TODO: insert proper gravity. @@ -1826,7 +1747,7 @@ void R_LFX_Burst (vec3_t org, vec3_t dir, float spread, float speed, vec4_t colo p->endtime = THEtime+ duration; p->startfade = THEtime; - + p->rendertype = LFXBURST; //p->color = EMISIVEFADE; p->alpha = 1.0f; @@ -1840,31 +1761,31 @@ void R_LFX_Burst (vec3_t org, vec3_t dir, float spread, float speed, vec4_t colo p->rotate = qfalse; // sparks don't rotate p->roll = 0; // sparks don't roll - + p->accel[0] = p->accel[1] = p->accel[2] = 0; - p->cols[0][0] = color1[0]; + p->cols[0][0] = color1[0]; p->cols[1][0] = color1[1]; p->cols[2][0] = color1[2]; p->cols[3][0] = color1[3]; - p->cols[0][1] = color2[0]; + p->cols[0][1] = color2[0]; p->cols[1][1] = color2[1]; p->cols[2][1] = color2[2]; p->cols[3][1] = color2[3]; - p->cols[0][2] = color3[0]; + p->cols[0][2] = color3[0]; p->cols[1][2] = color3[1]; p->cols[2][2] = color3[2]; p->cols[3][2] = color3[3]; - p->cols[0][3] = color4[0]; + p->cols[0][3] = color4[0]; p->cols[1][3] = color4[1]; p->cols[2][3] = color4[2]; p->cols[3][3] = color4[3]; - p->cols[0][4] = color5[0]; + p->cols[0][4] = color5[0]; p->cols[1][4] = color5[1]; p->cols[2][4] = color5[2]; p->cols[3][4] = color5[3]; @@ -1942,80 +1863,80 @@ void R_LFX_Generic (int type, vec3_t org, vec3_t dir, float alpha, int spread, i p = 0; // die warnings - for (i = 0; i < cont; i++) { - if (!free_particles) - return; - p = free_particles; - free_particles = p->next; - p->next = active_particles; - active_particles = p; - p->time = THEtime; - p->endtime = THEtime+ duration; - p->startfade = THEtime; - p->bubbleit = 0; // don't do bubble check for any generic particles. - p->rendertype = type; - p->alpha = alpha; - p->alphavel = 0.0f; - p->height = p->width = (1.0 * scale); + for (i = 0; i < cont; i++) { + if (!free_particles) { + return; + } + p = free_particles; + free_particles = p->next; + p->next = active_particles; + active_particles = p; + p->time = THEtime; + p->endtime = THEtime+ duration; + p->startfade = THEtime; + p->bubbleit = 0; // don't do bubble check for any generic particles. + p->rendertype = type; + p->alpha = alpha; + p->alphavel = 0.0f; + p->height = p->width = (1.0 * scale); - p->endheight = p->height + scaleup; - p->endwidth = p->width + scaleup; + p->endheight = p->height + scaleup; + p->endwidth = p->width + scaleup; - p->rotate = qtrue; - p->roll = 0;//crandom()*randroll; + p->rotate = qtrue; + p->roll = 0;//crandom()*randroll; - // we only use one color for this fine generic function + // we only use one color for this fine generic function - p->cols[0][0] = cred / 255; - p->cols[1][0] = cgreen / 255; - p->cols[2][0] = cblue / 255; - p->cols[3][0] = 1.0f; + p->cols[0][0] = cred / 255; + p->cols[1][0] = cgreen / 255; + p->cols[2][0] = cblue / 255; + p->cols[3][0] = 1.0f; - p->cols[0][1] = cred / 255; - p->cols[1][1] = cgreen / 255; - p->cols[2][1] = cblue / 255; - p->cols[3][1] = 1.0f; + p->cols[0][1] = cred / 255; + p->cols[1][1] = cgreen / 255; + p->cols[2][1] = cblue / 255; + p->cols[3][1] = 1.0f; - p->cols[0][2] = cred / 255; - p->cols[1][2] = cgreen / 255; - p->cols[2][2] = cblue / 255; - p->cols[3][2] = 1.0f; + p->cols[0][2] = cred / 255; + p->cols[1][2] = cgreen / 255; + p->cols[2][2] = cblue / 255; + p->cols[3][2] = 1.0f; - p->cols[0][3] = cred / 255; - p->cols[1][3] = cgreen / 255; - p->cols[2][3] = cblue / 255; - p->cols[3][3] = 1.0f; + p->cols[0][3] = cred / 255; + p->cols[1][3] = cgreen / 255; + p->cols[2][3] = cblue / 255; + p->cols[3][3] = 1.0f; - p->cols[0][4] = cred / 255; - p->cols[1][4] = cgreen / 255; - p->cols[2][4] = cblue / 255; - p->cols[3][4] = 1.0f; + p->cols[0][4] = cred / 255; + p->cols[1][4] = cgreen / 255; + p->cols[2][4] = cblue / 255; + p->cols[3][4] = 1.0f; - p->pshader = shader; + p->pshader = shader; - //p->rollvel = crandom() * (50 - 100)*DotProduct(p->vel); - p->rollvel = crandom() * ((p->vel[0]+p->vel[1]+p->vel[2])/6) - ((p->vel[0]+p->vel[1]+p->vel[2])/3); - p->rollfriction = rollfriction; - p->airfriction = airfriction; - p->accel[0] = p->accel[1] = 0; - p->accel[2] = (PARTICLE_GRAVITY*grav); - p->bounce = bounce; - + //p->rollvel = crandom() * (50 - 100)*DotProduct(p->vel); + p->rollvel = crandom() * ((p->vel[0]+p->vel[1]+p->vel[2])/6) - ((p->vel[0]+p->vel[1]+p->vel[2])/3); + p->rollfriction = rollfriction; + p->airfriction = airfriction; + p->accel[0] = p->accel[1] = 0; + p->accel[2] = (PARTICLE_GRAVITY*grav); + p->bounce = bounce; - p->colortype = P_LFXSIMPLE; // it's always an lfx for this one. - - VectorCopy(org, p->org); - // Manage spread of origin and velocity - for (j = 0; j < 3; j++) { - p->org[j] = org[j] + ((rand() % orgoff) - (int)(orgoff * 0.5f)); - //p->org[j] = org[j]; - p->vel[j] = (rand() & (int)spread) - (int)(spread * 0.5f); - p->vel[j] += dir[j]; - p->vel[j] += (dir[j] * (rand() & (int)speed)); + p->colortype = P_LFXSIMPLE; // it's always an lfx for this one. + VectorCopy(org, p->org); + + // Manage spread of origin and velocity + for (j = 0; j < 3; j++) { + p->org[j] = org[j] + ((rand() % orgoff) - (int)(orgoff * 0.5f)); + //p->org[j] = org[j]; + p->vel[j] = (rand() & (int)spread) - (int)(spread * 0.5f); + p->vel[j] += dir[j]; + p->vel[j] += (dir[j] * (rand() & (int)speed)); } } } @@ -2150,7 +2071,7 @@ void Q_ParticleExplosion (vec3_t org) { int i, j; particle_t *p; - + for (i=0 ; i<1024 ; i++) { if (!free_particles) @@ -2213,7 +2134,7 @@ void Q_RocketTrail (vec3_t start, vec3_t end, int type) free_particles = p->next; p->next = active_particles; active_particles = p; - + VectorCopy (vec3_origin, p->vel); p->die = cl.time + 2; @@ -2250,7 +2171,7 @@ void Q_RocketTrail (vec3_t start, vec3_t end, int type) p->color = 52 + ((tracercount&4)<<1); else p->color = 230 + ((tracercount&4)<<1); - + tracercount++; VectorCopy (start, p->org); @@ -2282,7 +2203,7 @@ void Q_RocketTrail (vec3_t start, vec3_t end, int type) p->org[j] = start[j] + ((rand()&15)-8); break; } - + VectorAdd (start, vec, start); } @@ -2367,7 +2288,7 @@ void LFX_ParticleEffect1996 (int effect, vec3_t org, vec3_t dir) // 200X - most games of that decade... // - usually ltos of particles -// - usually +// - usually void LFX_ParticleEffect200X (int effect, vec3_t org, vec3_t dir) { vec3_t origin, sprOrg, sprVel; // laziness @@ -2394,7 +2315,7 @@ void LFX_ParticleEffect200X (int effect, vec3_t org, vec3_t dir) colory2[0] = 0.7; colory2[1] = 0.7; colory2[2] = 0.7; colory2[3] = 0.5; colory3[0] = 0.6; colory3[1] = 0.6; colory3[2] = 0.6; colory3[3] = 0.8; colory4[0] = 0.6; colory4[1] = 0.6; colory4[2] = 0.6; colory4[3] = 0.0; - + VectorMA( origin, 4, dir, sprOrg ); VectorScale( dir, 1, sprVel ); // Sparks @@ -2477,44 +2398,44 @@ void LFX_ParticleEffect200X (int effect, vec3_t org, vec3_t dir) else if (effect == 5 || effect == 4 || effect == 11) { - - + + colory[0] = 1.0; colory[1] = 1.0; colory[2] = 1.0; colory[3] = 1.0; colory2[0] = 1.0; colory2[1] = 1.0; colory2[2] = 0.5; colory2[3] = 0.9; colory3[0] = 0.7; colory3[1] = 0.3; colory3[2] = 0.1; colory3[3] = 0.7; colory4[0] = 0.0; colory4[1] = 0.0; colory4[2] = 0.0; colory4[3] = 0.0; VectorMA( origin, 4, dir, sprOrg ); VectorScale( dir, 64, sprVel ); - + R_LFX_Shock (sprOrg, dir, 0, 0, colory, colory2, colory3, colory4, colory4, 1, 500, 270, 1); - + // fireball - + colory[0] = 1.0; colory[1] = 0.2; colory[2] = 0.1; colory[3] = 0.0; colory2[0] = 0.5; colory2[1] = 0.0; colory2[2] = 0.0; colory2[3] = 0.2; colory3[0] = 0.1; colory3[1] = 0.0; colory3[2] = 0.0; colory3[3] = 0.7; colory4[0] = 0.0; colory4[1] = 0.0; colory4[2] = 0.0; colory4[3] = 0.0; VectorMA( origin, 12, dir, sprOrg ); VectorScale( dir, 64, sprVel ); - + R_LFX_Smoke (sprOrg, sprVel, 32, 3.54, colory, colory2, colory3, colory4, colory4, 16, 1000, 94, 1); - + colory[0] = 1.0; colory[1] = 1.0; colory[2] = 0.9; colory[3] = 1.0; colory2[0] = 1.0; colory2[1] = 0.7; colory2[2] = 0.2; colory2[3] = 0.9; colory3[0] = 0.3; colory3[1] = 0.2; colory3[2] = 0.1; colory3[3] = 0.7; colory4[0] = 0.0; colory4[1] = 0.0; colory4[2] = 0.0; colory4[3] = 0.0; - + R_LFX_Smoke (sprOrg, sprVel, 62, 2, colory, colory2, colory3, colory4, colory4, 12, 200,84, 8); R_LFX_Smoke (sprOrg, sprVel, 32, 1.54, colory, colory2, colory3, colory4, colory4, 22, 600, 74, 8); - + R_LFX_Smoke (sprOrg, sprVel, 44, 1.3, colory, colory2, colory3, colory4, colory4, 3, 800,3, 8); - + R_LFX_Smoke (sprOrg, sprVel, 32, 0.54, colory, colory2, colory3, colory4, colory4, 12, 600, 74, 8); - + // Shroom Cloud VectorMA( origin, 16, dir, sprOrg ); VectorScale( dir, 64, sprVel ); - + colory[0] = 0.5; colory[1] = 0.0; colory[2] = 0.0; colory[3] = 0.0; colory2[0] = 1.0; colory2[1] = 1.0; colory2[2] = 0.2; colory2[3] = 0.2; colory3[0] = 0.5; colory3[1] = 0.1; colory3[2] = 0.0; colory3[3] = 0.5; @@ -2522,96 +2443,90 @@ void LFX_ParticleEffect200X (int effect, vec3_t org, vec3_t dir) R_LFX_Smoke (sprOrg, sprVel, 3, 0.7, colory, colory2, colory3, colory4, colory4, 22, 300,135, 8); // Sparks! - + colory[0] = 1; colory[1] = 1; colory[2] = 1.0; colory[3] = 1.0; colory2[0] = 1; colory2[1] = 1; colory2[2] = 0.8; colory2[3] = 0.9; colory3[0] = 0.7; colory3[1] = 0.5; colory3[2] = 0.2; colory3[3] = 0.7; colory4[0] = 0.1; colory4[1] = 0.06; colory4[2] = 0.0; colory4[3] = 0.0; VectorMA( origin, 12, dir, sprOrg ); VectorScale( dir, 64, sprVel ); - + R_LFX_Burst (sprOrg, sprVel, 175, 15, colory, colory2, colory3, colory4, colory4, 15, 240, 22, 1); - + R_LFX_Spark (sprOrg, sprVel, 175, 5, colory, colory2, colory3, colory4, colory4, 25, 1240, 0.8f, 1); - + } // BFG - else if (effect == 9) - { - - - colory[0] = 1.0; colory[1] = 1.0; colory[2] = 1.0; colory[3] = 1.0; - colory2[0] = 0.3; colory2[1] = 1.0; colory2[2] = 0.2; colory2[3] = 0.9; - colory3[0] = 0.0; colory3[1] = 0.3; colory3[2] = 0.1; colory3[3] = 0.7; - colory4[0] = 0.0; colory4[1] = 0.0; colory4[2] = 0.0; colory4[3] = 0.0; - VectorMA( origin, 4, dir, sprOrg ); - VectorScale( dir, 64, sprVel ); - - R_LFX_Shock (sprOrg, dir, 0, 0, colory, colory2, colory3, colory4, colory4, 1, 300, 470, 1); - - // fireball - + else if (effect == 9) { + colory[0] = 1.0; colory[1] = 1.0; colory[2] = 1.0; colory[3] = 1.0; + colory2[0] = 0.3; colory2[1] = 1.0; colory2[2] = 0.2; colory2[3] = 0.9; + colory3[0] = 0.0; colory3[1] = 0.3; colory3[2] = 0.1; colory3[3] = 0.7; + colory4[0] = 0.0; colory4[1] = 0.0; colory4[2] = 0.0; colory4[3] = 0.0; + VectorMA( origin, 4, dir, sprOrg ); + VectorScale( dir, 64, sprVel ); - VectorMA( origin, 12, dir, sprOrg ); - VectorScale( dir, 64, sprVel ); - - R_LFX_Smoke (sprOrg, sprVel, 32, 3.54, colory, colory2, colory3, colory4, colory4, 16, 200, 174, 1); - - - R_LFX_Smoke (sprOrg, sprVel, 62, 2, colory, colory2, colory3, colory4, colory4, 12, 800,84, 8); - R_LFX_Smoke (sprOrg, sprVel, 32, 1.54, colory, colory2, colory3, colory4, colory4, 22, 400, 74, 8); - - R_LFX_Smoke (sprOrg, sprVel, 44, 1.3, colory, colory2, colory3, colory4, colory4, 3, 500,3, 8); - - R_LFX_Smoke (sprOrg, sprVel, 32, 0.54, colory, colory2, colory3, colory4, colory4, 12, 400, 74, 8); - - // Shroom Cloud - VectorMA( origin, 16, dir, sprOrg ); - VectorScale( dir, 64, sprVel ); - - R_LFX_Smoke (sprOrg, sprVel, 3, 0.7, colory, colory2, colory3, colory4, colory4, 22, 300,135, 8); + R_LFX_Shock (sprOrg, dir, 0, 0, colory, colory2, colory3, colory4, colory4, 1, 300, 470, 1); - // Sparks! + // fireball - VectorMA( origin, 12, dir, sprOrg ); - VectorScale( dir, 64, sprVel ); - - R_LFX_Burst (sprOrg, sprVel, 175, 15, colory, colory2, colory3, colory4, colory4, 15, 140, 32, 1); - - R_LFX_Spark (sprOrg, sprVel, 175, 5, colory, colory2, colory3, colory4, colory4, 15, 1040, 0.8f, 1); - - } + + VectorMA( origin, 12, dir, sprOrg ); + VectorScale( dir, 64, sprVel ); + + R_LFX_Smoke (sprOrg, sprVel, 32, 3.54, colory, colory2, colory3, colory4, colory4, 16, 200, 174, 1); + + + R_LFX_Smoke (sprOrg, sprVel, 62, 2, colory, colory2, colory3, colory4, colory4, 12, 800,84, 8); + R_LFX_Smoke (sprOrg, sprVel, 32, 1.54, colory, colory2, colory3, colory4, colory4, 22, 400, 74, 8); + + R_LFX_Smoke (sprOrg, sprVel, 44, 1.3, colory, colory2, colory3, colory4, colory4, 3, 500,3, 8); + + R_LFX_Smoke (sprOrg, sprVel, 32, 0.54, colory, colory2, colory3, colory4, colory4, 12, 400, 74, 8); + + // Shroom Cloud + VectorMA( origin, 16, dir, sprOrg ); + VectorScale( dir, 64, sprVel ); + + R_LFX_Smoke (sprOrg, sprVel, 3, 0.7, colory, colory2, colory3, colory4, colory4, 22, 300,135, 8); + + // Sparks! + + VectorMA( origin, 12, dir, sprOrg ); + VectorScale( dir, 64, sprVel ); + + R_LFX_Burst (sprOrg, sprVel, 175, 15, colory, colory2, colory3, colory4, colory4, 15, 140, 32, 1); + + R_LFX_Spark (sprOrg, sprVel, 175, 5, colory, colory2, colory3, colory4, colory4, 15, 1040, 0.8f, 1); + } // Nail Hit - if (effect == 10) - { - colory[0] = 0.7; colory[1] = 0.7; colory[2] = 0.7; colory[3] = 0.0; - colory2[0] = 0.7; colory2[1] = 0.7; colory2[2] = 0.7; colory2[3] = 0.5; - colory3[0] = 0.6; colory3[1] = 0.6; colory3[2] = 0.6; colory3[3] = 0.8; - colory4[0] = 0.6; colory4[1] = 0.6; colory4[2] = 0.6; colory4[3] = 0.0; - VectorMA( origin, 1, dir, sprOrg ); - VectorScale( dir, 7, sprVel ); - R_LFX_Smoke2 (sprOrg, sprVel, 2 + (random()*6), 3.54+ (random()*8.7), colory, colory2, colory3, colory4, colory4, 1, 300 + (random()*2000), 2, 8+ (random()*6), 4); + if (effect == 10) { + colory[0] = 0.7; colory[1] = 0.7; colory[2] = 0.7; colory[3] = 0.0; + colory2[0] = 0.7; colory2[1] = 0.7; colory2[2] = 0.7; colory2[3] = 0.5; + colory3[0] = 0.6; colory3[1] = 0.6; colory3[2] = 0.6; colory3[3] = 0.8; + colory4[0] = 0.6; colory4[1] = 0.6; colory4[2] = 0.6; colory4[3] = 0.0; + VectorMA( origin, 1, dir, sprOrg ); + VectorScale( dir, 7, sprVel ); + R_LFX_Smoke2 (sprOrg, sprVel, 2 + (random()*6), 3.54+ (random()*8.7), colory, colory2, colory3, colory4, colory4, 1, 300 + (random()*2000), 2, 8+ (random()*6), 4); colory[0] = 0.7; colory[1] = 1.0; colory[2] = 1.0; colory[3] = 0.0; colory2[0] = 0.3; colory2[1] = 0.7; colory2[2] = 1.0; colory2[3] = 0.5; colory3[0] = 0.0; colory3[1] = 0.2; colory3[2] = 0.5; colory3[3] = 0.8; colory4[0] = 0.0; colory4[1] = 0.0; colory4[2] = 0.0; colory4[3] = 0.0; - + VectorMA( origin, 4, dir, sprOrg ); VectorScale( dir, 1, sprVel ); - R_LFX_Burst (sprOrg, sprVel, 8366, 2, colory, colory2, colory3, colory4, colory4, 4, 150, 3, 1); + R_LFX_Burst (sprOrg, sprVel, 8366, 2, colory, colory2, colory3, colory4, colory4, 4, 150, 3, 1); - VectorMA( origin, 1, dir, sprOrg ); - VectorScale( dir, 1, sprVel ); + VectorMA( origin, 1, dir, sprOrg ); + VectorScale( dir, 1, sprVel ); - R_LFX_Spark (sprOrg, sprVel, 95, 225, colory, colory2, colory3, colory4, colory4, 5, 140, 0.5f, 1); - R_LFX_Spark (sprOrg, sprVel, 95, 185, colory, colory2, colory3, colory4, colory4, 1, 2540, 0.5f, 1); + R_LFX_Spark (sprOrg, sprVel, 95, 225, colory, colory2, colory3, colory4, colory4, 5, 140, 0.5f, 1); + R_LFX_Spark (sprOrg, sprVel, 95, 185, colory, colory2, colory3, colory4, colory4, 1, 2540, 0.5f, 1); - - } + } // Blood Sprays for bullets if (effect == 14 && com_blood->integer) @@ -2699,7 +2614,7 @@ void LFX_ParticleEffect200X (int effect, vec3_t org, vec3_t dir) colory2[0] = 0.7; colory2[1] = 0.7; colory2[2] = 0.7; colory2[3] = 0.5; colory3[0] = 0.6; colory3[1] = 0.6; colory3[2] = 0.6; colory3[3] = 0.8; colory4[0] = 0.6; colory4[1] = 0.6; colory4[2] = 0.6; colory4[3] = 0.0; - + //R_LFX_Burst (sprOrg, sprVel, 22, 266, colory, colory2, colory3, colory4, colory4, 1, 144, 2, 7); R_LFX_Smoke2 (sprOrg, sprVel, 2 + (random()*6), 3.54+ (random()*55.7), colory, colory2, colory3, colory4, colory4, 4, 300 + (random()*3000), 2, 8+ (random()*6), 4); @@ -2710,7 +2625,7 @@ void LFX_ParticleEffect200X (int effect, vec3_t org, vec3_t dir) */ } -// 1997 - +// 1997 - // - alpha blends ONLY! // - low amounts of polygons // - high atlas usage @@ -2763,15 +2678,15 @@ void LFX_ParticleEffect1997 (int effect, vec3_t org, vec3_t dir) // should be an explosion atlas, but on later versions there's several more delayed explosion atlases to spice up the variety else if (effect == 5 || effect == 4 || effect == 11) { - + } // BFG, could be an expanding sphere with an explosion atlas else if (effect == 9) { - - + + } // Blood Sprays for bullets @@ -2826,135 +2741,120 @@ void LFX_ParticleEffect1998 (int effect, vec3_t org, vec3_t dir) // Smoke trails on grenades and rockets // might be a beam. - if (effect == 1) - { + if (effect == 1) { - } + } // Bullet Hit // glquake black particles of debris coming off // followed by a few stretchy sparks of orange that fall out of it - // + // - if (effect == 2) - { - // Sparks - colory[0] = 0.6; colory[1] = 0.4; colory[2] = 0.0; colory[3] = 1.0; - colory2[0] = 0.7; colory2[1] = 0.4; colory2[2] = 0.0; colory2[3] = 0.9; - colory3[0] = 0.5; colory3[1] = 0.2; colory3[2] = 0.0; colory3[3] = 0.7; - colory4[0] = 0.1; colory4[1] = 0.06; colory4[2] = 0.0; colory4[3] = 0.0; + if (effect == 2) { + // Sparks + colory[0] = 0.6; colory[1] = 0.4; colory[2] = 0.0; colory[3] = 1.0; + colory2[0] = 0.7; colory2[1] = 0.4; colory2[2] = 0.0; colory2[3] = 0.9; + colory3[0] = 0.5; colory3[1] = 0.2; colory3[2] = 0.0; colory3[3] = 0.7; + colory4[0] = 0.1; colory4[1] = 0.06; colory4[2] = 0.0; colory4[3] = 0.0; - VectorMA( origin, 1, dir, sprOrg ); - VectorScale( dir, 1, sprVel ); - sprVel[2] += 2; - R_LFX_Spark (sprOrg, sprVel, 11, 32, colory, colory2, colory3, colory4, colory4, 4, 440, 0.5f, 1); + VectorMA( origin, 1, dir, sprOrg ); + VectorScale( dir, 1, sprVel ); + sprVel[2] += 2; + R_LFX_Spark (sprOrg, sprVel, 11, 32, colory, colory2, colory3, colory4, colory4, 4, 440, 0.5f, 1); + sprVel[2] += 64; + R_LFX_Generic ( + LFXSMOKE, // Particle Type + sprOrg, // Origin + sprVel, // Velocity + 1.0f, // Starting Alpha + 85, // Spread Factor + 3, // Random Origin Offset + 0, // Random Roll Value + 0, // Additional Random Speed + 8, // Particle Color Red + 8, // Particle Color Green + 8, // Particle Color Blue + 8, // Particle Count + 400, // Particle Life + 0.5f, // Particle Scale + 0.5f, // Particle Scale Towards + 0.1f, // Particle Bounce Factor + 0, // Air Friction (stopping particle velocity in air) + -16.0f, // Particle Gravity Factor + 0.0f, // Particle Rolling Friction + alfball // Particle Shader + ); + } + else if (effect == 3) { + if (rand() < 0.5f){ // only happens for half the pellets + // Sparks + colory[0] = 0.6; colory[1] = 0.4; colory[2] = 0.0; colory[3] = 1.0; + colory2[0] = 0.7; colory2[1] = 0.4; colory2[2] = 0.0; colory2[3] = 0.9; + colory3[0] = 0.5; colory3[1] = 0.2; colory3[2] = 0.0; colory3[3] = 0.7; + colory4[0] = 0.1; colory4[1] = 0.06; colory4[2] = 0.0; colory4[3] = 0.0; + + VectorMA( origin, 1, dir, sprOrg ); + VectorScale( dir, 1, sprVel ); + + R_LFX_Spark (sprOrg, sprVel, 95, 32, colory, colory2, colory3, colory4, colory4, 3, 440, 0.5f, 1); sprVel[2] += 64; - R_LFX_Generic - (LFXSMOKE, // Particle Type - sprOrg, // Origin - sprVel, // Velocity - 1.0f, // Starting Alpha - 85, // Spread Factor - 3, // Random Origin Offset - 0, // Random Roll Value - 0, // Additional Random Speed - 8, // Particle Color Red - 8, // Particle Color Green - 8, // Particle Color Blue - 8, // Particle Count - 400, // Particle Life - 0.5f, // Particle Scale - 0.5f, // Particle Scale Towards - 0.1f, // Particle Bounce Factor - 0, // Air Friction (stopping particle velocity in air) - -16.0f, // Particle Gravity Factor - 0.0f, // Particle Rolling Friction - alfball // Particle Shader - ); - } - - - else if (effect == 3) - { - if (rand() < 0.5f){ // only happens for half the pellets - // Sparks - colory[0] = 0.6; colory[1] = 0.4; colory[2] = 0.0; colory[3] = 1.0; - colory2[0] = 0.7; colory2[1] = 0.4; colory2[2] = 0.0; colory2[3] = 0.9; - colory3[0] = 0.5; colory3[1] = 0.2; colory3[2] = 0.0; colory3[3] = 0.7; - colory4[0] = 0.1; colory4[1] = 0.06; colory4[2] = 0.0; colory4[3] = 0.0; - - VectorMA( origin, 1, dir, sprOrg ); - VectorScale( dir, 1, sprVel ); - - R_LFX_Spark (sprOrg, sprVel, 95, 32, colory, colory2, colory3, colory4, colory4, 3, 440, 0.5f, 1); - sprVel[2] += 64; - R_LFX_Generic - (LFXSMOKE, // Particle Type - sprOrg, // Origin - sprVel, // Velocity - 1.0f, // Starting Alpha - 85, // Spread Factor - 3, // Random Origin Offset - 0, // Random Roll Value - 0, // Additional Random Speed - 8, // Particle Color Red - 8, // Particle Color Green - 8, // Particle Color Blue - 8, // Particle Count - 400, // Particle Life - 0.5f, // Particle Scale - 0.5f, // Particle Scale Towards - 0.1f, // Particle Bounce Factor - 0, // Air Friction (stopping particle velocity in air) - -16.0f, // Particle Gravity Factor - 0.0f, // Particle Rolling Friction - alfball // Particle Shader - ); - } + R_LFX_Generic ( + LFXSMOKE, // Particle Type + sprOrg, // Origin + sprVel, // Velocity + 1.0f, // Starting Alpha + 85, // Spread Factor + 3, // Random Origin Offset + 0, // Random Roll Value + 0, // Additional Random Speed + 8, // Particle Color Red + 8, // Particle Color Green + 8, // Particle Color Blue + 8, // Particle Count + 400, // Particle Life + 0.5f, // Particle Scale + 0.5f, // Particle Scale Towards + 0.1f, // Particle Bounce Factor + 0, // Air Friction (stopping particle velocity in air) + -16.0f, // Particle Gravity Factor + 0.0f, // Particle Rolling Friction + alfball // Particle Shader + ); } + } // Plasma Hit // should become a plain sprite atlas animation. - if (effect == 6) - { + if (effect == 6) { - } + } + else if (effect == 5 || effect == 4 || effect == 11) { + // Grenade/Rocket/Prox Explosion + // should be an explosion atlas + // plus a smoke atlas that comes in later + // plus a few glquake-ish embers + // plus a couple of sparks that shoots off other sparks + } + else if (effect == 9) { + // BFG, could be just a shockwave. - // Grenade/Rocket/Prox Explosion - // should be an explosion atlas - // plus a smoke atlas that comes in later - // plus a few glquake-ish embers - // plus a couple of sparks that shoots off other sparks - else if (effect == 5 || effect == 4 || effect == 11) - { - - - } - - // BFG, could be just a shockwave. - else if (effect == 9) - { - - - } + } // Blood Sprays for bullets // should be a nondirectional splat of a center atlas gush // and then several randomly directed blood drops that roll. all is GE128 - if (effect == 14 && com_blood->integer) - { - colory[0] = 1.0; colory[1] = 0.0; colory[2] = 0.0; colory[3] = 1.0; - colory2[0] = 0.8; colory2[1] = 0.0; colory2[2] = 0.0; colory2[3] = 0.5; - colory3[0] = 0.6; colory3[1] = 0.0; colory3[2] = 0.0; colory3[3] = 0.8; - colory4[0] = 0.3; colory4[1] = 0.0; colory4[2] = 0.0; colory4[3] = 0.0; - //R_LFX_Smoke2 (sprOrg, sprVel, 2 + (random()*6), 6.54+ (random()*8.7), colory, colory2, colory3, colory4, colory4, 1, 800 + (random()*2000), 2, 8+ (random()*6), 0); - //R_LFX_Smoke2 (sprOrg, sprVel, 2 + (random()*6), 3.54+ (random()*8.7), colory, colory2, colory3, colory4, colory4, 1, 300 + (random()*2000), 2, 8+ (random()*6), 4); - } - + if (effect == 14 && com_blood->integer) { + colory[0] = 1.0; colory[1] = 0.0; colory[2] = 0.0; colory[3] = 1.0; + colory2[0] = 0.8; colory2[1] = 0.0; colory2[2] = 0.0; colory2[3] = 0.5; + colory3[0] = 0.6; colory3[1] = 0.0; colory3[2] = 0.0; colory3[3] = 0.8; + colory4[0] = 0.3; colory4[1] = 0.0; colory4[2] = 0.0; colory4[3] = 0.0; + //R_LFX_Smoke2 (sprOrg, sprVel, 2 + (random()*6), 6.54+ (random()*8.7), colory, colory2, colory3, colory4, colory4, 1, 800 + (random()*2000), 2, 8+ (random()*6), 0); + //R_LFX_Smoke2 (sprOrg, sprVel, 2 + (random()*6), 3.54+ (random()*8.7), colory, colory2, colory3, colory4, colory4, 1, 300 + (random()*2000), 2, 8+ (random()*6), 4); + } } // 1999 - a certain competing game @@ -2971,187 +2871,168 @@ void LFX_ParticleEffect1999 (int effect, vec3_t org, vec3_t dir) // Smoke trails on grenades and rockets // this should be several smoke atlases along a line. - if (effect == 1) - { + if (effect == 1) { - } + } // Bullet Hit // a smoke puff, a badly looping spark model, and an occasional ball spark (no stretch) of a random amount from 1 to 6 balls. - if (effect == 2) - { - R_LFX_Generic - (777777, // Particle Type - sprOrg, // Origin - sprVel, // Velocity - 1.0f, // Starting Alpha - 96, // Spread Factor - 4, // Random Origin Offset - 0, // Random Roll Value - 200, // Additional Random Speed - 255, // Particle Color Red - 255, // Particle Color Green - 32, // Particle Color Blue - 5, // Particle Count - 600, // Particle Life - 1, // Particle Scale - 1, // Particle Scale Towards - 0.1f, // Particle Bounce Factor - 0, // Air Friction (stopping particle velocity in air) - -12.0f, // Particle Gravity Factor - 0.0f, // Particle Rolling Friction - addball // Particle Shader - ); - - } + if (effect == 2) { + R_LFX_Generic ( + 777777, // Particle Type + sprOrg, // Origin + sprVel, // Velocity + 1.0f, // Starting Alpha + 96, // Spread Factor + 4, // Random Origin Offset + 0, // Random Roll Value + 200, // Additional Random Speed + 255, // Particle Color Red + 255, // Particle Color Green + 32, // Particle Color Blue + 5, // Particle Count + 600, // Particle Life + 1, // Particle Scale + 1, // Particle Scale Towards + 0.1f, // Particle Bounce Factor + 0, // Air Friction (stopping particle velocity in air) + -12.0f, // Particle Gravity Factor + 0.0f, // Particle Rolling Friction + addball // Particle Shader + ); + } // Shotgun Hit // can be just smoke puffs, preferably atlasy. - if (effect == 3) - { - VectorMA( origin, 8, dir, sprOrg ); - sprVel[2] += 20; - R_LFX_Generic - (LFXSMOKE, // Particle Type - sprOrg, // Origin - sprVel, // Velocity - 1.0f, // Starting Alpha - 0, // Spread Factor - 4, // Random Origin Offset - 0, // Random Roll Value - 0, // Additional Random Speed - 255, // Particle Color Red - 255, // Particle Color Green - 255, // Particle Color Blue - 5, // Particle Count - 1200, // Particle Life - 12, // Particle Scale - 12, // Particle Scale Towards - 0, // Particle Bounce Factor - 0, // Air Friction (stopping particle velocity in air) - 0, // Particle Gravity Factor - 10, // Particle Rolling Friction - addsmoke // Particle Shader - ); - } + if (effect == 3) { + VectorMA( origin, 8, dir, sprOrg ); + sprVel[2] += 20; + R_LFX_Generic ( + LFXSMOKE, // Particle Type + sprOrg, // Origin + sprVel, // Velocity + 1.0f, // Starting Alpha + 0, // Spread Factor + 4, // Random Origin Offset + 0, // Random Roll Value + 0, // Additional Random Speed + 255, // Particle Color Red + 255, // Particle Color Green + 255, // Particle Color Blue + 5, // Particle Count + 1200, // Particle Life + 12, // Particle Scale + 12, // Particle Scale Towards + 0, // Particle Bounce Factor + 0, // Air Friction (stopping particle velocity in air) + 0, // Particle Gravity Factor + 10, // Particle Rolling Friction + addsmoke // Particle Shader + ); + } // Plasma Hit // should become a plain sprite atlas animation. - if (effect == 6) - { + if (effect == 6) { - } + } // Lightning Hit // can become a plain sprite, but we already have that, so..... - if (effect == 8) - { + if (effect == 8) { - } + } + else if (effect == 5 || effect == 4 || effect == 11) { + // Grenade/Rocket/Prox Explosion + // should be an explosion atlas, but on later versions there's several more delayed explosion atlases to spice up the variety - // Grenade/Rocket/Prox Explosion - // should be an explosion atlas, but on later versions there's several more delayed explosion atlases to spice up the variety - else if (effect == 5 || effect == 4 || effect == 11) - { - + } + else if (effect == 9) { + // BFG, could be an expanding sphere with an explosion atlas - } - - // BFG, could be an expanding sphere with an explosion atlas - else if (effect == 9) - { - - - } + } // Blood Sprays for bullets // should be an additive smoke puff that doesn't move (but go through an atlas animation) // as well as a model that has autosprites for ge128 blood sprays, which is kinda cheesy but we can replicate this effect // withi particles anyhow because we're awesome for having a real particle system ha ha ha ha ha - if (effect == 14 && com_blood->integer) - { - VectorMA( origin, 8, dir, sprOrg ); - sprVel[2] = 0; - sprVel[1] = 0; - sprVel[0] = 0; - R_LFX_Generic - (LFXSMOKE, // Particle Type - sprOrg, // Origin - sprVel, // Velocity - 1.0f, // Starting Alpha - 0, // Spread Factor - 4, // Random Origin Offset - 0, // Random Roll Value - 0, // Additional Random Speed - 255, // Particle Color Red - 0, // Particle Color Green - 0, // Particle Color Blue - 1, // Particle Count - 700, // Particle Life - 8, // Particle Scale - 8, // Particle Scale Towards - 0, // Particle Bounce Factor - 0, // Air Friction (stopping particle velocity in air) - 0, // Particle Gravity Factor - 10, // Particle Rolling Friction - addsmoke // Particle Shader - ); + if (effect == 14 && com_blood->integer) { + VectorMA( origin, 8, dir, sprOrg ); + sprVel[2] = 0; + sprVel[1] = 0; + sprVel[0] = 0; + R_LFX_Generic ( + LFXSMOKE, // Particle Type + sprOrg, // Origin + sprVel, // Velocity + 1.0f, // Starting Alpha + 0, // Spread Factor + 4, // Random Origin Offset + 0, // Random Roll Value + 0, // Additional Random Speed + 255, // Particle Color Red + 0, // Particle Color Green + 0, // Particle Color Blue + 1, // Particle Count + 700, // Particle Life + 8, // Particle Scale + 8, // Particle Scale Towards + 0, // Particle Bounce Factor + 0, // Air Friction (stopping particle velocity in air) + 0, // Particle Gravity Factor + 10, // Particle Rolling Friction + addsmoke // Particle Shader + ); - R_LFX_Generic - (LFXSMOKE, // Particle Type - sprOrg, // Origin - sprVel, // Velocity - 1.0f, // Starting Alpha - 96, // Spread Factor - 4, // Random Origin Offset - 0, // Random Roll Value - 200, // Additional Random Speed - 255, // Particle Color Red - 0, // Particle Color Green - 0, // Particle Color Blue - 5, // Particle Count - 600, // Particle Life - 1, // Particle Scale - 1, // Particle Scale Towards - 0.1f, // Particle Bounce Factor - 0, // Air Friction (stopping particle velocity in air) - -12.0f, // Particle Gravity Factor - 0.0f, // Particle Rolling Friction - alfsmoke // Particle Shader - ); - } + R_LFX_Generic ( + LFXSMOKE, // Particle Type + sprOrg, // Origin + sprVel, // Velocity + 1.0f, // Starting Alpha + 96, // Spread Factor + 4, // Random Origin Offset + 0, // Random Roll Value + 200, // Additional Random Speed + 255, // Particle Color Red + 0, // Particle Color Green + 0, // Particle Color Blue + 5, // Particle Count + 600, // Particle Life + 1, // Particle Scale + 1, // Particle Scale Towards + 0.1f, // Particle Bounce Factor + 0, // Air Friction (stopping particle velocity in air) + -12.0f, // Particle Gravity Factor + 0.0f, // Particle Rolling Friction + alfsmoke // Particle Shader + ); + } // "Blood" Sprays for bullets - if (effect == 14 && !com_blood->integer) - { - // not yet. this should be an additive green puff - } + if (effect == 14 && !com_blood->integer) { + // not yet. this should be an additive green puff + } // Blood Spray for a gibbing - if (effect == 16 && com_blood->integer) - { - // not yet. - } + if (effect == 16 && com_blood->integer) { + // not yet. + } // Water Splash for bullets - there should only be a polygonal white ring. but we don't do model drawing right now - if (effect == 19) - { - colory[0] = 1.0; colory[1] = 1.0; colory[2] = 1.0; colory[3] = 1.0; - colory2[0] = 0.7; colory2[1] = 0.7; colory2[2] = 0.7; colory2[3] = 0.6; - colory3[0] = 0.4; colory3[1] = 0.4; colory3[2] = 0.4; colory3[3] = 0.3; - colory4[0] = 0.0; colory4[1] = 0.0; colory4[2] = 0.0; colory4[3] = 0.0; - VectorScale( dir, 39, sprVel ); - R_LFX_Shock (origin, dir, 0, 0, colory, colory2, colory3, colory4, colory4, 1, 800, 80,14); - } - + if (effect == 19) { + colory[0] = 1.0; colory[1] = 1.0; colory[2] = 1.0; colory[3] = 1.0; + colory2[0] = 0.7; colory2[1] = 0.7; colory2[2] = 0.7; colory2[3] = 0.6; + colory3[0] = 0.4; colory3[1] = 0.4; colory3[2] = 0.4; colory3[3] = 0.3; + colory4[0] = 0.0; colory4[1] = 0.0; colory4[2] = 0.0; colory4[3] = 0.0; + VectorScale( dir, 39, sprVel ); + R_LFX_Shock (origin, dir, 0, 0, colory, colory2, colory3, colory4, colory4, 1, 800, 80,14); + } } void LFX_ParticleEffect (int effect, vec3_t org, vec3_t dir) { - - // choosing particle sets if (r_particles->value == 1996) // Mimicing the grand old game @@ -3162,10 +3043,6 @@ void LFX_ParticleEffect (int effect, vec3_t org, vec3_t dir) LFX_ParticleEffect1998(effect, org, dir); else if (r_particles->value == 1999) // Mimicing a certain competing game LFX_ParticleEffect1999(effect, org, dir); - else + else LFX_ParticleEffect200X(effect, org, dir); - } - - -