diff --git a/code/client/snd_codec_xmp.c b/code/client/snd_codec_xmp.c index 60bea85b..2773287a 100644 --- a/code/client/snd_codec_xmp.c +++ b/code/client/snd_codec_xmp.c @@ -35,7 +35,7 @@ int xmpspeed = 22050; // assume 22050hz unless........ -// leilei - XMP +// leilei - XMP xmp_context xmpsong; //int sound_init(int, int); void sound_play(void *, int); @@ -46,13 +46,15 @@ void sound_deinit(void); extern int samplingrate; // from snd_dma -void S_XMP_StartSong ( void ){ - +void S_XMP_StartSong ( void ) +{ + } -void S_XMP_EndSong ( void ){ +void S_XMP_EndSong ( void ) +{ @@ -84,54 +86,53 @@ snd_stream_t *S_XMP_CodecOpenStream(const char *filename) // Open snd_stream_t *rv = S_CodecUtilOpen(filename, &xmp_codec); - if(!rv) + if(!rv) { return NULL; + } // Com_Printf("OPENSTREAM %s\n", filename); - + { - fileHandle_t file; + fileHandle_t file; - // Try to open the file - FS_FOpenFileRead(filename, &file, qtrue); - if(!file) - { - Com_Printf( S_COLOR_RED "ERROR: No.\"%s\"\n",filename); - return NULL; - } + // Try to open the file + FS_FOpenFileRead(filename, &file, qtrue); + if(!file) { + Com_Printf( S_COLOR_RED "ERROR: No.\"%s\"\n",filename); + return NULL; + } - // Allocate some memory - long thelength = FS_ReadFile(filename, NULL); + // Allocate some memory + long thelength = FS_ReadFile(filename, NULL); - void *buffer = Hunk_AllocateTempMemory(thelength); - if(!buffer) - { - FS_FCloseFile(file); - Com_Printf( S_COLOR_RED "ERROR: Out of memory reading \"%s\"\n", filename); - return NULL; - } + void *buffer = Hunk_AllocateTempMemory(thelength); + if(!buffer) { + FS_FCloseFile(file); + Com_Printf( S_COLOR_RED "ERROR: Out of memory reading \"%s\"\n", filename); + return NULL; + } - FS_Read(buffer, thelength, file); + FS_Read(buffer, thelength, file); - // OK! - struct xmp_module_info mi; + // OK! + struct xmp_module_info mi; - xmpsong = xmp_create_context(); - int itsloaded = 0; + xmpsong = xmp_create_context(); + int itsloaded = 0; - itsloaded = xmp_load_module_from_memory(xmpsong, buffer, 0); + itsloaded = xmp_load_module_from_memory(xmpsong, buffer, 0); - // Free our memory and close the file. - Hunk_FreeTempMemory(buffer); - FS_FCloseFile(file); // unfortunately these do not help with the leak + // Free our memory and close the file. + Hunk_FreeTempMemory(buffer); + FS_FCloseFile(file); // unfortunately these do not help with the leak - if (itsloaded == 0) - itsloaded = xmp_start_player(xmpsong, xmpspeed, 0); // TODO: do sample rate of the mixer. - - if (itsloaded == 0){ + if (itsloaded == 0) + itsloaded = xmp_start_player(xmpsong, xmpspeed, 0); // TODO: do sample rate of the mixer. + + if (itsloaded == 0) { // Com_Printf("XMP loaded our buffer of the file %s which is %i long \n", filename, thelength); xmp_get_module_info(xmpsong, &mi); // Com_Printf("Song Name: %s\n", mi.mod->name); @@ -176,15 +177,13 @@ int S_XMP_CodecReadStream(snd_stream_t *stream, int bytes, void *buffer) // buffer handling struct xmp_module_info mi; struct xmp_frame_info fi; - + // check if input is valid - if(!(stream && buffer)) - { + if(!(stream && buffer)) { return 0; } - if(bytes <= 0) - { + if(bytes <= 0) { return 0; } @@ -193,18 +192,16 @@ int S_XMP_CodecReadStream(snd_stream_t *stream, int bytes, void *buffer) char* bufPtr = buffer; // cycle until we have the requested or all available bytes read - while(-1) - { + while(-1) { int yeah=xmp_play_buffer(xmpsong, buffer, bytesLeft, 0); - - if (yeah == 0){ // if we can play it... + + if (yeah == 0) { // if we can play it... xmp_get_frame_info(xmpsong, &fi); int c = fi.buffer_size; // no more bytes are left - if(c <= 0) - { + if(c <= 0) { break; } @@ -214,15 +211,12 @@ int S_XMP_CodecReadStream(snd_stream_t *stream, int bytes, void *buffer) xmp_get_module_info(xmpsong, &mi); // we have enough bytes - if(bytesLeft <= 0) - { + if(bytesLeft <= 0) { break; } } - else // if we can't play it JUST STOP OK - { + else { // if we can't play it JUST STOP OK break; - } } @@ -230,8 +224,7 @@ int S_XMP_CodecReadStream(snd_stream_t *stream, int bytes, void *buffer) } -snd_codec_t xmp_codec = -{ +snd_codec_t xmp_codec = { "umx", S_XMP_CodecLoad, S_XMP_CodecOpenStream, @@ -240,8 +233,7 @@ snd_codec_t xmp_codec = NULL }; -snd_codec_t xmp_mod_codec = -{ +snd_codec_t xmp_mod_codec = { "mod", S_XMP_CodecLoad, S_XMP_CodecOpenStream, @@ -250,8 +242,7 @@ snd_codec_t xmp_mod_codec = NULL }; -snd_codec_t xmp_it_codec = -{ +snd_codec_t xmp_it_codec = { "it", S_XMP_CodecLoad, S_XMP_CodecOpenStream, @@ -260,8 +251,7 @@ snd_codec_t xmp_it_codec = NULL }; -snd_codec_t xmp_s3m_codec = -{ +snd_codec_t xmp_s3m_codec = { "s3m", S_XMP_CodecLoad, S_XMP_CodecOpenStream, @@ -270,8 +260,7 @@ snd_codec_t xmp_s3m_codec = NULL }; -snd_codec_t xmp_xm_codec = -{ +snd_codec_t xmp_xm_codec = { "xm", S_XMP_CodecLoad, S_XMP_CodecOpenStream, diff --git a/code/renderer_oa/tr_bloom.c b/code/renderer_oa/tr_bloom.c index ee643ff0..e4df0b38 100644 --- a/code/renderer_oa/tr_bloom.c +++ b/code/renderer_oa/tr_bloom.c @@ -8,7 +8,7 @@ of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. @@ -18,7 +18,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // tr_bloom.c: General post-processing shader stuff including bloom, leifx, and everything else -// that's postprocessed. Maintained by leilei and Hitchiker +// that's postprocessed. Maintained by leilei and Hitchiker #include "tr_local.h" @@ -68,7 +68,7 @@ static struct { int width, height; } work; - // leilei - motion blur + // leilei - motion blur struct { image_t *texture; int width, height; @@ -136,7 +136,7 @@ static struct { cvar_t *r_film; -extern int force32upload; +extern int force32upload; int leifxmode; int leifxpass; int fakeit = 0; @@ -148,16 +148,15 @@ extern int tvHeight; extern float tvAspectW; // aspect correction extern int vresWidth; extern int vresHeight; -/* -============================================================================== - - LIGHT BLOOMS - -============================================================================== -*/ +/* +============================================================================== -static float Diamond8x[8][8] = -{ + LIGHT BLOOMS + +============================================================================== +*/ + +static float Diamond8x[8][8] = { { 0.0f, 0.0f, 0.0f, 0.1f, 0.1f, 0.0f, 0.0f, 0.0f, }, { 0.0f, 0.0f, 0.2f, 0.3f, 0.3f, 0.2f, 0.0f, 0.0f, }, { 0.0f, 0.2f, 0.4f, 0.6f, 0.6f, 0.4f, 0.2f, 0.0f, }, @@ -169,8 +168,7 @@ static float Diamond8x[8][8] = }; -static float Star8x[8][8] = -{ +static float Star8x[8][8] = { { 0.4f, 0.1f, 0.0f, 0.0f, 0.0f, 0.0f, 0.1f, 0.4f, }, { 0.1f, 0.6f, 0.2f, 0.0f, 0.0f, 0.2f, 0.6f, 0.1f, }, { 0.0f, 0.2f, 0.7f, 0.6f, 0.6f, 0.7f, 0.2f, 0.0f, }, @@ -182,18 +180,16 @@ static float Star8x[8][8] = }; -static float Diamond6x[6][6] = -{ +static float Diamond6x[6][6] = { { 0.0f, 0.0f, 0.1f, 0.1f, 0.0f, 0.0f, }, - { 0.0f, 0.3f, 0.5f, 0.5f, 0.3f, 0.0f, }, + { 0.0f, 0.3f, 0.5f, 0.5f, 0.3f, 0.0f, }, { 0.1f, 0.5f, 0.9f, 0.9f, 0.5f, 0.1f, }, { 0.1f, 0.5f, 0.9f, 0.9f, 0.5f, 0.1f, }, { 0.0f, 0.3f, 0.5f, 0.5f, 0.3f, 0.0f, }, { 0.0f, 0.0f, 0.1f, 0.1f, 0.0f, 0.0f } }; -static float Diamond4x[4][4] = -{ +static float Diamond4x[4][4] = { { 0.3f, 0.4f, 0.4f, 0.3f, }, { 0.4f, 0.9f, 0.9f, 0.4f, }, { 0.4f, 0.9f, 0.9f, 0.4f, }, @@ -224,29 +220,30 @@ static struct { -static void ID_INLINE R_Bloom_Quad( int width, int height, float texX, float texY, float texWidth, float texHeight ) { +static void ID_INLINE R_Bloom_Quad( int width, int height, float texX, float texY, float texWidth, float texHeight ) +{ int x = 0; int y = 0; x = 0; y += glConfig.vidHeight - height; width += x; height += y; - + texWidth += texX; texHeight += texY; - qglBegin( GL_QUADS ); - qglTexCoord2f( texX, texHeight ); + qglBegin( GL_QUADS ); + qglTexCoord2f( texX, texHeight ); qglVertex2f( x, y ); - qglTexCoord2f( texX, texY ); - qglVertex2f( x, height ); + qglTexCoord2f( texX, texY ); + qglVertex2f( x, height ); - qglTexCoord2f( texWidth, texY ); - qglVertex2f( width, height ); + qglTexCoord2f( texWidth, texY ); + qglVertex2f( width, height ); - qglTexCoord2f( texWidth, texHeight ); - qglVertex2f( width, y ); + qglTexCoord2f( texWidth, texHeight ); + qglVertex2f( width, y ); qglEnd (); } @@ -254,7 +251,8 @@ static void ID_INLINE R_Bloom_Quad( int width, int height, float texX, float tex // LEILEI - Bloom Reflection -static void ID_INLINE R_Bloom_Quad_Lens(float offsert, int width, int height, float texX, float texY, float texWidth, float texHeight) { +static void ID_INLINE R_Bloom_Quad_Lens(float offsert, int width, int height, float texX, float texY, float texWidth, float texHeight) +{ int x = 0; int y = 0; x = 0; @@ -265,18 +263,18 @@ static void ID_INLINE R_Bloom_Quad_Lens(float offsert, int width, int height, fl texWidth -= texX; texHeight -= texY; - qglBegin( GL_QUADS ); - qglTexCoord2f( texX, texHeight ); + qglBegin( GL_QUADS ); + qglTexCoord2f( texX, texHeight ); qglVertex2f( width + offsert, height + offsert ); - qglTexCoord2f( texX, texY ); - qglVertex2f( width + offsert, y - offsert); + qglTexCoord2f( texX, texY ); + qglVertex2f( width + offsert, y - offsert); - qglTexCoord2f( texWidth, texY ); - qglVertex2f( x - offsert, y - offsert); + qglTexCoord2f( texWidth, texY ); + qglVertex2f( x - offsert, y - offsert); - qglTexCoord2f( texWidth, texHeight ); - qglVertex2f( x - offsert, height + offsert); + qglTexCoord2f( texWidth, texHeight ); + qglVertex2f( x - offsert, height + offsert); qglEnd (); } @@ -292,37 +290,37 @@ static void R_Bloom_InitTextures( void ) { byte *data; - // find closer power of 2 to screen size - for (bloom.screen.width = 1;bloom.screen.width< glConfig.vidWidth;bloom.screen.width *= 2); - for (bloom.screen.height = 1;bloom.screen.height < glConfig.vidHeight;bloom.screen.height *= 2); + // find closer power of 2 to screen size + for (bloom.screen.width = 1; bloom.screen.width< glConfig.vidWidth; bloom.screen.width *= 2); + for (bloom.screen.height = 1; bloom.screen.height < glConfig.vidHeight; bloom.screen.height *= 2); bloom.screen.readW = glConfig.vidWidth / (float)bloom.screen.width; bloom.screen.readH = glConfig.vidHeight / (float)bloom.screen.height; - // find closer power of 2 to effect size + // find closer power of 2 to effect size bloom.work.width = r_bloom_sample_size->integer; bloom.work.height = bloom.work.width * ( glConfig.vidWidth / glConfig.vidHeight ); - for (bloom.effect.width = 1;bloom.effect.width < bloom.work.width;bloom.effect.width *= 2); - for (bloom.effect.height = 1;bloom.effect.height < bloom.work.height;bloom.effect.height *= 2); + for (bloom.effect.width = 1; bloom.effect.width < bloom.work.width; bloom.effect.width *= 2); + for (bloom.effect.height = 1; bloom.effect.height < bloom.work.height; bloom.effect.height *= 2); bloom.effect.readW = bloom.work.width / (float)bloom.effect.width; bloom.effect.readH = bloom.work.height / (float)bloom.effect.height; - + bloom.effect2.readW=bloom.effect.readW; bloom.effect2.readH=bloom.effect.readH; bloom.effect2.width=bloom.effect.width; bloom.effect2.height=bloom.effect.height; - + // disable blooms if we can't handle a texture of that size if( bloom.screen.width > glConfig.maxTextureSize || - bloom.screen.height > glConfig.maxTextureSize || - bloom.effect.width > glConfig.maxTextureSize || - bloom.effect.height > glConfig.maxTextureSize || - bloom.work.width > glConfig.vidWidth || - bloom.work.height > glConfig.vidHeight - ) { + bloom.screen.height > glConfig.maxTextureSize || + bloom.effect.width > glConfig.maxTextureSize || + bloom.effect.height > glConfig.maxTextureSize || + bloom.work.width > glConfig.vidWidth || + bloom.work.height > glConfig.vidHeight + ) { ri.Cvar_Set( "r_bloom", "0" ); Com_Printf( S_COLOR_YELLOW"WARNING: 'R_InitBloomTextures' too high resolution for light bloom, effect disabled\n" ); return; @@ -369,7 +367,7 @@ static void R_Bloom_DrawEffect( void ) float alpha=r_bloom_alpha->value; GL_Bind( bloom.effect.texture ); GL_State( GLS_DEPTHTEST_DISABLE | GLS_SRCBLEND_ONE | GLS_DSTBLEND_ONE ); - if(r_bloom_cascade->integer){ + if(r_bloom_cascade->integer) { alpha=r_bloom_cascade_alpha->value; } qglColor4f( alpha,alpha,alpha, 1.0f ); @@ -433,7 +431,8 @@ static void R_Bloom_LensEffect( void ) ================= Tcpp: sorry for my poor English skill. */ -static void R_Bloom_Cascaded( void ){ +static void R_Bloom_Cascaded( void ) +{ int scale; int oldWorkW, oldWorkH; int newWorkW, newWorkH; @@ -441,7 +440,7 @@ static void R_Bloom_Cascaded( void ){ float bloomShiftY=r_bloom_cascade_blur->value/(float)bloom.effect.height; float intensity=r_bloom_cascade_intensity->value; float intensity2; - + qglColor4f( 1.0f, 1.0f, 1.0f, 1.0f ); //Take the backup texture and downscale it GL_Bind( bloom.screen.texture ); @@ -450,88 +449,89 @@ static void R_Bloom_Cascaded( void ){ //Copy downscaled framebuffer into a texture GL_Bind( bloom.effect.texture ); qglCopyTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, 0, 0, bloom.work.width, bloom.work.height ); - + /* Copy the result to the effect texture */ GL_Bind( bloom.effect2.texture ); qglCopyTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, 0, 0, bloom.work.width, bloom.work.height ); - + // do blurs.. scale=32; while(bloom.work.width>=1; while(bloom.work.height>=1; - + // prepare the first level. newWorkW=bloom.work.width/scale; newWorkH=bloom.work.height/scale; - + GL_Bind( bloom.effect2.texture ); GL_State( GLS_DEPTHTEST_DISABLE | GLS_SRCBLEND_ONE | GLS_DSTBLEND_ZERO ); intensity2=intensity/(float)scale; qglColor4f( intensity2, intensity2, intensity2, 1.0 ); - R_Bloom_Quad( newWorkW, newWorkH, - 0, 0, - bloom.effect2.readW, bloom.effect2.readH ); - + R_Bloom_Quad( newWorkW, newWorkH, + 0, 0, + bloom.effect2.readW, bloom.effect2.readH ); + // go through levels. - while(scale>1){ + while(scale>1) { float oldScaleInv=1.f/(float)scale; scale>>=1; oldWorkH=newWorkH; oldWorkW=newWorkW; newWorkW=bloom.work.width/scale; newWorkH=bloom.work.height/scale; - + // get effect texture. GL_Bind( bloom.effect.texture ); qglCopyTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, 0, 0, oldWorkW, oldWorkH); - + // maginfy the previous level. - if(r_bloom_cascade_blur->value<.01f){ + if(r_bloom_cascade_blur->value<.01f) { // don't blur. qglColor4f( 1.f, 1.f, 1.f, 1.0 ); GL_State( GLS_DEPTHTEST_DISABLE | GLS_SRCBLEND_ONE | GLS_DSTBLEND_ZERO ); - R_Bloom_Quad( newWorkW, newWorkH, - 0, 0, - bloom.effect.readW*oldScaleInv, bloom.effect.readH*oldScaleInv ); - }else{ + R_Bloom_Quad( newWorkW, newWorkH, + 0, 0, + bloom.effect.readW*oldScaleInv, bloom.effect.readH*oldScaleInv ); + } + else { // blur. qglColor4f( .25f, .25f, .25f, 1.0 ); GL_State( GLS_DEPTHTEST_DISABLE | GLS_SRCBLEND_ONE | GLS_DSTBLEND_ZERO ); - R_Bloom_Quad( newWorkW, newWorkH, - -bloomShiftX, -bloomShiftY, - bloom.effect.readW*oldScaleInv, bloom.effect.readH*oldScaleInv ); - + R_Bloom_Quad( newWorkW, newWorkH, + -bloomShiftX, -bloomShiftY, + bloom.effect.readW*oldScaleInv, bloom.effect.readH*oldScaleInv ); + GL_State( GLS_DEPTHTEST_DISABLE | GLS_SRCBLEND_ONE | GLS_DSTBLEND_ONE ); - R_Bloom_Quad( newWorkW, newWorkH, - bloomShiftX, -bloomShiftY, - bloom.effect.readW*oldScaleInv, bloom.effect.readH*oldScaleInv ); - R_Bloom_Quad( newWorkW, newWorkH, - -bloomShiftX, bloomShiftY, - bloom.effect.readW*oldScaleInv, bloom.effect.readH*oldScaleInv ); - R_Bloom_Quad( newWorkW, newWorkH, - bloomShiftX, bloomShiftY, - bloom.effect.readW*oldScaleInv, bloom.effect.readH*oldScaleInv ); + R_Bloom_Quad( newWorkW, newWorkH, + bloomShiftX, -bloomShiftY, + bloom.effect.readW*oldScaleInv, bloom.effect.readH*oldScaleInv ); + R_Bloom_Quad( newWorkW, newWorkH, + -bloomShiftX, bloomShiftY, + bloom.effect.readW*oldScaleInv, bloom.effect.readH*oldScaleInv ); + R_Bloom_Quad( newWorkW, newWorkH, + bloomShiftX, bloomShiftY, + bloom.effect.readW*oldScaleInv, bloom.effect.readH*oldScaleInv ); } - + // add the input. intensity2=intensity/(float)scale; qglColor4f( intensity2, intensity2, intensity2, 1.0 ); - + GL_State( GLS_DEPTHTEST_DISABLE | GLS_SRCBLEND_ONE | GLS_DSTBLEND_ONE ); GL_Bind( bloom.effect2.texture ); - - R_Bloom_Quad( newWorkW, newWorkH, - 0, 0, - bloom.effect2.readW, bloom.effect2.readH ); - - + + R_Bloom_Quad( newWorkW, newWorkH, + 0, 0, + bloom.effect2.readW, bloom.effect2.readH ); + + } - + GL_Bind( bloom.effect.texture ); qglCopyTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, 0, 0, bloom.work.width, bloom.work.height ); - + } /* @@ -559,9 +559,9 @@ static void R_Bloom_WarsowEffect( void ) GL_State( GLS_DEPTHTEST_DISABLE | GLS_SRCBLEND_DST_COLOR | GLS_DSTBLEND_ZERO ); for( i = 0; i < r_bloom_darken->integer; i++ ) { - R_Bloom_Quad( bloom.work.width, bloom.work.height, - 0, 0, - bloom.effect.readW, bloom.effect.readH ); + R_Bloom_Quad( bloom.work.width, bloom.work.height, + 0, 0, + bloom.effect.readW, bloom.effect.readH ); } qglCopyTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, 0, 0, bloom.work.width, bloom.work.height ); } @@ -575,37 +575,39 @@ static void R_Bloom_WarsowEffect( void ) if( r_bloom_diamond_size->integer > 7 || r_bloom_diamond_size->integer <= 3 ) { if( r_bloom_diamond_size->integer != 8 ) ri.Cvar_Set( "r_bloom_diamond_size", "8" ); - } else if( r_bloom_diamond_size->integer > 5 ) { + } + else if( r_bloom_diamond_size->integer > 5 ) { if( r_bloom_diamond_size->integer != 6 ) ri.Cvar_Set( "r_bloom_diamond_size", "6" ); - } else if( r_bloom_diamond_size->integer > 3 ) { + } + else if( r_bloom_diamond_size->integer > 3 ) { if( r_bloom_diamond_size->integer != 4 ) ri.Cvar_Set( "r_bloom_diamond_size", "4" ); } switch( r_bloom_diamond_size->integer ) { - case 4: - k = 2; - diamond = &Diamond4x[0][0]; - scale = r_bloom_intensity->value * 0.8f; - break; - case 6: - k = 3; - diamond = &Diamond6x[0][0]; - scale = r_bloom_intensity->value * 0.5f; - break; - case 9: - k = 4; - diamond = &Star8x[0][0]; - scale = r_bloom_intensity->value * 0.3f; - break; + case 4: + k = 2; + diamond = &Diamond4x[0][0]; + scale = r_bloom_intensity->value * 0.8f; + break; + case 6: + k = 3; + diamond = &Diamond6x[0][0]; + scale = r_bloom_intensity->value * 0.5f; + break; + case 9: + k = 4; + diamond = &Star8x[0][0]; + scale = r_bloom_intensity->value * 0.3f; + break; - default: - case 8: - k = 4; - diamond = &Diamond8x[0][0]; - scale = r_bloom_intensity->value * 0.3f; - break; + default: + case 8: + k = 4; + diamond = &Diamond8x[0][0]; + scale = r_bloom_intensity->value * 0.3f; + break; } for( i = 0; i < r_bloom_diamond_size->integer; i++ ) { @@ -622,7 +624,7 @@ static void R_Bloom_WarsowEffect( void ) } } qglCopyTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, 0, 0, bloom.work.width, bloom.work.height ); -} +} /* ================= @@ -630,7 +632,8 @@ R_Bloom_BackupScreen Backup the full original screen to a texture for downscaling and later restoration ================= */ -static void R_Bloom_BackupScreen( void ) { +static void R_Bloom_BackupScreen( void ) +{ GL_Bind( bloom.screen.texture ); qglCopyTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, 0, 0, glConfig.vidWidth, glConfig.vidHeight ); } @@ -641,21 +644,23 @@ R_Bloom_RestoreScreen Restore the temporary framebuffer section we used with the backup texture ================= */ -static void R_Bloom_RestoreScreen( void ) { +static void R_Bloom_RestoreScreen( void ) +{ float dry=r_bloom_dry->value; if(r_bloom_cascade->integer) dry=r_bloom_cascade_dry->value; GL_State( GLS_DEPTHTEST_DISABLE | GLS_SRCBLEND_ONE | GLS_DSTBLEND_ZERO ); GL_Bind( bloom.screen.texture ); qglColor4f( dry,dry,dry, 1 ); - if(dry<.99f){ + if(dry<.99f) { R_Bloom_Quad( bloom.screen.width, bloom.screen.height, 0, 0, - 1.f, - 1.f ); - }else{ + 1.f, + 1.f ); + } + else { R_Bloom_Quad( bloom.work.width, bloom.work.height, 0, 0, - bloom.work.width / (float)bloom.screen.width, - bloom.work.height / (float)bloom.screen.height ); + bloom.work.width / (float)bloom.screen.width, + bloom.work.height / (float)bloom.screen.height ); } } /* @@ -666,7 +671,8 @@ Restore the temporary framebuffer section we used with the backup texture */ extern int mpasses; -static void ID_INLINE R_Bloom_QuadTV( int width, int height, float texX, float texY, float texWidth, float texHeight, int aa ) { +static void ID_INLINE R_Bloom_QuadTV( int width, int height, float texX, float texY, float texWidth, float texHeight, int aa ) +{ int x = 0; int y = 0; float aspcenter = 0; @@ -681,93 +687,149 @@ static void ID_INLINE R_Bloom_QuadTV( int width, int height, float texX, float t x = 0; y = 0; - - if (aa == 0){ xaa = 0; yaa = 0; } - if (aa == 1){ xaa = -xpix; yaa = ypix; } - if (aa == 2){ xaa = -xpix; yaa = -ypix; } - if (aa == 3){ xaa = xpix; yaa = -ypix; } - if (aa == 4){ xaa = xpix; yaa = ypix; } + + if (aa == 0) { + xaa = 0; + yaa = 0; + } + if (aa == 1) { + xaa = -xpix; + yaa = ypix; + } + if (aa == 2) { + xaa = -xpix; + yaa = -ypix; + } + if (aa == 3) { + xaa = xpix; + yaa = -ypix; + } + if (aa == 4) { + xaa = xpix; + yaa = ypix; + } //y += tvHeight - height; width += x; height += y; - + texWidth += texX; texHeight += texY; - if (tvAspectW != 1.0){ + if (tvAspectW != 1.0) { aspcenter = tvWidth * ((1.0f - tvAspectW) / 2); // leilei - also do a quad that is 100% black, hiding our actual rendered viewport - // qglViewport (0, 0, tvWidth, tvHeight ); - // qglScissor (0, 0, tvWidth, tvHeight ); - qglBegin( GL_QUADS ); - if (r_tvFilter->integer) // bilinear filter - { - qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR ); - qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); - } - else - { - qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST ); - qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST ); - } - qglColor4f( 0.0, 0.0, 0.0, 1 ); + // qglViewport (0, 0, tvWidth, tvHeight ); + // qglScissor (0, 0, tvWidth, tvHeight ); + qglBegin( GL_QUADS ); + if (r_tvFilter->integer) { // bilinear filter + qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR ); + qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); + } + else { + qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST ); + qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST ); + } + qglColor4f( 0.0, 0.0, 0.0, 1 ); qglVertex2f(0,0 ); - qglVertex2f(0,height); - qglVertex2f(width,height); - qglVertex2f(width,0); + qglVertex2f(0,height); + qglVertex2f(width,height); + qglVertex2f(width,0); qglEnd (); - qglColor4f( 1.0, 1.0, 1.0, 1 ); + qglColor4f( 1.0, 1.0, 1.0, 1 ); } //aspcenter = 0; aspoff = tvWidth * tvAspectW; - if (!aa){ - qglViewport(aspcenter, 0, (tvWidth * tvAspectW), tvHeight ); - qglScissor(aspcenter, 0, (tvWidth * tvAspectW), tvHeight ); + if (!aa) { + qglViewport(aspcenter, 0, (tvWidth * tvAspectW), tvHeight ); + qglScissor(aspcenter, 0, (tvWidth * tvAspectW), tvHeight ); } - qglBegin( GL_QUADS ); + qglBegin( GL_QUADS ); //GL_State( GLS_DEPTHTEST_DISABLE | GLS_SRCBLEND_ONE | GLS_DSTBLEND_ONE ); if (aa) - qglColor4f( 0.25, 0.25, 0.25, 1 ); - qglTexCoord2f( texX + xaa, texHeight + yaa); + qglColor4f( 0.25, 0.25, 0.25, 1 ); + qglTexCoord2f( texX + xaa, texHeight + yaa); qglVertex2f( x, y ); - qglTexCoord2f( texX + xaa, texY + yaa ); - qglVertex2f( x, height ); - qglTexCoord2f( texWidth + xaa, texY + yaa ); - qglVertex2f( width, height ); - qglTexCoord2f( texWidth + xaa, texHeight + yaa ); - qglVertex2f( width, y ); + qglTexCoord2f( texX + xaa, texY + yaa ); + qglVertex2f( x, height ); + qglTexCoord2f( texWidth + xaa, texY + yaa ); + qglVertex2f( width, height ); + qglTexCoord2f( texWidth + xaa, texHeight + yaa ); + qglVertex2f( width, y ); qglEnd (); } -static void R_Bloom_RestoreScreen_Postprocessed( void ) { +static void R_Bloom_RestoreScreen_Postprocessed( void ) +{ #ifdef GLSL_POSTPROCESSING glslProgram_t *program = NULL; if (leifxmode) { - if (leifxmode == 1){ if (vertexShaders) R_GLSL_UseProgram(tr.leiFXDitherProgram); program=tr.programs[tr.leiFXDitherProgram];} - if (leifxmode == 2){ if (vertexShaders) R_GLSL_UseProgram(tr.leiFXGammaProgram); program=tr.programs[tr.leiFXGammaProgram];} - if (leifxmode == 3){ if (vertexShaders) R_GLSL_UseProgram(tr.leiFXFilterProgram); program=tr.programs[tr.leiFXFilterProgram];} - if (leifxmode == 888){ if (vertexShaders) R_GLSL_UseProgram(tr.animeProgram); program=tr.programs[tr.animeProgram];} - if (leifxmode == 999){ if (vertexShaders) R_GLSL_UseProgram(tr.animeFilmProgram); program=tr.programs[tr.animeFilmProgram];} - if (leifxmode == 777){ if (vertexShaders) R_GLSL_UseProgram(tr.motionBlurProgram); program=tr.programs[tr.motionBlurProgram];} - if (leifxmode == 778){ if (vertexShaders) R_GLSL_UseProgram(tr.motionBlurProgram); program=tr.programs[tr.motionBlurProgram];} - if (leifxmode == 779){ if (vertexShaders) R_GLSL_UseProgram(tr.motionBlurPostProgram); program=tr.programs[tr.motionBlurPostProgram];} - if (leifxmode == 632){ if (vertexShaders) R_GLSL_UseProgram(tr.NTSCEncodeProgram); program=tr.programs[tr.NTSCEncodeProgram];} - if (leifxmode == 633){ if (vertexShaders) R_GLSL_UseProgram(tr.NTSCDecodeProgram); program=tr.programs[tr.NTSCDecodeProgram];} - if (leifxmode == 634){ if (vertexShaders) R_GLSL_UseProgram(tr.NTSCBleedProgram); program=tr.programs[tr.NTSCBleedProgram];} - if (leifxmode == 666){ if (vertexShaders) R_GLSL_UseProgram(tr.BrightnessProgram); program=tr.programs[tr.BrightnessProgram];} - if (leifxmode == 1236){ if (vertexShaders) R_GLSL_UseProgram(tr.CRTProgram); program=tr.programs[tr.CRTProgram];} - if (leifxmode == 1997){ if (vertexShaders) R_GLSL_UseProgram(tr.paletteProgram); program=tr.programs[tr.paletteProgram];} - + if (leifxmode == 1) { + if (vertexShaders) R_GLSL_UseProgram(tr.leiFXDitherProgram); + program=tr.programs[tr.leiFXDitherProgram]; + } + if (leifxmode == 2) { + if (vertexShaders) R_GLSL_UseProgram(tr.leiFXGammaProgram); + program=tr.programs[tr.leiFXGammaProgram]; + } + if (leifxmode == 3) { + if (vertexShaders) R_GLSL_UseProgram(tr.leiFXFilterProgram); + program=tr.programs[tr.leiFXFilterProgram]; + } + if (leifxmode == 888) { + if (vertexShaders) R_GLSL_UseProgram(tr.animeProgram); + program=tr.programs[tr.animeProgram]; + } + if (leifxmode == 999) { + if (vertexShaders) R_GLSL_UseProgram(tr.animeFilmProgram); + program=tr.programs[tr.animeFilmProgram]; + } + if (leifxmode == 777) { + if (vertexShaders) R_GLSL_UseProgram(tr.motionBlurProgram); + program=tr.programs[tr.motionBlurProgram]; + } + if (leifxmode == 778) { + if (vertexShaders) R_GLSL_UseProgram(tr.motionBlurProgram); + program=tr.programs[tr.motionBlurProgram]; + } + if (leifxmode == 779) { + if (vertexShaders) R_GLSL_UseProgram(tr.motionBlurPostProgram); + program=tr.programs[tr.motionBlurPostProgram]; + } + if (leifxmode == 632) { + if (vertexShaders) R_GLSL_UseProgram(tr.NTSCEncodeProgram); + program=tr.programs[tr.NTSCEncodeProgram]; + } + if (leifxmode == 633) { + if (vertexShaders) R_GLSL_UseProgram(tr.NTSCDecodeProgram); + program=tr.programs[tr.NTSCDecodeProgram]; + } + if (leifxmode == 634) { + if (vertexShaders) R_GLSL_UseProgram(tr.NTSCBleedProgram); + program=tr.programs[tr.NTSCBleedProgram]; + } + if (leifxmode == 666) { + if (vertexShaders) R_GLSL_UseProgram(tr.BrightnessProgram); + program=tr.programs[tr.BrightnessProgram]; + } + if (leifxmode == 1236) { + if (vertexShaders) R_GLSL_UseProgram(tr.CRTProgram); + program=tr.programs[tr.CRTProgram]; + } + if (leifxmode == 1997) { + if (vertexShaders) R_GLSL_UseProgram(tr.paletteProgram); + program=tr.programs[tr.paletteProgram]; + } + } else { if (vertexShaders) R_GLSL_UseProgram(tr.postprocessingProgram); @@ -802,79 +864,80 @@ static void R_Bloom_RestoreScreen_Postprocessed( void ) { if (program->u_CC_Saturation > -1) R_GLSL_SetUniform_u_CC_Saturation(program, 1.0); if (program->u_CC_Contrast > -1) R_GLSL_SetUniform_u_CC_Contrast(program, 1.0); - // - if (leifxmode == 3){ R_GLSL_SetUniform_u_CC_Brightness(program, leifxpass); } + // + if (leifxmode == 3) { + R_GLSL_SetUniform_u_CC_Brightness(program, leifxpass); + } - if (program->u_zFar > -1) R_GLSL_SetUniform_u_zFar(program, tr.viewParms.zFar); + if (program->u_zFar > -1) R_GLSL_SetUniform_u_zFar(program, tr.viewParms.zFar); GL_SelectTexture(0); GL_State( GLS_DEPTHTEST_DISABLE | GLS_SRCBLEND_ONE | GLS_DSTBLEND_ZERO ); GL_Bind( postproc.screen.texture ); GL_SelectTexture(7); GL_State( GLS_DEPTHTEST_DISABLE | GLS_SRCBLEND_ONE | GLS_DSTBLEND_ZERO ); - GL_Bind( postproc.depth.texture ); + GL_Bind( postproc.depth.texture ); // motion blur crap - if( r_motionblur->integer > 2){ - if (program->u_mpasses > -1) R_GLSL_SetUniform_u_mpasses(program, mpasses); - GL_SelectTexture(2); - GL_State( GLS_DEPTHTEST_DISABLE | GLS_SRCBLEND_ONE | GLS_DSTBLEND_ZERO ); - GL_Bind( postproc.motion1.texture ); - GL_SelectTexture(3); - GL_State( GLS_DEPTHTEST_DISABLE | GLS_SRCBLEND_ONE | GLS_DSTBLEND_ZERO ); - GL_Bind( postproc.motion2.texture ); - GL_SelectTexture(4); - GL_State( GLS_DEPTHTEST_DISABLE | GLS_SRCBLEND_ONE | GLS_DSTBLEND_ZERO ); - GL_Bind( postproc.motion3.texture ); - GL_SelectTexture(5); - GL_State( GLS_DEPTHTEST_DISABLE | GLS_SRCBLEND_ONE | GLS_DSTBLEND_ZERO ); - GL_Bind( postproc.motion4.texture ); - GL_SelectTexture(6); - GL_State( GLS_DEPTHTEST_DISABLE | GLS_SRCBLEND_ONE | GLS_DSTBLEND_ZERO ); - GL_Bind( postproc.motion5.texture ); - GL_SelectTexture(11); - GL_State( GLS_DEPTHTEST_DISABLE | GLS_SRCBLEND_ONE | GLS_DSTBLEND_ZERO ); - GL_Bind( postproc.mpass1.texture ); - GL_SelectTexture(12); - GL_State( GLS_DEPTHTEST_DISABLE | GLS_SRCBLEND_ONE | GLS_DSTBLEND_ZERO ); - GL_Bind( postproc.mpass1.texture ); - GL_SelectTexture(13); - GL_State( GLS_DEPTHTEST_DISABLE | GLS_SRCBLEND_ONE | GLS_DSTBLEND_ZERO ); - GL_Bind( postproc.mpass1.texture ); - GL_SelectTexture(14); - GL_State( GLS_DEPTHTEST_DISABLE | GLS_SRCBLEND_ONE | GLS_DSTBLEND_ZERO ); - GL_Bind( postproc.mpass1.texture ); + if( r_motionblur->integer > 2) { + if (program->u_mpasses > -1) R_GLSL_SetUniform_u_mpasses(program, mpasses); + GL_SelectTexture(2); + GL_State( GLS_DEPTHTEST_DISABLE | GLS_SRCBLEND_ONE | GLS_DSTBLEND_ZERO ); + GL_Bind( postproc.motion1.texture ); + GL_SelectTexture(3); + GL_State( GLS_DEPTHTEST_DISABLE | GLS_SRCBLEND_ONE | GLS_DSTBLEND_ZERO ); + GL_Bind( postproc.motion2.texture ); + GL_SelectTexture(4); + GL_State( GLS_DEPTHTEST_DISABLE | GLS_SRCBLEND_ONE | GLS_DSTBLEND_ZERO ); + GL_Bind( postproc.motion3.texture ); + GL_SelectTexture(5); + GL_State( GLS_DEPTHTEST_DISABLE | GLS_SRCBLEND_ONE | GLS_DSTBLEND_ZERO ); + GL_Bind( postproc.motion4.texture ); + GL_SelectTexture(6); + GL_State( GLS_DEPTHTEST_DISABLE | GLS_SRCBLEND_ONE | GLS_DSTBLEND_ZERO ); + GL_Bind( postproc.motion5.texture ); + GL_SelectTexture(11); + GL_State( GLS_DEPTHTEST_DISABLE | GLS_SRCBLEND_ONE | GLS_DSTBLEND_ZERO ); + GL_Bind( postproc.mpass1.texture ); + GL_SelectTexture(12); + GL_State( GLS_DEPTHTEST_DISABLE | GLS_SRCBLEND_ONE | GLS_DSTBLEND_ZERO ); + GL_Bind( postproc.mpass1.texture ); + GL_SelectTexture(13); + GL_State( GLS_DEPTHTEST_DISABLE | GLS_SRCBLEND_ONE | GLS_DSTBLEND_ZERO ); + GL_Bind( postproc.mpass1.texture ); + GL_SelectTexture(14); + GL_State( GLS_DEPTHTEST_DISABLE | GLS_SRCBLEND_ONE | GLS_DSTBLEND_ZERO ); + GL_Bind( postproc.mpass1.texture ); } qglColor4f( 1, 1, 1, 1 ); // if (leifxmode == 778) // return; - if (leifxmode == 1234){ - { - R_Bloom_QuadTV( glConfig.vidWidth, glConfig.vidHeight, 0, 0, postproc.screen.readW,postproc.screen.readH, 0 ); - } - } - else if (leifxmode == 1236){ - { - R_Bloom_QuadTV( glConfig.vidWidth, glConfig.vidHeight, 0, 0, postproc.screen.readW,postproc.screen.readH, 0 ); - } - } - else if (leifxmode == 1233){ - - - R_Bloom_QuadTV( glConfig.vidWidth, glConfig.vidHeight, 0, 0, postproc.screen.readW,postproc.screen.readH, 1 ); - GL_SelectTexture(0); - GL_State( GLS_DEPTHTEST_DISABLE | GLS_SRCBLEND_ONE | GLS_DSTBLEND_ONE ); - GL_Bind( postproc.screen.texture ); - R_Bloom_QuadTV( glConfig.vidWidth, glConfig.vidHeight, 0, 0, postproc.screen.readW,postproc.screen.readH, 2 ); - R_Bloom_QuadTV( glConfig.vidWidth, glConfig.vidHeight, 0, 0, postproc.screen.readW,postproc.screen.readH, 3 ); - R_Bloom_QuadTV( glConfig.vidWidth, glConfig.vidHeight, 0, 0, postproc.screen.readW,postproc.screen.readH, 4 ); - - } - else + if (leifxmode == 1234) { { - R_Bloom_Quad( glConfig.vidWidth, glConfig.vidHeight, 0, 0, - postproc.screen.readW,postproc.screen.readH ); + R_Bloom_QuadTV( glConfig.vidWidth, glConfig.vidHeight, 0, 0, postproc.screen.readW,postproc.screen.readH, 0 ); } + } + else if (leifxmode == 1236) { + { + R_Bloom_QuadTV( glConfig.vidWidth, glConfig.vidHeight, 0, 0, postproc.screen.readW,postproc.screen.readH, 0 ); + } + } + else if (leifxmode == 1233) { + + + R_Bloom_QuadTV( glConfig.vidWidth, glConfig.vidHeight, 0, 0, postproc.screen.readW,postproc.screen.readH, 1 ); + GL_SelectTexture(0); + GL_State( GLS_DEPTHTEST_DISABLE | GLS_SRCBLEND_ONE | GLS_DSTBLEND_ONE ); + GL_Bind( postproc.screen.texture ); + R_Bloom_QuadTV( glConfig.vidWidth, glConfig.vidHeight, 0, 0, postproc.screen.readW,postproc.screen.readH, 2 ); + R_Bloom_QuadTV( glConfig.vidWidth, glConfig.vidHeight, 0, 0, postproc.screen.readW,postproc.screen.readH, 3 ); + R_Bloom_QuadTV( glConfig.vidWidth, glConfig.vidHeight, 0, 0, postproc.screen.readW,postproc.screen.readH, 4 ); + + } + else { + R_Bloom_Quad( glConfig.vidWidth, glConfig.vidHeight, 0, 0, + postproc.screen.readW,postproc.screen.readH ); + } if (vertexShaders) R_GLSL_UseProgram(0); GL_SelectTexture(0); #endif @@ -904,8 +967,8 @@ Scale the copied screen back to the sample size used for subsequent passes GL_State( GLS_DEPTHTEST_DISABLE | GLS_SRCBLEND_DST_COLOR | GLS_DSTBLEND_ZERO ); for( i = 0; i < r_bloom_darken->integer; i++ ) { - R_Bloom_Quad( bloom.work.width, bloom.work.height, - 0, 0, + R_Bloom_Quad( bloom.work.width, bloom.work.height, + 0, 0, bloom.effect.readW, bloom.effect.readH ); } qglCopyTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, 0, 0, bloom.work.width, bloom.work.height ); @@ -949,8 +1012,8 @@ static void R_Bloom_CreateEffect( void ) { r = 2.0f /(range*2+1)*(1 - x*x/(float)(range*range)); // r *= r_bloom_darken->value; qglColor4f(r, r, r, 1); - R_Bloom_Quad( bloom.work.width, bloom.work.height, - xoffset, yoffset, + R_Bloom_Quad( bloom.work.width, bloom.work.height, + xoffset, yoffset, bloom.effect.readW, bloom.effect.readH ); // bloom.screen.readW, bloom.screen.readH ); GL_State( GLS_DEPTHTEST_DISABLE | GLS_SRCBLEND_ONE | GLS_DSTBLEND_ONE ); @@ -990,10 +1053,10 @@ void R_BloomScreen( void ) qglScissor( 0, 0, glConfig.vidWidth, glConfig.vidHeight ); qglViewport( 0, 0, glConfig.vidWidth, glConfig.vidHeight ); qglMatrixMode( GL_PROJECTION ); - qglLoadIdentity (); + qglLoadIdentity (); qglOrtho( 0, glConfig.vidWidth, glConfig.vidHeight, 0, 0, 1 ); qglMatrixMode( GL_MODELVIEW ); - qglLoadIdentity (); + qglLoadIdentity (); GL_Cull( CT_TWO_SIDED ); #endif @@ -1019,12 +1082,13 @@ void R_BloomScreen( void ) // applied to give a rainbow streak effect. Most effective with high bloom darkness // values. if(r_bloom_reflection->integer) - R_Bloom_LensEffect (); + R_Bloom_LensEffect (); } -void R_BloomInit( void ) { +void R_BloomInit( void ) +{ memset( &bloom, 0, sizeof( bloom )); r_bloom = ri.Cvar_Get( "r_bloom", "0", CVAR_ARCHIVE ); @@ -1069,16 +1133,16 @@ static void R_Postprocess_InitTextures( void ) int intdiv = 1; force32upload = 1; - // find closer power of 2 to screen size - for (postproc.screen.width = 1;postproc.screen.width< glConfig.vidWidth;postproc.screen.width *= 2); + // find closer power of 2 to screen size + for (postproc.screen.width = 1; postproc.screen.width< glConfig.vidWidth; postproc.screen.width *= 2); // if (r_tvMode->integer > 1) // interlaced // for (postproc.screen.height = 1;postproc.screen.height < vidinted;postproc.screen.height *= 2); //else - for (postproc.screen.height = 1;postproc.screen.height < glConfig.vidHeight;postproc.screen.height *= 2); + for (postproc.screen.height = 1; postproc.screen.height < glConfig.vidHeight; postproc.screen.height *= 2); -// if (r_tvMode->integer > 1) +// if (r_tvMode->integer > 1) // intdiv = 2; postproc.screen.readW = glConfig.vidWidth / (float)postproc.screen.width; @@ -1087,12 +1151,12 @@ static void R_Postprocess_InitTextures( void ) - // find closer power of 2 to effect size + // find closer power of 2 to effect size postproc.work.width = r_bloom_sample_size->integer; postproc.work.height = postproc.work.width * ( glConfig.vidWidth / glConfig.vidHeight ); - for (postproc.effect.width = 1;postproc.effect.width < postproc.work.width;postproc.effect.width *= 2); - for (postproc.effect.height = 1;postproc.effect.height < postproc.work.height;postproc.effect.height *= 2); + for (postproc.effect.width = 1; postproc.effect.width < postproc.work.width; postproc.effect.width *= 2); + for (postproc.effect.height = 1; postproc.effect.height < postproc.work.height; postproc.effect.height *= 2); postproc.effect.readW = postproc.work.width / (float)postproc.effect.width; postproc.effect.readH = postproc.work.height / (float)postproc.effect.height; @@ -1102,8 +1166,8 @@ static void R_Postprocess_InitTextures( void ) // disable blooms if we can't handle a texture of that size if( postproc.screen.width > glConfig.maxTextureSize || - postproc.screen.height > glConfig.maxTextureSize - ) { + postproc.screen.height > glConfig.maxTextureSize + ) { ri.Cvar_Set( "r_postprocess", "none" ); Com_Printf( S_COLOR_YELLOW"WARNING: 'R_InitPostprocessTextures' too high resolution for postprocessing, effect disabled\n" ); postprocess=0; @@ -1116,39 +1180,39 @@ static void R_Postprocess_InitTextures( void ) Com_Memset( data, 0, postproc.screen.width * postproc.screen.height * 4 ); postproc.screen.texture = R_CreateImage( "***postproc screen texture***", data, postproc.screen.width, postproc.screen.height, qfalse, qfalse, GL_CLAMP_TO_EDGE ); ri.Hunk_FreeTempMemory( data ); - + // leilei - tv output texture - if (r_tvMode->integer > -1){ - // find closer power of 2 to screen size - for (postproc.tv.width = 1;postproc.tv.width< tvWidth;postproc.tv.width *= 2); - for (postproc.tv.height = 1;postproc.tv.height < tvHeight;postproc.tv.height *= 2); - + if (r_tvMode->integer > -1) { + // find closer power of 2 to screen size + for (postproc.tv.width = 1; postproc.tv.width< tvWidth; postproc.tv.width *= 2); + for (postproc.tv.height = 1; postproc.tv.height < tvHeight; postproc.tv.height *= 2); + //postproc.tv.height /= intdiv; // interlacey - + postproc.tv.readW = tvWidth / (float)postproc.tv.width; postproc.tv.readH = tvHeight / (float)postproc.tv.height; - - // find closer power of 2 to effect size + + // find closer power of 2 to effect size postproc.tvwork.width = r_bloom_sample_size->integer; postproc.tvwork.height = postproc.tvwork.width * ( tvWidth / tvHeight ); - // postproc.tvwork.height /= intdiv; // interlacey - - for (postproc.tveffect.width = 1;postproc.tveffect.width < postproc.tvwork.width;postproc.tveffect.width *= 2) {} + // postproc.tvwork.height /= intdiv; // interlacey + + for (postproc.tveffect.width = 1; postproc.tveffect.width < postproc.tvwork.width; postproc.tveffect.width *= 2) {} if (intdiv > 1) { - for (postproc.tveffect.height = 1;(postproc.tveffect.height/2) < postproc.tvwork.height;postproc.tveffect.height *= 2) {} + for (postproc.tveffect.height = 1; (postproc.tveffect.height/2) < postproc.tvwork.height; postproc.tveffect.height *= 2) {} } else { - for (postproc.tveffect.height = 1;postproc.tveffect.height < postproc.tvwork.height;postproc.tveffect.height *= 2) {} + for (postproc.tveffect.height = 1; postproc.tveffect.height < postproc.tvwork.height; postproc.tveffect.height *= 2) {} } postproc.tveffect.readW = postproc.tvwork.width / (float)postproc.tveffect.width; postproc.tveffect.readH = postproc.tvwork.height / (float)postproc.tveffect.height; - - + + data = ri.Hunk_AllocateTempMemory( tvWidth * tvHeight * 4 ); Com_Memset( data, 0, tvWidth * tvHeight * 4 ); postproc.tv.texture = R_CreateImage( "***tv output screen texture***", data, tvWidth, tvHeight, qfalse, qfalse, GL_CLAMP_TO_EDGE ); @@ -1157,19 +1221,19 @@ static void R_Postprocess_InitTextures( void ) // leilei - motion blur textures! - if (r_motionblur->integer > 2){ - data = ri.Hunk_AllocateTempMemory( postproc.screen.width * postproc.screen.height * 4 ); - Com_Memset( data, 0, postproc.screen.width * postproc.screen.height * 4 ); - postproc.motion1.texture = R_CreateImage( "***motionblur1 texture***", data, postproc.screen.width, postproc.screen.height, qfalse, qfalse, GL_CLAMP_TO_EDGE ); - postproc.motion2.texture = R_CreateImage( "***motionblur2 texture***", data, postproc.screen.width, postproc.screen.height, qfalse, qfalse, GL_CLAMP_TO_EDGE ); - postproc.motion3.texture = R_CreateImage( "***motionblur3 texture***", data, postproc.screen.width, postproc.screen.height, qfalse, qfalse, GL_CLAMP_TO_EDGE ); - postproc.motion4.texture = R_CreateImage( "***motionblur4 texture***", data, postproc.screen.width, postproc.screen.height, qfalse, qfalse, GL_CLAMP_TO_EDGE ); - postproc.motion5.texture = R_CreateImage( "***motionblur5 texture***", data, postproc.screen.width, postproc.screen.height, qfalse, qfalse, GL_CLAMP_TO_EDGE ); - postproc.mpass1.texture = R_CreateImage( "***motionaccum1 texture***", data, postproc.screen.width, postproc.screen.height, qfalse, qfalse, GL_CLAMP_TO_EDGE ); - postproc.mpass2.texture = R_CreateImage( "***motionaccum1 texture***", data, postproc.screen.width, postproc.screen.height, qfalse, qfalse, GL_CLAMP_TO_EDGE ); - postproc.mpass3.texture = R_CreateImage( "***motionaccum1 texture***", data, postproc.screen.width, postproc.screen.height, qfalse, qfalse, GL_CLAMP_TO_EDGE ); - postproc.mpass4.texture = R_CreateImage( "***motionaccum1 texture***", data, postproc.screen.width, postproc.screen.height, qfalse, qfalse, GL_CLAMP_TO_EDGE ); - ri.Hunk_FreeTempMemory( data ); + if (r_motionblur->integer > 2) { + data = ri.Hunk_AllocateTempMemory( postproc.screen.width * postproc.screen.height * 4 ); + Com_Memset( data, 0, postproc.screen.width * postproc.screen.height * 4 ); + postproc.motion1.texture = R_CreateImage( "***motionblur1 texture***", data, postproc.screen.width, postproc.screen.height, qfalse, qfalse, GL_CLAMP_TO_EDGE ); + postproc.motion2.texture = R_CreateImage( "***motionblur2 texture***", data, postproc.screen.width, postproc.screen.height, qfalse, qfalse, GL_CLAMP_TO_EDGE ); + postproc.motion3.texture = R_CreateImage( "***motionblur3 texture***", data, postproc.screen.width, postproc.screen.height, qfalse, qfalse, GL_CLAMP_TO_EDGE ); + postproc.motion4.texture = R_CreateImage( "***motionblur4 texture***", data, postproc.screen.width, postproc.screen.height, qfalse, qfalse, GL_CLAMP_TO_EDGE ); + postproc.motion5.texture = R_CreateImage( "***motionblur5 texture***", data, postproc.screen.width, postproc.screen.height, qfalse, qfalse, GL_CLAMP_TO_EDGE ); + postproc.mpass1.texture = R_CreateImage( "***motionaccum1 texture***", data, postproc.screen.width, postproc.screen.height, qfalse, qfalse, GL_CLAMP_TO_EDGE ); + postproc.mpass2.texture = R_CreateImage( "***motionaccum1 texture***", data, postproc.screen.width, postproc.screen.height, qfalse, qfalse, GL_CLAMP_TO_EDGE ); + postproc.mpass3.texture = R_CreateImage( "***motionaccum1 texture***", data, postproc.screen.width, postproc.screen.height, qfalse, qfalse, GL_CLAMP_TO_EDGE ); + postproc.mpass4.texture = R_CreateImage( "***motionaccum1 texture***", data, postproc.screen.width, postproc.screen.height, qfalse, qfalse, GL_CLAMP_TO_EDGE ); + ri.Hunk_FreeTempMemory( data ); } // GLSL Depth Buffer @@ -1183,7 +1247,7 @@ static void R_Postprocess_InitTextures( void ) postproc.started = qtrue; force32upload = 0; -#endif +#endif } /* @@ -1208,7 +1272,8 @@ R_Postprocess_BackupScreen Backup the full original screen to a texture for downscaling and later restoration ================= */ -static void R_Postprocess_BackupScreen( void ) { +static void R_Postprocess_BackupScreen( void ) +{ #ifdef GLSL_POSTPROCESSING GL_Bind( postproc.screen.texture ); qglCopyTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, 0, 0, glConfig.vidWidth, glConfig.vidHeight ); @@ -1216,7 +1281,7 @@ static void R_Postprocess_BackupScreen( void ) { GL_Bind( postproc.depth.texture ); qglCopyTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, 0, 0, glConfig.vidWidth, glConfig.vidHeight ); -#endif +#endif } @@ -1257,7 +1322,8 @@ void R_PostprocessScreen( void ) -void R_PostprocessingInit(void) { +void R_PostprocessingInit(void) +{ #ifdef GLSL_POSTPROCESSING memset( &postproc, 0, sizeof( postproc )); #endif @@ -1274,30 +1340,31 @@ void R_PostprocessingInit(void) { -static void ID_INLINE R_LeiFX_Pointless_Quad( int width, int height, float texX, float texY, float texWidth, float texHeight ) { +static void ID_INLINE R_LeiFX_Pointless_Quad( int width, int height, float texX, float texY, float texWidth, float texHeight ) +{ int x = 0; int y = 0; x = 0; y += glConfig.vidHeight - height; width += x; height += y; - + texWidth += texX; texHeight += texY; - qglBegin( GL_QUADS ); + qglBegin( GL_QUADS ); - qglTexCoord2f( texX, texHeight ); + qglTexCoord2f( texX, texHeight ); qglVertex2f( x, y ); - qglTexCoord2f( texX, texY ); - qglVertex2f( x, height ); + qglTexCoord2f( texX, texY ); + qglVertex2f( x, height ); - qglTexCoord2f( texWidth, texY ); - qglVertex2f( width, height ); + qglTexCoord2f( texWidth, texY ); + qglVertex2f( width, height ); - qglTexCoord2f( texWidth, texHeight ); - qglVertex2f( width, y ); + qglTexCoord2f( texWidth, texHeight ); + qglVertex2f( width, y ); qglEnd (); } @@ -1336,19 +1403,19 @@ void R_LeiFXPostprocessDitherScreen( void ) // postprocess = 1; leifxmode = 1; - + // The stupidest hack in america R_LeiFX_Stupid_Hack(); - if (r_leifx->integer > 1){ + if (r_leifx->integer > 1) { leifxmode = 1; // reduct and dither - 1 pass R_Postprocess_BackupScreen(); R_Bloom_RestoreScreen_Postprocessed(); } - force32upload = 0; -#endif + force32upload = 0; +#endif } @@ -1377,15 +1444,15 @@ void R_LeiFXPostprocessFilterScreen( void ) // postprocess = 1; -/* if (r_leifx->integer == 3){ - leifxmode = 2; // gamma - 1 pass - // The stupidest hack in america - R_LeiFX_Stupid_Hack(); - R_Postprocess_BackupScreen(); - R_Bloom_RestoreScreen_Postprocessed(); - } -*/ // Gamma disabled because r_alternateBrightness 2 makes it redundant now. - if (r_leifx->integer > 3){ + /* if (r_leifx->integer == 3){ + leifxmode = 2; // gamma - 1 pass + // The stupidest hack in america + R_LeiFX_Stupid_Hack(); + R_Postprocess_BackupScreen(); + R_Bloom_RestoreScreen_Postprocessed(); + } + */ // Gamma disabled because r_alternateBrightness 2 makes it redundant now. + if (r_leifx->integer > 3) { leifxmode = 3; // filter - 4 pass // The stupidest hack in america R_LeiFX_Stupid_Hack(); @@ -1405,7 +1472,7 @@ void R_LeiFXPostprocessFilterScreen( void ) backEnd.doneleifx = qtrue; force32upload = 0; - + #endif } @@ -1448,57 +1515,78 @@ void R_NTSCScreen( void ) int ntsc_decode = 0; // TODO: Switch it up - if (r_ntsc->integer == 1) ntsc_bleed = 1; - else if (r_ntsc->integer == 2){ ntsc_bleed = 1; ntsc_encode = 1; ntsc_decode = 1; } - else if (r_ntsc->integer == 3){ ntsc_bleed = 0; ntsc_encode = 1; ntsc_decode = 1; } - else if (r_ntsc->integer == 4){ ntsc_bleed = 1; ntsc_encode = 1; ntsc_decode = 1; } - else if (r_ntsc->integer > 6){ ntsc_bleed = 666; ntsc_encode = 0; ntsc_decode = 0; } - else { ntsc_bleed = 0; ntsc_encode = 1; ntsc_decode = 0; } - + if (r_ntsc->integer == 1) { + ntsc_bleed = 1; + } + else if (r_ntsc->integer == 2) { + ntsc_bleed = 1; + ntsc_encode = 1; + ntsc_decode = 1; + } + else if (r_ntsc->integer == 3) { + ntsc_bleed = 0; + ntsc_encode = 1; + ntsc_decode = 1; + } + else if (r_ntsc->integer == 4) { + ntsc_bleed = 1; + ntsc_encode = 1; + ntsc_decode = 1; + } + else if (r_ntsc->integer > 6) { + ntsc_bleed = 666; + ntsc_encode = 0; + ntsc_decode = 0; + } + else { + ntsc_bleed = 0; + ntsc_encode = 1; + ntsc_decode = 0; + } + // qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST ); // qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST ); R_LeiFX_Stupid_Hack(); - if (ntsc_encode){ + if (ntsc_encode) { leifxmode = 632; // Encode to composite R_Postprocess_BackupScreen(); R_Bloom_RestoreScreen_Postprocessed(); - } + } - if (ntsc_decode){ + if (ntsc_decode) { leifxmode = 633; // Decode to RGB R_Postprocess_BackupScreen(); R_Bloom_RestoreScreen_Postprocessed(); - } + } - if (ntsc_bleed){ + if (ntsc_bleed) { leifxmode = 634; // Encode to YUV and decode to RGB R_Postprocess_BackupScreen(); R_Bloom_RestoreScreen_Postprocessed(); - } + } - if (ntsc_bleed == 666){ + if (ntsc_bleed == 666) { leifxmode = 634; // Encode to YUV and decode to RGB EXCESSIVELY int passasses = r_ntsc->integer; int j; - for (j=0;jinteger == 1) mode = 1; // force use blend #ifdef GLSL_POSTPROCESSING - if (r_alternateBrightness->integer == 2) - { + if (r_alternateBrightness->integer == 2) { // Automatically determine from capabilities if ( vertexShaders ) { mode = 2; @@ -1573,8 +1661,7 @@ void R_BrightScreen( void ) } // the modern pixel shader way - if (mode == 2) - { + if (mode == 2) { if ( !vertexShaders ) return; // leilei - cards without support for this should not ever activate this @@ -1584,21 +1671,21 @@ void R_BrightScreen( void ) if( !postproc.started ) return; } - + if ( !backEnd.projection2D ) - RB_SetGL2D(); - + RB_SetGL2D(); + force32upload = 1; - + leifxmode = 666; // anime effect - outlines, desat, bloom and other crap to go with it R_LeiFX_Stupid_Hack(); R_Postprocess_BackupScreen(); R_Bloom_RestoreScreen_Postprocessed(); backEnd.doneAltBrightness = qtrue; - + force32upload = 0; - } + } // the fixed function quad blending way else if (mode == 1) @@ -1606,25 +1693,30 @@ void R_BrightScreen( void ) { int eh, ah; if ((r_overBrightBits->integer)) { - + ah = r_overBrightBits->integer; - if (ah < 1) { ah = 1; } - if (ah > 2) { ah = 2; } // clamp so it never looks stupid + if (ah < 1) { + ah = 1; + } + if (ah > 2) { + ah = 2; // clamp so it never looks stupid + } // Blend method // do a loop for every overbright bit enabled for (eh=0; ehambientLight, tone ); - if (backEnd.currentEntity){ - if (backEnd.currentEntity->ambientLight[0] > 0.001f && backEnd.currentEntity->ambientLight[1] > 0.001f && backEnd.currentEntity->ambientLight[2] > 0.001f){ + if (backEnd.currentEntity) { + if (backEnd.currentEntity->ambientLight[0] > 0.001f && backEnd.currentEntity->ambientLight[1] > 0.001f && backEnd.currentEntity->ambientLight[2] > 0.001f) { tone[0] = backEnd.currentEntity->ambientLight[0]; tone[1] = backEnd.currentEntity->ambientLight[1]; tone[2] = backEnd.currentEntity->ambientLight[2]; @@ -1690,38 +1782,50 @@ void R_FilmScreen( void ) toneinv[2] = tone[2] * -1 + 1 + tonecont[2]; // darken vignette. - GL_State( GLS_DEPTHTEST_DISABLE | GLS_SRCBLEND_DST_COLOR | GLS_DSTBLEND_ZERO);GL_Bind( tr.dlightImage ); GL_Cull( CT_TWO_SIDED ); + GL_State( GLS_DEPTHTEST_DISABLE | GLS_SRCBLEND_DST_COLOR | GLS_DSTBLEND_ZERO); + GL_Bind( tr.dlightImage ); + GL_Cull( CT_TWO_SIDED ); qglColor4f( 0.941177, 0.952941, 0.968628, 1.0f ); R_Brighter_Quad( glConfig.vidWidth, glConfig.vidHeight, 0.35f, 0.35f, 0.2f, 0.2f ); // brighten. - GL_State( GLS_DEPTHTEST_DISABLE | GLS_SRCBLEND_DST_COLOR | GLS_DSTBLEND_ONE);GL_Bind( tr.dlightImage ); GL_Cull( CT_TWO_SIDED ); + GL_State( GLS_DEPTHTEST_DISABLE | GLS_SRCBLEND_DST_COLOR | GLS_DSTBLEND_ONE); + GL_Bind( tr.dlightImage ); + GL_Cull( CT_TWO_SIDED ); //qglColor4f( 0.941177, 0.952941, 0.968628, 1.0f ); qglColor4f( (0.9f + (tone[0] * 0.5)), (0.9f + (tone[1] * 0.5)), (0.9f + (tone[2] * 0.5)), 1.0f ); R_Brighter_Quad( glConfig.vidWidth, glConfig.vidHeight, 0.25f, 0.25f, 0.48f, 0.48f ); // invert. - GL_State( GLS_DEPTHTEST_DISABLE | GLS_SRCBLEND_ONE_MINUS_DST_COLOR | GLS_DSTBLEND_ONE_MINUS_SRC_COLOR);GL_Bind( tr.whiteImage ); GL_Cull( CT_TWO_SIDED ); + GL_State( GLS_DEPTHTEST_DISABLE | GLS_SRCBLEND_ONE_MINUS_DST_COLOR | GLS_DSTBLEND_ONE_MINUS_SRC_COLOR); + GL_Bind( tr.whiteImage ); + GL_Cull( CT_TWO_SIDED ); // qglColor4f(0.85098, 0.85098, 0.815686, 1.0f ); qglColor4f( (0.8f + (toneinv[0] * 0.5)), (0.8f + (toneinv[1] * 0.5)), (0.8f + (toneinv[2] * 0.5)), 1.0f ); R_Brighter_Quad( glConfig.vidWidth, glConfig.vidHeight, 0, 0, 1, 1 ); // brighten. - GL_State( GLS_DEPTHTEST_DISABLE | GLS_SRCBLEND_DST_COLOR | GLS_DSTBLEND_SRC_COLOR);GL_Bind( tr.whiteImage ); GL_Cull( CT_TWO_SIDED ); + GL_State( GLS_DEPTHTEST_DISABLE | GLS_SRCBLEND_DST_COLOR | GLS_DSTBLEND_SRC_COLOR); + GL_Bind( tr.whiteImage ); + GL_Cull( CT_TWO_SIDED ); qglColor4f( 0.615686, 0.615686, 0.615686, 1.0f ); R_Brighter_Quad( glConfig.vidWidth, glConfig.vidHeight, 0, 0, 1, 1 ); // invoort. - GL_State( GLS_DEPTHTEST_DISABLE | GLS_SRCBLEND_ONE_MINUS_DST_COLOR | GLS_DSTBLEND_ONE_MINUS_SRC_COLOR);GL_Bind( tr.whiteImage ); GL_Cull( CT_TWO_SIDED ); + GL_State( GLS_DEPTHTEST_DISABLE | GLS_SRCBLEND_ONE_MINUS_DST_COLOR | GLS_DSTBLEND_ONE_MINUS_SRC_COLOR); + GL_Bind( tr.whiteImage ); + GL_Cull( CT_TWO_SIDED ); qglColor4f(1.0f, 1.0f, 1.0f , 1.0f ); R_Brighter_Quad( glConfig.vidWidth, glConfig.vidHeight, 0, 0, 1, 1 ); // brighten. - GL_State( GLS_DEPTHTEST_DISABLE | GLS_SRCBLEND_DST_COLOR | GLS_DSTBLEND_SRC_COLOR);GL_Bind( tr.whiteImage ); GL_Cull( CT_TWO_SIDED ); + GL_State( GLS_DEPTHTEST_DISABLE | GLS_SRCBLEND_DST_COLOR | GLS_DSTBLEND_SRC_COLOR); + GL_Bind( tr.whiteImage ); + GL_Cull( CT_TWO_SIDED ); // qglColor4f( 0.866667, 0.847059, 0.776471, 1.0f ); qglColor4f( (0.73f + (toneinv[0] * 0.4)), (0.73f + (toneinv[1] * 0.4)), (0.73f + (toneinv[2] * 0.4)), 1.0f ); R_Brighter_Quad( glConfig.vidWidth, glConfig.vidHeight, 0, 0, 1, 1 ); @@ -1763,11 +1867,11 @@ void R_RetroAAScreen( void ) //R_Postprocess_BackupScreen(); R_Postprocess_BackupScreen(); R_Bloom_RestoreScreen_Postprocessed(); - + backEnd.doneraa = qtrue; force32upload = 0; - + #endif } @@ -1805,7 +1909,7 @@ void R_AnimeScreen( void ) } if ( !backEnd.projection2D ) - RB_SetGL2D(); + RB_SetGL2D(); force32upload = 1; @@ -1814,13 +1918,13 @@ void R_AnimeScreen( void ) R_Postprocess_BackupScreen(); R_Bloom_RestoreScreen_Postprocessed(); leifxmode = 999; // film effect - to blur things slightly, and add some grain and chroma stuff - R_LeiFX_Stupid_Hack(); + R_LeiFX_Stupid_Hack(); R_Postprocess_BackupScreen(); R_Bloom_RestoreScreen_Postprocessed(); backEnd.doneanime = qtrue; - force32upload = 0; -#endif + force32upload = 0; +#endif } @@ -1838,22 +1942,53 @@ void R_AnimeScreen( void ) // leilei - motion blur hack -void R_MotionBlur_BackupScreen(int which) { +void R_MotionBlur_BackupScreen(int which) +{ #ifdef GLSL_POSTPROCESSING if( r_motionblur->integer < 3) return; - if (which == 1){ GL_Bind( postproc.motion1.texture ); qglCopyTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, 0, 0, glConfig.vidWidth, glConfig.vidHeight ); } // gather thee samples - if (which == 2){ GL_Bind( postproc.motion2.texture ); qglCopyTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, 0, 0, glConfig.vidWidth, glConfig.vidHeight ); } - if (which == 3){ GL_Bind( postproc.motion3.texture ); qglCopyTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, 0, 0, glConfig.vidWidth, glConfig.vidHeight ); } - if (which == 4){ GL_Bind( postproc.motion4.texture ); qglCopyTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, 0, 0, glConfig.vidWidth, glConfig.vidHeight ); } - if (which == 5){ GL_Bind( postproc.motion5.texture ); qglCopyTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, 0, 0, glConfig.vidWidth, glConfig.vidHeight ); } - if (which == 11){ GL_Bind( postproc.mpass1.texture ); qglCopyTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, 0, 0, glConfig.vidWidth, glConfig.vidHeight ); } // to accum - if (which == 12){ GL_Bind( postproc.mpass1.texture ); qglCopyTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, 0, 0, glConfig.vidWidth, glConfig.vidHeight ); } // to accum - if (which == 13){ GL_Bind( postproc.mpass1.texture ); qglCopyTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, 0, 0, glConfig.vidWidth, glConfig.vidHeight ); } // to accum - if (which == 14){ GL_Bind( postproc.mpass1.texture ); qglCopyTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, 0, 0, glConfig.vidWidth, glConfig.vidHeight ); } // to accum - if (which == 18){ GL_Bind( postproc.screen.texture ); qglCopyTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, 0, 0, glConfig.vidWidth, glConfig.vidHeight ); } // to accum -#endif - + if (which == 1) { + GL_Bind( postproc.motion1.texture ); // gather thee samples + qglCopyTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, 0, 0, glConfig.vidWidth, glConfig.vidHeight ); + } + if (which == 2) { + GL_Bind( postproc.motion2.texture ); + qglCopyTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, 0, 0, glConfig.vidWidth, glConfig.vidHeight ); + } + if (which == 3) { + GL_Bind( postproc.motion3.texture ); + qglCopyTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, 0, 0, glConfig.vidWidth, glConfig.vidHeight ); + } + if (which == 4) { + GL_Bind( postproc.motion4.texture ); + qglCopyTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, 0, 0, glConfig.vidWidth, glConfig.vidHeight ); + } + if (which == 5) { + GL_Bind( postproc.motion5.texture ); + qglCopyTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, 0, 0, glConfig.vidWidth, glConfig.vidHeight ); + } + if (which == 11) { + GL_Bind( postproc.mpass1.texture ); // to accum + qglCopyTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, 0, 0, glConfig.vidWidth, glConfig.vidHeight ); + } + if (which == 12) { + GL_Bind( postproc.mpass1.texture ); // to accum + qglCopyTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, 0, 0, glConfig.vidWidth, glConfig.vidHeight ); + } + if (which == 13) { + GL_Bind( postproc.mpass1.texture ); // to accum + qglCopyTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, 0, 0, glConfig.vidWidth, glConfig.vidHeight ); + } + if (which == 14) { + GL_Bind( postproc.mpass1.texture ); // to accum + qglCopyTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, 0, 0, glConfig.vidWidth, glConfig.vidHeight ); + } + if (which == 18) { + GL_Bind( postproc.screen.texture ); // to accum + qglCopyTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, 0, 0, glConfig.vidWidth, glConfig.vidHeight ); + } +#endif + } @@ -1876,10 +2011,10 @@ void R_MblurScreen( void ) } if ( !backEnd.projection2D ) - RB_SetGL2D(); + RB_SetGL2D(); + - force32upload = 1; @@ -1912,7 +2047,7 @@ void R_MblurScreenPost( void ) backEnd.donemblur = qtrue; if ( !backEnd.projection2D ) - RB_SetGL2D(); + RB_SetGL2D(); force32upload = 1; @@ -1932,20 +2067,21 @@ void R_MblurScreenPost( void ) // TV MODE // ================================================================= -static void R_Postprocess_BackupScreenTV( void ) { +static void R_Postprocess_BackupScreenTV( void ) +{ #ifdef GLSL_POSTPROCESSING int intdiv; - intdiv = 1; + intdiv = 1; GL_TexEnv( GL_MODULATE ); qglScissor( 0, 0, glConfig.vidWidth, glConfig.vidHeight ); qglViewport( 0, 0, glConfig.vidWidth, glConfig.vidHeight ); qglMatrixMode( GL_PROJECTION ); - qglLoadIdentity (); + qglLoadIdentity (); qglOrtho( 0, glConfig.vidWidth, glConfig.vidHeight, 0, 0, 1 ); qglMatrixMode( GL_MODELVIEW ); - qglLoadIdentity (); + qglLoadIdentity (); GL_Bind( postproc.screen.texture ); @@ -1953,14 +2089,15 @@ static void R_Postprocess_BackupScreenTV( void ) { #endif } -static void R_Postprocess_ScaleTV( void ) { +static void R_Postprocess_ScaleTV( void ) +{ #ifdef GLSL_POSTPROCESSING GL_TexEnv( GL_MODULATE ); qglScissor( 0, 0, glConfig.vidWidth, glConfig.vidHeight ); qglViewport( 0, 0, glConfig.vidWidth, glConfig.vidHeight ); qglMatrixMode( GL_PROJECTION ); - qglLoadIdentity (); + qglLoadIdentity (); #endif } @@ -1992,15 +2129,15 @@ void R_TVScreen( void ) - force32upload = 1; + force32upload = 1; // postprocess = 1; - if (backEnd.refdef.time > tvtime){ + if (backEnd.refdef.time > tvtime) { tvinterlace *= -1; - tvtime = backEnd.refdef.time + (1000.0f / 60); // 60hz + tvtime = backEnd.refdef.time + (1000.0f / 60); // 60hz } - + tvinter = tvinterlace; if (tvinter < 0) tvinter = 0; if (r_tvMode->integer < 100) tvinter = 0; @@ -2012,23 +2149,21 @@ void R_TVScreen( void ) // leifxmode = 1236; // run it through a shader //R_Postprocess_BackupScreen(); - if (r_tvMode->integer > 100) - { - R_Postprocess_ScaleTV(); + if (r_tvMode->integer > 100) { + R_Postprocess_ScaleTV(); } - else - { - R_Postprocess_BackupScreenTV(); + else { + R_Postprocess_BackupScreenTV(); - R_Bloom_RestoreScreen_Postprocessed(); + R_Bloom_RestoreScreen_Postprocessed(); } - + backEnd.donetv = qtrue; force32upload = 0; #else // NO! -#endif +#endif } @@ -2040,7 +2175,7 @@ void R_TVScreen( void ) // ================================================================= // PALLETIZING // -// Processes the screen into having a 8-bit indexed color +// Processes the screen into having a 8-bit indexed color // palette to suit a throwback mode better // // ================================================================= @@ -2067,7 +2202,7 @@ void R_PaletteScreen( void ) } if ( !backEnd.projection2D ) - RB_SetGL2D(); + RB_SetGL2D(); force32upload = 1; @@ -2078,7 +2213,7 @@ void R_PaletteScreen( void ) backEnd.donepalette = qtrue; force32upload = 0; - + #else // NO! #endif @@ -2112,7 +2247,7 @@ void R_InitWaterTextures( void ) -static void R_Water_BackupScreen( void ) +static void R_Water_BackupScreen( void ) { // NO! } @@ -2120,15 +2255,17 @@ static void R_Water_BackupScreen( void ) static void R_WaterWorks( void ) { // NO! -} - - -static void R_Water_RestoreScreen( void ) { - // NO! } - -void R_WaterInit( void ) { + +static void R_Water_RestoreScreen( void ) +{ + // NO! +} + + +void R_WaterInit( void ) +{ // NO! } diff --git a/code/renderer_oa/tr_particles.c b/code/renderer_oa/tr_particles.c index f28871b1..c9ca01eb 100644 --- a/code/renderer_oa/tr_particles.c +++ b/code/renderer_oa/tr_particles.c @@ -60,8 +60,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #define MAX_TRAIL_POINTS 8 #define TRAIL_LENGTH_SPLIT 64 -typedef struct particle_s -{ +typedef struct particle_s { struct particle_s *next; float time; @@ -169,8 +168,7 @@ static int ramp3[8] = { 0x6d, 0x6b, 6, 5, 4, 3 }; -typedef enum -{ +typedef enum { P_NONE, P_WEATHER, P_FLAT, @@ -227,8 +225,7 @@ static float THEtime; // lazy struct hack to make quake code backporting quicker and painless -typedef struct -{ +typedef struct { double time; } imlazy_t; @@ -244,10 +241,11 @@ static imlazy_t cl; #define pt_fire P_QUAKEFIRE 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 ); + 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, - int skipNumber, int mask ) { + int skipNumber, int mask ) +{ CM_Trace(result, start, end, NULL, NULL, 0, start, mask, 0, NULL); } @@ -266,8 +264,7 @@ void R_ClearParticles (void) free_particles = &particles[0]; active_particles = NULL; - for (i=0 ;ifogNum > 0 && p->fogNum < tr.world->numfogs) - { + if(tr.world && p->fogNum > 0 && p->fogNum < tr.world->numfogs) { tess.numVertexes = 1; VectorCopy(org, tess.xyz[0]); tess.fogNum = p->fogNum; @@ -338,12 +334,13 @@ void R_AddParticleToScene (particle_t *p, vec3_t org, float alpha) vec3_t rr, ru; vec3_t rotate_ang; - if (p->colortype == P_LFX) { + if (p->colortype == P_LFX) { // Ramp // 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 + if (p->startfade > THEtime) { + p->bounce = 0; + p->bubbleit = 0; //no cpu expensive checks return; } @@ -364,7 +361,7 @@ void R_AddParticleToScene (particle_t *p, vec3_t org, float alpha) int et; vec4_t fcol; - for(et=0;et<4;et++) { + for(et=0; et<4; et++) { if (invratio < 0.25f) { fcol[et] = (p->cols[et][3] * inv1) + (p->cols[et][4] * (1 - inv1)); } @@ -378,9 +375,13 @@ void R_AddParticleToScene (particle_t *p, vec3_t org, float alpha) 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]; @@ -636,7 +637,7 @@ void R_AddParticleToScene (particle_t *p, vec3_t org, float alpha) VectorMA( right, -line[0], backEnd.refdef.viewaxis[2], right ); VectorNormalize( right ); - RB_BeginSurface( p->pshader, fogNum ); + RB_BeginSurface( p->pshader, fogNum ); VectorMA( finish, width, right, tess.xyz[tess.numVertexes] ); tess.texCoords[tess.numVertexes][0][0] = 0; @@ -689,7 +690,7 @@ void R_AddParticleToScene (particle_t *p, vec3_t org, float alpha) 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 + // TO RETURN } else { // VP PARALLEL sprite @@ -708,7 +709,8 @@ void R_AddParticleToScene (particle_t *p, vec3_t org, float alpha) if (p->roll) { VectorMA (org, -height, ru, point); VectorMA (point, -width, rr, point); - } else { + } + else { VectorMA (org, -height, pvup, point); VectorMA (point, -width, pvright, point); } @@ -729,7 +731,8 @@ void R_AddParticleToScene (particle_t *p, vec3_t org, float alpha) if (p->roll) { VectorMA (point, 2*height, ru, point); - } else { + } + else { VectorMA (point, 2*height, pvup, point); } VectorCopy (point, tess.xyz[tess.numVertexes] ); @@ -743,7 +746,8 @@ void R_AddParticleToScene (particle_t *p, vec3_t org, float alpha) if (p->roll) { VectorMA (point, 2*width, rr, point); - } else { + } + else { VectorMA (point, 2*width, pvright, point); } VectorCopy (point, tess.xyz[tess.numVertexes] ); @@ -757,7 +761,8 @@ void R_AddParticleToScene (particle_t *p, vec3_t org, float alpha) if (p->roll) { VectorMA (point, -2*height, ru, point); - } else { + } + else { VectorMA (point, -2*height, pvup, point); } VectorCopy (point, tess.xyz[tess.numVertexes] ); @@ -784,7 +789,7 @@ void R_AddParticleToScene (particle_t *p, vec3_t org, float alpha) if (!p->pshader) { - // force a shader. + // force a shader. p->pshader = alfball; return; } @@ -870,7 +875,7 @@ void R_AddParticles (void) p->endwidth= scal; p->bounce = 0; p->bubbleit = 0; - // ri.Printf( PRINT_ALL, "boung!"); + // ri.Printf( PRINT_ALL, "boung!"); p->colortype = P_INDEXED; p->alpha = 1; p->qolor = p->color; @@ -884,7 +889,7 @@ void R_AddParticles (void) - if (p->rendertype != LFXQUAKE){ + 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; @@ -895,58 +900,58 @@ void R_AddParticles (void) p->vel[2] += frametime; int i; switch (p->type) { - case pt_static: - break; - case pt_fire: - p->ramp += time1; - if (p->ramp >= 6) - p->die = -1; - else - p->color = ramp3[(int)p->ramp]; - p->vel[2] += grav; - break; + case pt_static: + break; + case pt_fire: + p->ramp += time1; + if (p->ramp >= 6) + p->die = -1; + else + p->color = ramp3[(int)p->ramp]; + p->vel[2] += grav; + break; - case pt_explode: - p->ramp += time2; - if (p->ramp >=8) - p->die = -1; - else - p->color = ramp1[(int)p->ramp]; - for (i=0 ; i<3 ; i++) - p->vel[i] += p->vel[i]*dvel; - p->vel[2] -= grav; - break; + case pt_explode: + p->ramp += time2; + if (p->ramp >=8) + p->die = -1; + else + p->color = ramp1[(int)p->ramp]; + for (i=0 ; i<3 ; i++) + p->vel[i] += p->vel[i]*dvel; + p->vel[2] -= grav; + break; - case pt_explode2: - p->ramp += time3; - if (p->ramp >=8) - p->die = -1; - else - p->color = ramp2[(int)p->ramp]; - for (i=0 ; i<3 ; i++) - p->vel[i] -= p->vel[i]*frametime; - p->vel[2] -= grav; - break; + case pt_explode2: + p->ramp += time3; + if (p->ramp >=8) + p->die = -1; + else + p->color = ramp2[(int)p->ramp]; + for (i=0 ; i<3 ; i++) + 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_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_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_grav: + p->vel[2] -= grav * 20; + break; - case pt_slowgrav: - p->accel[2] -= grav; - break; + case pt_slowgrav: + p->accel[2] -= grav; + break; } if (THEtime> p->endtime) { @@ -1000,12 +1005,12 @@ void R_AddParticles (void) if (p->rendertype != LFXQUAKE) { if (alpha > 1.0) alpha = 1; - if (p->rollfriction){ + if (p->rollfriction) { f = 1.0f - MINe(p->rollfriction * frametime, 1); p->rollvel *= f; } - if (p->airfriction){ + if (p->airfriction) { f = 1.0f - MINe(p->airfriction * frametime, 1); VectorScale(p->vel, f, p->vel); } @@ -1013,7 +1018,7 @@ void R_AddParticles (void) alpha = p->alpha + time*p->alphavel; // hack to prevent that one long particle from going crazy in the world. - if (p->startfade > THEtime){ + if (p->startfade > THEtime) { p->alpha = -1; // kill it } @@ -1107,17 +1112,25 @@ void R_AddParticles (void) 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->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 ) ) { + if ( contents | ( CONTENTS_WATER | CONTENTS_SLIME ) ) { p->endtime = THEtime; } else { @@ -1137,7 +1150,7 @@ void R_AddParticles (void) // Do the trace of truth P_Trace (&trace, oldorg, NULL, NULL, p->org, -1, CONTENTS_SOLID); { - if (trace.fraction < 1){ + 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 @@ -1227,53 +1240,53 @@ void R_LFX_Blood (vec3_t org, vec3_t dir, float pressure) int count = pressure * 4; particle_t *p; - for (i = 0; i < count; i++) { - if (!free_particles) - return; - p = free_particles; - free_particles = p->next; - p->next = active_particles; - active_particles = p; - p->time = THEtime; - p->bubbleit = 2; // dissolve - p->endtime = THEtime+ (1200 * (crandom() * 22)); - //p->startfade = p->endtime; - //p->color = GREY75; - p->rendertype = LFXSMOKE; - p->alpha = 1.0f; - p->alphavel = 2.0f; - p->height = 1.5; - p->width = 1.5; - p->endheight = 1.5; - p->endwidth = 1.5; + for (i = 0; i < count; i++) { + if (!free_particles) + return; + p = free_particles; + free_particles = p->next; + p->next = active_particles; + active_particles = p; + p->time = THEtime; + p->bubbleit = 2; // dissolve + p->endtime = THEtime+ (1200 * (crandom() * 22)); + //p->startfade = p->endtime; + //p->color = GREY75; + p->rendertype = LFXSMOKE; + p->alpha = 1.0f; + p->alphavel = 2.0f; + p->height = 1.5; + p->width = 1.5; + p->endheight = 1.5; + p->endwidth = 1.5; - p->cols[0][0] = p->cols[0][1] = p->cols[0][2] = p->cols[0][3] = p->cols[0][4] = 1.0; - p->cols[1][0] = p->cols[1][1] = p->cols[1][2] = p->cols[1][3] = p->cols[1][4] = 0.0; - p->cols[2][0] = p->cols[2][1] = p->cols[2][2] = p->cols[2][3] = p->cols[2][4] = 0.0; + p->cols[0][0] = p->cols[0][1] = p->cols[0][2] = p->cols[0][3] = p->cols[0][4] = 1.0; + p->cols[1][0] = p->cols[1][1] = p->cols[1][2] = p->cols[1][3] = p->cols[1][4] = 0.0; + p->cols[2][0] = p->cols[2][1] = p->cols[2][2] = p->cols[2][3] = p->cols[2][4] = 0.0; - // Manage blending Functions - p->pshader = addsmoke; + // Manage blending Functions + p->pshader = addsmoke; - p->colortype = P_LFX; + p->colortype = P_LFX; - VectorCopy(org, p->org); - p->bounce = 1.1f; - for (j = 0; j < 3; j++) { - //p->org[j] = org[j] + ((rand() & (count/8)) - (count/16)); - p->org[j] = org[j] + ((crandom() * (count/16)) - (count/32)); - p->vel[j] = dir[j] * (i * 2.6); + VectorCopy(org, p->org); + p->bounce = 1.1f; + for (j = 0; j < 3; j++) { + //p->org[j] = org[j] + ((rand() & (count/8)) - (count/16)); + p->org[j] = org[j] + ((crandom() * (count/16)) - (count/32)); + p->vel[j] = dir[j] * (i * 2.6); - p->vel[j] *= 0.01; - } + p->vel[j] *= 0.01; + } - p->accel[0] = p->accel[1] = p->accel[2] = 0; - p->accel[2] = -(PARTICLE_GRAVITY*8); + p->accel[0] = p->accel[1] = p->accel[2] = 0; + p->accel[2] = -(PARTICLE_GRAVITY*8); - 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[2] += (i / 5); + 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[2] += (i / 5); // } @@ -1291,85 +1304,85 @@ void R_LFX_Smoke (vec3_t org, vec3_t dir, float spread, float speed, vec4_t colo cont = (44 / (count / 2 + 1)) + 1; - 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; + 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->endtime = THEtime+ duration; + p->startfade = THEtime; - p->rendertype = LFXSMOKE; - p->alpha = 0.1f; - p->alphavel = 0.0f; - p->height = p->width = 1.0 * (count / 3); - p->bubbleit = 0; - p->endheight = p->height + scaleup; - p->endwidth = p->width + scaleup; + p->rendertype = LFXSMOKE; + p->alpha = 0.1f; + p->alphavel = 0.0f; + p->height = p->width = 1.0 * (count / 3); + p->bubbleit = 0; + p->endheight = p->height + scaleup; + p->endwidth = p->width + scaleup; - // Manage random roll and - p->rotate = qtrue; - p->roll = crandom()*179; + // Manage random roll and + p->rotate = qtrue; + p->roll = crandom()*179; - 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][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[1][1] = color2[1]; - p->cols[2][1] = color2[2]; - p->cols[3][1] = color2[3]; + 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[1][2] = color3[1]; - p->cols[2][2] = color3[2]; - p->cols[3][2] = color3[3]; + 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[1][3] = color4[1]; - p->cols[2][3] = color4[2]; - p->cols[3][3] = color4[3]; + 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[1][4] = color5[1]; - p->cols[2][4] = color5[2]; - p->cols[3][4] = color5[3]; + p->cols[0][4] = color5[0]; + p->cols[1][4] = color5[1]; + p->cols[2][4] = color5[2]; + p->cols[3][4] = color5[3]; - // Manage blending Functions - if (blendfunc == 1) - p->pshader = addsmoke; - else if (blendfunc == 2) - p->pshader = modsmoke; - else if (blendfunc == 3) - p->pshader = subsmoke; - else if (blendfunc == 8) - p->pshader = fireball; - else - p->pshader = alfsmoke; + // Manage blending Functions + if (blendfunc == 1) + p->pshader = addsmoke; + else if (blendfunc == 2) + p->pshader = modsmoke; + else if (blendfunc == 3) + p->pshader = subsmoke; + else if (blendfunc == 8) + p->pshader = fireball; + else + p->pshader = alfsmoke; - p->colortype = P_LFX; + p->colortype = P_LFX; - VectorCopy(org, p->org); + VectorCopy(org, p->org); - // Manage spread of origin and velocity - for (j = 0; j < 3; j++) { - //p->org[j] = org[j] + ((crandom() * (spread / 8)) - (spread/16)); - p->org[j] = org[j]; + // Manage spread of origin and velocity + for (j = 0; j < 3; j++) { + //p->org[j] = org[j] + ((crandom() * (spread / 8)) - (spread/16)); + p->org[j] = org[j]; - p->vel[j] = (crandom() * dir[j]) * speed; - p->vel[j] += ((crandom() * (spread)) - (spread/2)); + p->vel[j] = (crandom() * dir[j]) * speed; + p->vel[j] += ((crandom() * (spread)) - (spread/2)); } - p->airfriction = 1.6f; - p->bounce = 1.7f; - p->rollvel = crandom() * 40 - 20; - p->rollfriction = 0.7; + p->airfriction = 1.6f; + p->bounce = 1.7f; + p->rollvel = crandom() * 40 - 20; + p->rollfriction = 0.7; } } @@ -1386,100 +1399,100 @@ void R_LFX_Smoke2 (vec3_t org, vec3_t dir, float spread, float speed, vec4_t col 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; + 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 = 1; - p->rendertype = LFXSMOKE; - p->alpha = 0.1f; - p->alphavel = 0.0f; - p->height = p->width = (1.0 * scale); + p->endtime = THEtime+ duration; + p->startfade = THEtime; + p->bubbleit = 1; + p->rendertype = LFXSMOKE; + p->alpha = 0.1f; + 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; - // Manage random roll and - p->rotate = qtrue; - p->roll = crandom()*179; + // Manage random roll and + p->rotate = qtrue; + p->roll = crandom()*179; - 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][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[1][1] = color2[1]; - p->cols[2][1] = color2[2]; - p->cols[3][1] = color2[3]; + 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[1][2] = color3[1]; - p->cols[2][2] = color3[2]; - p->cols[3][2] = color3[3]; + 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[1][3] = color4[1]; - p->cols[2][3] = color4[2]; - p->cols[3][3] = color4[3]; + 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[1][4] = color5[1]; - p->cols[2][4] = color5[2]; - p->cols[3][4] = color5[3]; + p->cols[0][4] = color5[0]; + p->cols[1][4] = color5[1]; + p->cols[2][4] = color5[2]; + p->cols[3][4] = color5[3]; - if (blendfunc == 1) - p->pshader = addsmoke; - else if (blendfunc == 2) - p->pshader = modsmoke; - else if (blendfunc == 3) - p->pshader = subsmoke; - else if (blendfunc == 8) - p->pshader = fireball; - else - p->pshader = alfsmoke; + if (blendfunc == 1) + p->pshader = addsmoke; + else if (blendfunc == 2) + p->pshader = modsmoke; + else if (blendfunc == 3) + p->pshader = subsmoke; + else if (blendfunc == 8) + p->pshader = fireball; + else + p->pshader = alfsmoke; - p->colortype = P_LFX; + p->colortype = P_LFX; - VectorCopy(org, p->org); -/* - // Manage spread of origin and velocity - for (j = 0; j < 3; j++) { - //p->org[j] = org[j] + ((crandom() * (spread / 8)) - (spread/16)); - p->org[j] = org[j]; + VectorCopy(org, p->org); + /* + // Manage spread of origin and velocity + for (j = 0; j < 3; j++) { + //p->org[j] = org[j] + ((crandom() * (spread / 8)) - (spread/16)); + p->org[j] = org[j]; - p->vel[j] = (crandom() * dir[j]) * speed; - p->vel[j] += ((crandom() * (spread)) - (spread/2)); - } + p->vel[j] = (crandom() * dir[j]) * speed; + p->vel[j] += ((crandom() * (spread)) - (spread/2)); + } - } -*/ - // Manage spread of origin and velocity - for (j = 0; j < 3; j++) { - 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)); + } + */ + // Manage spread of origin and velocity + for (j = 0; j < 3; j++) { + 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->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 = 2; - p->airfriction = 3.7f; - p->accel[2] = (PARTICLE_GRAVITY*1.3); - p->bounce = 3.5f; + //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 = 2; + p->airfriction = 3.7f; + p->accel[2] = (PARTICLE_GRAVITY*1.3); + p->bounce = 3.5f; - p->bounce = 0.0f; // bounce is slow... + p->bounce = 0.0f; // bounce is slow... } } @@ -1490,105 +1503,105 @@ void R_LFX_Shock (vec3_t org, vec3_t dir, float spread, float speed, vec4_t colo particle_t *p; - for (i = 0; i < count; i++) { - if (!free_particles) - return; - p = free_particles; - free_particles = p->next; - p->next = active_particles; - active_particles = p; - p->time = THEtime; + for (i = 0; i < count; 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; - p->rendertype = LFXSHOCK; + 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; - //p->qolor = (color & ~7) + (rand() & 7); - p->height = p->width = 1.0 * (count / 3); + p->alpha = 0.1f; + p->alphavel = 0.0f; + //p->qolor = (color & ~7) + (rand() & 7); + p->height = p->width = 1.0 * (count / 3); - p->endheight = p->height + scaleup; - p->endwidth = p->width + scaleup; + p->endheight = p->height + scaleup; + p->endwidth = p->width + scaleup; - // Manage random roll and - p->rotate = qtrue; - //p->rotate = qtrue; - p->roll = crandom()*179; - //p->roll = rand()%179; + // 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[1][0] = color1[1]; - p->cols[2][0] = color1[2]; - p->cols[3][0] = color1[3]; + 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[1][1] = color2[1]; - p->cols[2][1] = color2[2]; - p->cols[3][1] = color2[3]; + 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[1][2] = color3[1]; - p->cols[2][2] = color3[2]; - p->cols[3][2] = color3[3]; + 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[1][3] = color4[1]; - p->cols[2][3] = color4[2]; - p->cols[3][3] = color4[3]; + 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[1][4] = color5[1]; - p->cols[2][4] = color5[2]; - p->cols[3][4] = color5[3]; + p->cols[0][4] = color5[0]; + p->cols[1][4] = color5[1]; + p->cols[2][4] = color5[2]; + p->cols[3][4] = color5[3]; - // Manage blending Functions - if (blendfunc == 1) - p->pshader = addshock; - else if (blendfunc == 2) - p->pshader = modshock; - else if (blendfunc == 14) - p->pshader = watsplash; - else if (blendfunc == 3) - p->pshader = subshock; - else + // Manage blending Functions + if (blendfunc == 1) + p->pshader = addshock; + else if (blendfunc == 2) + p->pshader = modshock; + else if (blendfunc == 14) + p->pshader = watsplash; + else if (blendfunc == 3) + p->pshader = subshock; + else - p->pshader = alfshock; - p->colortype = P_LFX; + p->pshader = alfshock; + p->colortype = P_LFX; - VectorCopy(org, p->org); + VectorCopy(org, p->org); - // Manage spread of origin and velocity - for (j = 0; j < 3; j++) { - //p->org[j] = org[j] + ((crandom() * (spread / 8)) - (spread/16)); - p->org[j] = org[j]; + // Manage spread of origin and velocity + for (j = 0; j < 3; j++) { + //p->org[j] = org[j] + ((crandom() * (spread / 8)) - (spread/16)); + p->org[j] = org[j]; - p->vel[j] = (crandom() * dir[j]) * speed; - p->vel[j] += ((crandom() * (spread)) - (spread/2)); + p->vel[j] = (crandom() * dir[j]) * speed; + p->vel[j] += ((crandom() * (spread)) - (spread/2)); } - // Manage the Air Friction hack. + // Manage the Air Friction hack. - // for (j = 0; j < 3; j++) { - // p->accel[j] = (p->vel[j] * -1); - // } + // for (j = 0; j < 3; j++) { + // p->accel[j] = (p->vel[j] * -1); + // } - //p->accel[0] = p->accel[1] = p->accel[2] = 0; - //p->accel[2] = -(PARTICLE_GRAVITY / 2); + //p->accel[0] = p->accel[1] = p->accel[2] = 0; + //p->accel[2] = -(PARTICLE_GRAVITY / 2); - p->airfriction = 0; + p->airfriction = 0; } } @@ -1601,123 +1614,123 @@ void R_LFX_Spark (vec3_t org, vec3_t dir, float spread, float speed, vec4_t colo cont = count; - 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; + 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->endtime = THEtime+ duration; + p->startfade = THEtime; - p->rendertype = LFXSPARK; - //p->color = EMISIVEFADE; - p->alpha = 1.0f; - p->alphavel = 0.0f; - //p->qolor = (color & ~7) + (rand() & 7); - p->height = p->width = scaleup; + p->rendertype = LFXSPARK; + //p->color = EMISIVEFADE; + p->alpha = 1.0f; + p->alphavel = 0.0f; + //p->qolor = (color & ~7) + (rand() & 7); + p->height = p->width = scaleup; - p->endheight = p->height; - p->endwidth = p->width; + p->endheight = p->height; + p->endwidth = p->width; - p->rotate = qfalse; // sparks don't rotate - p->roll = 0; // sparks don't roll + 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->accel[0] = p->accel[1] = p->accel[2] = 0; - p->bubbleit = 1; + p->bubbleit = 1; - 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][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[1][1] = color2[1]; - p->cols[2][1] = color2[2]; - p->cols[3][1] = color2[3]; + 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[1][2] = color3[1]; - p->cols[2][2] = color3[2]; - p->cols[3][2] = color3[3]; + 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[1][3] = color4[1]; - p->cols[2][3] = color4[2]; - p->cols[3][3] = color4[3]; + 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[1][4] = color5[1]; - p->cols[2][4] = color5[2]; - p->cols[3][4] = color5[3]; + p->cols[0][4] = color5[0]; + p->cols[1][4] = color5[1]; + p->cols[2][4] = color5[2]; + p->cols[3][4] = color5[3]; - // Manage blending Functions - if (blendfunc == 1) - p->pshader = addball; - else if (blendfunc == 2) - p->pshader = modball; - else if (blendfunc == 3) - p->pshader = subball; - else if (blendfunc == 666) - p->pshader = blood1; - else - p->pshader = alfball; + // Manage blending Functions + if (blendfunc == 1) + p->pshader = addball; + else if (blendfunc == 2) + p->pshader = modball; + else if (blendfunc == 3) + p->pshader = subball; + else if (blendfunc == 666) + p->pshader = blood1; + else + p->pshader = alfball; - //p->pshader = cgs.media.whiteShader; + //p->pshader = cgs.media.whiteShader; // - p->colortype = P_LFX; + p->colortype = P_LFX; - VectorCopy(org, p->org); + VectorCopy(org, p->org); - // Manage spread of origin and velocity - for (j = 0; j < 3; j++) { - 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)); + // Manage spread of origin and velocity + for (j = 0; j < 3; j++) { + 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)); } -/* - for (j = 0; j < 3; j++) { - float sped = speed * (1 + crandom()) + (speed * 0.3f); - //p->org[j] = org[j] + ((crandom() * (spread / 8)) - (spread/16)); - p->org[j] = org[j]; + /* + for (j = 0; j < 3; j++) { + float sped = speed * (1 + crandom()) + (speed * 0.3f); + //p->org[j] = org[j] + ((crandom() * (spread / 8)) - (spread/16)); + p->org[j] = org[j]; - p->vel[j] = (dir[j]) * sped; - p->vel[j] += ((crandom() * (spread)) - (spread/2)); + p->vel[j] = (dir[j]) * sped; + p->vel[j] += ((crandom() * (spread)) - (spread/2)); - // p->vel[j] *= crandom(); + // p->vel[j] *= crandom(); - } -*/ + } + */ // a little kick up 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. + p->accel[0] = p->accel[1] = p->accel[2] = 0; + p->accel[2] = -(800 * 0.5f); // TODO: insert proper gravity. - // prepare the initial stretch frame + // prepare the initial stretch frame - p->airfriction = 1.6f; - p->bounce = 1.6f; - if (blendfunc == 666){ - p->bounce = 666; // instantly make a red decal and kill itself. for blood - p->accel[2] = -(800); // TODO: insert proper gravity. - } + p->airfriction = 1.6f; + p->bounce = 1.6f; + if (blendfunc == 666) { + p->bounce = 666; // instantly make a red decal and kill itself. for blood + p->accel[2] = -(800); // TODO: insert proper gravity. + } } // VectorCopy(p->org,p->torg[0]); // a org to stretch from. @@ -1734,107 +1747,107 @@ void R_LFX_Burst (vec3_t org, vec3_t dir, float spread, float speed, vec4_t colo cont = count; - for (i = 0; i < cont; i++) { - if (!free_particles) - return; - p = free_particles; - free_particles = p->next; - p->next = active_particles; - active_particles = p; + 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->time = THEtime; - p->endtime = THEtime+ duration; - p->startfade = THEtime; + p->endtime = THEtime+ duration; + p->startfade = THEtime; - p->rendertype = LFXBURST; - //p->color = EMISIVEFADE; - p->alpha = 1.0f; - p->alphavel = 0.0f; - //p->qolor = (color & ~7) + (rand() & 7); - p->height = p->width = scaleup; + p->rendertype = LFXBURST; + //p->color = EMISIVEFADE; + p->alpha = 1.0f; + p->alphavel = 0.0f; + //p->qolor = (color & ~7) + (rand() & 7); + p->height = p->width = scaleup; - p->endheight = p->height; - p->endwidth = p->width; + p->endheight = p->height; + p->endwidth = p->width; - p->rotate = qfalse; // sparks don't rotate - p->roll = 0; // sparks don't roll + 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->accel[0] = p->accel[1] = p->accel[2] = 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][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[1][1] = color2[1]; - p->cols[2][1] = color2[2]; - p->cols[3][1] = color2[3]; + 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[1][2] = color3[1]; - p->cols[2][2] = color3[2]; - p->cols[3][2] = color3[3]; + 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[1][3] = color4[1]; - p->cols[2][3] = color4[2]; - p->cols[3][3] = color4[3]; + 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[1][4] = color5[1]; - p->cols[2][4] = color5[2]; - p->cols[3][4] = color5[3]; + p->cols[0][4] = color5[0]; + p->cols[1][4] = color5[1]; + p->cols[2][4] = color5[2]; + p->cols[3][4] = color5[3]; - // Manage blending Functions - if (blendfunc == 1) - p->pshader = addball; - else if (blendfunc == 2) - p->pshader = modball; - else if (blendfunc == 3) - p->pshader = subball; - else if (blendfunc == 7) - p->pshader = watburst; - else if (blendfunc == 666) - p->pshader = blood2; - else - p->pshader = alfball; + // Manage blending Functions + if (blendfunc == 1) + p->pshader = addball; + else if (blendfunc == 2) + p->pshader = modball; + else if (blendfunc == 3) + p->pshader = subball; + else if (blendfunc == 7) + p->pshader = watburst; + else if (blendfunc == 666) + p->pshader = blood2; + else + p->pshader = alfball; - p->colortype = P_LFX; + p->colortype = P_LFX; - VectorCopy(org, p->org); + VectorCopy(org, p->org); - // Manage spread of origin and velocity - for (j = 0; j < 3; j++) { - float sped = speed * (1 + crandom()) + (speed * 0.3f); - p->vel[j] = ((crandom() * (spread)) - (spread/2)) / 360; - p->vel[j] *= sped; + // Manage spread of origin and velocity + for (j = 0; j < 3; j++) { + float sped = speed * (1 + crandom()) + (speed * 0.3f); + p->vel[j] = ((crandom() * (spread)) - (spread/2)) / 360; + p->vel[j] *= sped; } - p->accel[0] = p->accel[1] = p->accel[2] = 0; + p->accel[0] = p->accel[1] = p->accel[2] = 0; - // prepare the initial stretch frame + // prepare the initial stretch frame - p->airfriction = 1.6f; - //p->bounce = 2.0f; - VectorCopy(p->org,p->torg[0]); // a org to stretch from. + p->airfriction = 1.6f; + //p->bounce = 2.0f; + VectorCopy(p->org,p->torg[0]); // a org to stretch from. - if (blendfunc == 666){ + if (blendfunc == 666) { p->airfriction = 2.9f; - // p->bounce = 1.3f; + // p->bounce = 1.3f; p->accel[2] = -(PARTICLE_GRAVITY/2); } - // for water splashes - if (blendfunc == 7){ + // for water splashes + if (blendfunc == 7) { p->airfriction = 1.8f; p->bounce = 0.0f; p->vel[0] = dir[0]; @@ -1993,21 +2006,20 @@ void R_RunParticleEffect (vec3_t org, vec3_t dir, int color, int count) int i, j; particle_t *p; - for (i = 0; i < count; i++) { - if (!free_particles) - return; - p = free_particles; - free_particles = p->next; - p->next = active_particles; - active_particles = p; - p->die = cl.time + 0.1*(rand()%5); - p->color = (color&~7) + (rand()&7); - p->type = pt_slowgrav; - for (j=0 ; j<3 ; j++) - { - p->org[j] = org[j] + ((rand()&15)-8); - p->vel[j] = dir[j]*15;// + (rand()%300)-150; - } + for (i = 0; i < count; i++) { + if (!free_particles) + return; + p = free_particles; + free_particles = p->next; + p->next = active_particles; + active_particles = p; + p->die = cl.time + 0.1*(rand()%5); + p->color = (color&~7) + (rand()&7); + p->type = pt_slowgrav; + for (j=0 ; j<3 ; j++) { + p->org[j] = org[j] + ((rand()&15)-8); + p->vel[j] = dir[j]*15;// + (rand()%300)-150; + } } } @@ -2016,54 +2028,55 @@ void R_RunParticleEffect (vec3_t org, vec3_t dir, int color, int count) void R_QarticleExplosion(vec3_t org) { - int i, j; - particle_t *p; + int i, j; + particle_t *p; - for (i = 0; i < 512; i++) { - if (!free_particles) - return; - p = free_particles; - free_particles = p->next; - p->next = active_particles; - active_particles = p; + for (i = 0; i < 512; i++) { + if (!free_particles) + return; + p = free_particles; + free_particles = p->next; + p->next = active_particles; + active_particles = p; - p->rendertype = EMISIVEFADE; - p->alpha = 1.0f; - p->alphavel = 1.0f; - p->time = THEtime; + p->rendertype = EMISIVEFADE; + p->alpha = 1.0f; + p->alphavel = 1.0f; + p->time = THEtime; - p->bubbleit = 0; - // crap for q3's particle system... - p->endtime = THEtime+ 500; - p->startfade = p->endtime; - p->height = 0.5; - p->width = 0.5; - p->endheight = 0.5; - p->endwidth = 0.5; - p->pshader = alfsmoke; - p->qolor = ramp1[0]; + p->bubbleit = 0; + // crap for q3's particle system... + p->endtime = THEtime+ 500; + p->startfade = p->endtime; + p->height = 0.5; + p->width = 0.5; + p->endheight = 0.5; + p->endwidth = 0.5; + p->pshader = alfsmoke; + p->qolor = ramp1[0]; // p->qolor = 44; - VectorCopy(org, p->org); + VectorCopy(org, p->org); - p->ramp = rand() & 3; - if (i & 1) { + p->ramp = rand() & 3; + if (i & 1) { // p->type = P_QUAKE; - for (j = 0; j < 3; j++) { - p->org[j] = org[j] + ((rand() % 32) - 16); - p->vel[j] = (rand() % 512) - 256; - p->accel[j] = p->vel[j] * 4; - } - } else { + for (j = 0; j < 3; j++) { + p->org[j] = org[j] + ((rand() % 32) - 16); + p->vel[j] = (rand() % 512) - 256; + p->accel[j] = p->vel[j] * 4; + } + } + else { // p->type = P_QUAKE; - for (j = 0; j < 3; j++) { - p->org[j] = org[j] + ((rand() % 32) - 16); - p->vel[j] = (rand() % 512) - 256; - p->accel[j] = p->vel[j] * 4; - } + for (j = 0; j < 3; j++) { + p->org[j] = org[j] + ((rand() % 32) - 16); + p->vel[j] = (rand() % 512) - 256; + p->accel[j] = p->vel[j] * 4; + } + } } - } } @@ -2072,8 +2085,7 @@ void Q_ParticleExplosion (vec3_t org) int i, j; particle_t *p; - for (i=0 ; i<1024 ; i++) - { + for (i=0 ; i<1024 ; i++) { if (!free_particles) return; p = free_particles; @@ -2084,20 +2096,16 @@ void Q_ParticleExplosion (vec3_t org) p->die = cl.time + 5; p->color = ramp1[0]; p->ramp = rand()&3; - if (i & 1) - { + if (i & 1) { p->type = pt_explode; - for (j=0 ; j<3 ; j++) - { + for (j=0 ; j<3 ; j++) { p->org[j] = org[j] + ((rand()%32)-16); p->vel[j] = (rand()%512)-256; } } - else - { + else { p->type = pt_explode2; - for (j=0 ; j<3 ; j++) - { + for (j=0 ; j<3 ; j++) { p->org[j] = org[j] + ((rand()%32)-16); p->vel[j] = (rand()%512)-256; } @@ -2118,14 +2126,12 @@ void Q_RocketTrail (vec3_t start, vec3_t end, int type) len = VectorNormalize (vec); if (type < 128) dec = 3; - else - { + else { dec = 1; type -= 128; } - while (len > 0) - { + while (len > 0) { len -= dec; if (!free_particles) @@ -2138,70 +2144,67 @@ void Q_RocketTrail (vec3_t start, vec3_t end, int type) VectorCopy (vec3_origin, p->vel); p->die = cl.time + 2; - switch (type) - { - case 0: // rocket trail - p->ramp = (rand()&3); - p->qolor = ramp3[(int)p->ramp]; - p->type = pt_fire; - for (j=0 ; j<3 ; j++) - p->org[j] = start[j] + ((rand()%6)-3); - break; + switch (type) { + case 0: // rocket trail + p->ramp = (rand()&3); + p->qolor = ramp3[(int)p->ramp]; + p->type = pt_fire; + for (j=0 ; j<3 ; j++) + p->org[j] = start[j] + ((rand()%6)-3); + break; - case 1: // smoke smoke - p->ramp = (rand()&3) + 2; - p->color = ramp3[(int)p->ramp]; - p->type = pt_fire; - for (j=0 ; j<3 ; j++) - p->org[j] = start[j] + ((rand()%6)-3); - break; + case 1: // smoke smoke + p->ramp = (rand()&3) + 2; + p->color = ramp3[(int)p->ramp]; + p->type = pt_fire; + for (j=0 ; j<3 ; j++) + p->org[j] = start[j] + ((rand()%6)-3); + break; - case 2: // blood - p->type = pt_grav; - p->color = 67 + (rand()&3); - for (j=0 ; j<3 ; j++) - p->org[j] = start[j] + ((rand()%6)-3); - break; + case 2: // blood + p->type = pt_grav; + p->color = 67 + (rand()&3); + for (j=0 ; j<3 ; j++) + p->org[j] = start[j] + ((rand()%6)-3); + break; - case 3: - case 5: // tracer - p->die = cl.time + 0.5; - p->type = pt_static; - if (type == 3) - p->color = 52 + ((tracercount&4)<<1); - else - p->color = 230 + ((tracercount&4)<<1); + case 3: + case 5: // tracer + p->die = cl.time + 0.5; + p->type = pt_static; + if (type == 3) + p->color = 52 + ((tracercount&4)<<1); + else + p->color = 230 + ((tracercount&4)<<1); - tracercount++; + tracercount++; - VectorCopy (start, p->org); - if (tracercount & 1) - { - p->vel[0] = 30*vec[1]; - p->vel[1] = 30*-vec[0]; - } - else - { - p->vel[0] = 30*-vec[1]; - p->vel[1] = 30*vec[0]; - } - break; + VectorCopy (start, p->org); + if (tracercount & 1) { + p->vel[0] = 30*vec[1]; + p->vel[1] = 30*-vec[0]; + } + else { + p->vel[0] = 30*-vec[1]; + p->vel[1] = 30*vec[0]; + } + break; - case 4: // slight blood - p->type = pt_grav; - p->color = 67 + (rand()&3); - for (j=0 ; j<3 ; j++) - p->org[j] = start[j] + ((rand()%6)-3); - len -= 3; - break; + case 4: // slight blood + p->type = pt_grav; + p->color = 67 + (rand()&3); + for (j=0 ; j<3 ; j++) + p->org[j] = start[j] + ((rand()%6)-3); + len -= 3; + break; - case 6: // voor trail - p->color = 9*16 + 8 + (rand()&3); - p->type = pt_static; - p->die = cl.time + 0.3; - for (j=0 ; j<3 ; j++) - p->org[j] = start[j] + ((rand()&15)-8); - break; + case 6: // voor trail + p->color = 9*16 + 8 + (rand()&3); + p->type = pt_static; + p->die = cl.time + 0.3; + for (j=0 ; j<3 ; j++) + p->org[j] = start[j] + ((rand()&15)-8); + break; } @@ -2248,39 +2251,34 @@ void LFX_ParticleEffect1996 (int effect, vec3_t org, vec3_t dir) vec3_t notatall; // Smoke trails on grenades and rockets - if (effect == 1) - { - R_RunParticleEffect (org, notatall, 10, 8); - //Q_RocketTrail(org, dir, r_leidebug->integer); - } + if (effect == 1) { + R_RunParticleEffect (org, notatall, 10, 8); + //Q_RocketTrail(org, dir, r_leidebug->integer); + } // Bullet Hit - if (effect == 2 || effect == 3) - { - R_RunParticleEffect (org, notatall, 6, 20); + if (effect == 2 || effect == 3) { + R_RunParticleEffect (org, notatall, 6, 20); - } + } // Grenade/Rocket/Prox Explosion - else if (effect == 5 || effect == 4 || effect == 11) - { - Q_ParticleExplosion(org); + else if (effect == 5 || effect == 4 || effect == 11) { + Q_ParticleExplosion(org); - } + } // Blood Sprays for bullets - if (effect == 14) - { + if (effect == 14) { R_RunParticleEffect (org, dir,21, 20); - } + } // Water Splash for bullets - if (effect == 19) - { + if (effect == 19) { R_RunParticleEffect (org, dir,41, 20); - } + } } @@ -2299,170 +2297,332 @@ void LFX_ParticleEffect200X (int effect, vec3_t org, vec3_t dir) VectorCopy(dir, sprVel); // Smoke trails on grenades and rockets - if (effect == 1) - { - colory[0] = 0.7; colory[1] = 0.7; colory[2] = 0.7; colory[3] = 1.0; - colory2[0] = 0.5; colory2[1] = 0.5; colory2[2] = 0.5; colory2[3] = 0.8; - colory3[0] = 0.5; colory3[1] = 0.4; colory3[2] = 0.3; colory3[3] = 0.5; - colory4[0] = 0.5; colory4[1] = 0.4; colory4[2] = 0.3; colory4[3] = 0.0; - R_LFX_Smoke2 (sprOrg, sprVel, 1 + (random()*3), 0.54+ (random()*8.7), colory, colory2, colory3, colory4, colory4, 1, 2470, 4, 8+ (random()*6), 4); - } + if (effect == 1) { + colory[0] = 0.7; + colory[1] = 0.7; + colory[2] = 0.7; + colory[3] = 1.0; + colory2[0] = 0.5; + colory2[1] = 0.5; + colory2[2] = 0.5; + colory2[3] = 0.8; + colory3[0] = 0.5; + colory3[1] = 0.4; + colory3[2] = 0.3; + colory3[3] = 0.5; + colory4[0] = 0.5; + colory4[1] = 0.4; + colory4[2] = 0.3; + colory4[3] = 0.0; + R_LFX_Smoke2 (sprOrg, sprVel, 1 + (random()*3), 0.54+ (random()*8.7), colory, colory2, colory3, colory4, colory4, 1, 2470, 4, 8+ (random()*6), 4); + } // Bullet Hit - if (effect == 2) - { - 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; + if (effect == 2) { + 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, 4, dir, sprOrg ); VectorScale( dir, 1, sprVel ); - // 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; + // 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; - R_LFX_Burst (sprOrg, sprVel, 8366, 2, colory, colory2, colory3, colory4, colory4, 4, 50, 2, 1); + R_LFX_Burst (sprOrg, sprVel, 8366, 2, colory, colory2, colory3, colory4, colory4, 4, 50, 2, 1); - VectorMA( origin, 1, dir, sprOrg ); - VectorScale( dir, 1, sprVel ); - R_LFX_Spark (sprOrg, sprVel, 95, 325, colory, colory2, colory3, colory4, colory4, 5, 140, 0.5f, 1); - R_LFX_Spark (sprOrg, sprVel, 95, 85, colory, colory2, colory3, colory4, colory4, 1, 1540, 0.5f, 1); + VectorMA( origin, 1, dir, sprOrg ); + VectorScale( dir, 1, sprVel ); + R_LFX_Spark (sprOrg, sprVel, 95, 325, colory, colory2, colory3, colory4, colory4, 5, 140, 0.5f, 1); + R_LFX_Spark (sprOrg, sprVel, 95, 85, colory, colory2, colory3, colory4, colory4, 1, 1540, 0.5f, 1); - //R_LFX_PushSmoke (sprOrg, 44); + //R_LFX_PushSmoke (sprOrg, 44); - } + } // Shotgun Hit - if (effect == 3) - { - 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), 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); - colory[0] = 0.9; colory[1] = 0.8; colory[2] = 1.0; colory[3] = 1.0; - colory2[0] = 0.7; colory2[1] = 0.5; colory2[2] = 0.2; colory2[3] = 0.9; - colory3[0] = 0.1; colory3[1] = 0.1; 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 (origin, dir, 0, 32, colory, colory2, colory3, colory4, colory4, 1, 200, 50,1); - 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, 1, dir, sprOrg ); - VectorScale( dir, 1, sprVel ); - R_LFX_Spark (sprOrg, sprVel, 25, 85, colory, colory2, colory3, colory4, colory4, 3, 2540, 0.5f, 1); - } + if (effect == 3) { + 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), 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); + colory[0] = 0.9; + colory[1] = 0.8; + colory[2] = 1.0; + colory[3] = 1.0; + colory2[0] = 0.7; + colory2[1] = 0.5; + colory2[2] = 0.2; + colory2[3] = 0.9; + colory3[0] = 0.1; + colory3[1] = 0.1; + 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 (origin, dir, 0, 32, colory, colory2, colory3, colory4, colory4, 1, 200, 50,1); + 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, 1, dir, sprOrg ); + VectorScale( dir, 1, sprVel ); + R_LFX_Spark (sprOrg, sprVel, 25, 85, colory, colory2, colory3, colory4, colory4, 3, 2540, 0.5f, 1); + } // Plasma Hit - if (effect == 6) - { - colory[0] = 1.0; colory[1] = 0.7; 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.1; colory3[1] = 0.2; colory3[2] = 0.6; colory3[3] = 0.8; - colory4[0] = 0.0; colory4[1] = 0.0; colory4[2] = 0.0; colory4[3] = 0.0; - VectorMA( origin, 1, dir, sprOrg ); - VectorScale( dir, 7, sprVel ); - 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); - VectorMA( origin, 2, dir, sprOrg ); - VectorScale( dir, 64, sprVel ); - R_LFX_Shock (sprOrg, dir, 0, 0, colory, colory2, colory3, colory4, colory4, 1,600, 80,1); - VectorMA( origin, 1, dir, sprOrg ); - VectorScale( dir, 1, sprVel ); - R_LFX_Spark (sprOrg, sprVel, 25, 85, colory, colory2, colory3, colory4, colory4, 5, 5540, 0.5f, 1); - } + if (effect == 6) { + colory[0] = 1.0; + colory[1] = 0.7; + 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.1; + colory3[1] = 0.2; + colory3[2] = 0.6; + colory3[3] = 0.8; + colory4[0] = 0.0; + colory4[1] = 0.0; + colory4[2] = 0.0; + colory4[3] = 0.0; + VectorMA( origin, 1, dir, sprOrg ); + VectorScale( dir, 7, sprVel ); + 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); + VectorMA( origin, 2, dir, sprOrg ); + VectorScale( dir, 64, sprVel ); + R_LFX_Shock (sprOrg, dir, 0, 0, colory, colory2, colory3, colory4, colory4, 1,600, 80,1); + VectorMA( origin, 1, dir, sprOrg ); + VectorScale( dir, 1, sprVel ); + R_LFX_Spark (sprOrg, sprVel, 25, 85, colory, colory2, colory3, colory4, colory4, 5, 5540, 0.5f, 1); + } // Lightning Hit - if (effect == 8) - { - 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 == 8) { + 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); + } // Grenade/Rocket/Prox Explosion - else if (effect == 5 || effect == 4 || effect == 11) - { + 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 ); + 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); + R_LFX_Shock (sprOrg, dir, 0, 0, colory, colory2, colory3, colory4, colory4, 1, 500, 270, 1); - // fireball + // 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 ); + 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); + 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; + 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, 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, 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); + 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 ); + // 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; - colory4[0] = 0.0; colory4[1] = 0.0; colory4[2] = 0.0; colory4[3] = 0.0; - R_LFX_Smoke (sprOrg, sprVel, 3, 0.7, colory, colory2, colory3, colory4, colory4, 22, 300,135, 8); + 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; + colory4[0] = 0.0; + colory4[1] = 0.0; + colory4[2] = 0.0; + colory4[3] = 0.0; + R_LFX_Smoke (sprOrg, sprVel, 3, 0.7, colory, colory2, colory3, colory4, colory4, 22, 300,135, 8); - // Sparks! + // 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 ); + 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_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); + 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; + 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 ); @@ -2502,18 +2662,42 @@ void LFX_ParticleEffect200X (int effect, vec3_t org, vec3_t dir) // 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; + 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; + 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 ); @@ -2529,100 +2713,156 @@ void LFX_ParticleEffect200X (int effect, vec3_t org, vec3_t dir) } // Blood Sprays for bullets - if (effect == 14 && com_blood->integer) - { - sprVel[2] += 54; - 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); - R_LFX_Burst (sprOrg, sprVel, 175, 15, colory, colory2, colory3, colory4, colory4, 2, 1755, 12, 666); - VectorMA( origin, 1, dir, sprOrg ); - VectorScale( dir, 2, sprVel ); - //R_LFX_Spark (sprOrg, sprVel, 25, 85, colory, colory2, colory3, colory4, colory4, 8, 2386, 0.5f, 666); - } + if (effect == 14 && com_blood->integer) { + sprVel[2] += 54; + 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); + R_LFX_Burst (sprOrg, sprVel, 175, 15, colory, colory2, colory3, colory4, colory4, 2, 1755, 12, 666); + VectorMA( origin, 1, dir, sprOrg ); + VectorScale( dir, 2, sprVel ); + //R_LFX_Spark (sprOrg, sprVel, 25, 85, colory, colory2, colory3, colory4, colory4, 8, 2386, 0.5f, 666); + } // "Blood" Sprays for bullets - if (effect == 14 && !com_blood->integer) - { + if (effect == 14 && !com_blood->integer) { - // nonviolent blue center - colory[0] = 0.0; colory[1] = 0.7; colory[2] = 1.0; colory[3] = 0.0; - colory2[0] = 0.0; colory2[1] = 0.0; colory2[2] = 1.0; colory2[3] = 0.5; - colory3[0] = 0.0; colory3[1] = 0.0; colory3[2] = 0.6; colory3[3] = 0.8; - colory4[0] = 0.0; colory4[1] = 0.0; colory4[2] = 0.0; colory4[3] = 0.0; - R_LFX_Burst (sprOrg, sprVel, 175, 15, colory, colory2, colory3, colory4, colory4, 2, 105, 12, 1); - R_LFX_Smoke (sprOrg, sprVel, 0, 0, colory, colory2, colory3, colory4, colory4, 32, 400, -33, 1); - VectorMA( origin, 1, dir, sprOrg ); - VectorScale( dir, 1, sprVel ); + // nonviolent blue center + colory[0] = 0.0; + colory[1] = 0.7; + colory[2] = 1.0; + colory[3] = 0.0; + colory2[0] = 0.0; + colory2[1] = 0.0; + colory2[2] = 1.0; + colory2[3] = 0.5; + colory3[0] = 0.0; + colory3[1] = 0.0; + colory3[2] = 0.6; + colory3[3] = 0.8; + colory4[0] = 0.0; + colory4[1] = 0.0; + colory4[2] = 0.0; + colory4[3] = 0.0; + R_LFX_Burst (sprOrg, sprVel, 175, 15, colory, colory2, colory3, colory4, colory4, 2, 105, 12, 1); + R_LFX_Smoke (sprOrg, sprVel, 0, 0, colory, colory2, colory3, colory4, colory4, 32, 400, -33, 1); + VectorMA( origin, 1, dir, sprOrg ); + VectorScale( dir, 1, sprVel ); - 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; + 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; - R_LFX_Spark (sprOrg, sprVel, 25, 85, colory, colory2, colory3, colory4, colory4, 2,586, 0.5f, 1); - R_LFX_Shock (origin, dir, 0, 0, colory, colory2, colory3, colory4, colory4, 1, 255, 39,1); - } + R_LFX_Spark (sprOrg, sprVel, 25, 85, colory, colory2, colory3, colory4, colory4, 2,586, 0.5f, 1); + R_LFX_Shock (origin, dir, 0, 0, colory, colory2, colory3, colory4, colory4, 1, 255, 39,1); + } // Blood Spray for a gibbing - if (effect == 16 && com_blood->integer) - { - sprVel[2] += 124; - 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; + if (effect == 16 && com_blood->integer) { + sprVel[2] += 124; + 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); - R_LFX_Burst (sprOrg, sprVel, 275, 4, colory, colory2, colory3, colory4, colory4, 9, 1455, 42, 666); - } + R_LFX_Burst (sprOrg, sprVel, 275, 4, colory, colory2, colory3, colory4, colory4, 9, 1455, 42, 666); + } // Water Splash for bullets - if (effect == 19) - { - colory[0] = 1.0; colory[1] = 1.0; colory[2] = 1.0; colory[3] = 1.0; - colory2[0] = 0.3; colory2[1] = 0.5; colory2[2] = 0.6; colory2[3] = 0.6; - colory3[0] = 0.1; colory3[1] = 0.2; colory3[2] = 0.3; 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); - R_LFX_Burst (sprOrg, sprVel, 22, 266, colory, colory2, colory3, colory4, colory4, 1, 1900, 5, 7); - R_LFX_Spark (sprOrg, sprVel, 134, 4, colory, colory2, colory3, colory4, colory4, 7, 1286, 0.5f, 1); - } -/* - // these are not properly implemented through cgame yet as they call *every* frame instead of being a truly one shot effect. - // muzzieflash plasmagun - if (effect == 66) - { - colory[0] = 1.0; colory[1] = 1.0; colory[2] = 1.0; colory[3] = 1.0; - colory2[0] = 0.3; colory2[1] = 0.5; colory2[2] = 0.6; colory2[3] = 0.5; - colory3[0] = 0.1; colory3[1] = 0.2; colory3[2] = 0.3; colory3[3] = 0.8; - 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, 255, 8,1); - //R_LFX_Burst (sprOrg, sprVel, 22, 266, colory, colory2, colory3, colory4, colory4, 1, 144, 2, 7); - //R_LFX_Spark (sprOrg, sprVel, 134, 4, colory, colory2, colory3, colory4, colory4, 7, 1556, 0.25f, 1); - } - // muzzleflash shotgun - if (effect == 63) - { - 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; + if (effect == 19) { + colory[0] = 1.0; + colory[1] = 1.0; + colory[2] = 1.0; + colory[3] = 1.0; + colory2[0] = 0.3; + colory2[1] = 0.5; + colory2[2] = 0.6; + colory2[3] = 0.6; + colory3[0] = 0.1; + colory3[1] = 0.2; + colory3[2] = 0.3; + 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); + R_LFX_Burst (sprOrg, sprVel, 22, 266, colory, colory2, colory3, colory4, colory4, 1, 1900, 5, 7); + R_LFX_Spark (sprOrg, sprVel, 134, 4, colory, colory2, colory3, colory4, colory4, 7, 1286, 0.5f, 1); + } + /* + // these are not properly implemented through cgame yet as they call *every* frame instead of being a truly one shot effect. + // muzzieflash plasmagun + if (effect == 66) + { + colory[0] = 1.0; colory[1] = 1.0; colory[2] = 1.0; colory[3] = 1.0; + colory2[0] = 0.3; colory2[1] = 0.5; colory2[2] = 0.6; colory2[3] = 0.5; + colory3[0] = 0.1; colory3[1] = 0.2; colory3[2] = 0.3; colory3[3] = 0.8; + 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, 255, 8,1); + //R_LFX_Burst (sprOrg, sprVel, 22, 266, colory, colory2, colory3, colory4, colory4, 1, 144, 2, 7); + //R_LFX_Spark (sprOrg, sprVel, 134, 4, colory, colory2, colory3, colory4, colory4, 7, 1556, 0.25f, 1); + } + // muzzleflash shotgun + if (effect == 63) + { + 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; - //R_LFX_Burst (sprOrg, sprVel, 22, 266, colory, colory2, colory3, colory4, colory4, 1, 144, 2, 7); + //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); - VectorScale( dir, 39, sprVel ); - R_LFX_Spark (sprOrg, sprVel, 14, 8, colory, colory2, colory3, colory4, colory4, 22, 556, 0.25f, 1); - } + 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); + VectorScale( dir, 39, sprVel ); + R_LFX_Spark (sprOrg, sprVel, 14, 8, colory, colory2, colory3, colory4, colory4, 22, 556, 0.25f, 1); + } -*/ + */ } // 1997 - @@ -2640,85 +2880,86 @@ void LFX_ParticleEffect1997 (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) - { + if (effect == 2) { - } + } // Shotgun Hit // can be just smoke puffs, preferably atlasy. - if (effect == 3) - { + if (effect == 3) { - } + } // 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) { - } + } // 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 == 5 || effect == 4 || effect == 11) { - } + } // BFG, could be an expanding sphere with an explosion atlas - else if (effect == 9) - { + else if (effect == 9) { - } + } // Blood Sprays for bullets - 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); + } // "Blood" Sprays for bullets - if (effect == 14 && !com_blood->integer) - { - // usually there are none. - } + if (effect == 14 && !com_blood->integer) { + // usually there are none. + } // Blood Spray for a gibbing - if (effect == 16 && com_blood->integer) - { - // usually there are none. - } + if (effect == 16 && com_blood->integer) { + // usually there are none. + } // Water Splash for bullets - a splash atlas burst animation. - if (effect == 19) - { + if (effect == 19) { - } + } } @@ -2753,10 +2994,22 @@ void LFX_ParticleEffect1998 (int effect, vec3_t org, vec3_t dir) 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; + 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 ); @@ -2764,35 +3017,47 @@ void LFX_ParticleEffect1998 (int effect, vec3_t org, vec3_t dir) 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 + 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 + 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; + 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 ); @@ -2800,26 +3065,26 @@ void LFX_ParticleEffect1998 (int effect, vec3_t org, vec3_t dir) 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 + 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 ); } } @@ -2848,10 +3113,22 @@ void LFX_ParticleEffect1998 (int effect, vec3_t org, vec3_t dir) // 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; + 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); } @@ -2879,26 +3156,26 @@ void LFX_ParticleEffect1999 (int effect, vec3_t org, vec3_t dir) // 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 + 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 ); } @@ -2908,26 +3185,26 @@ void LFX_ParticleEffect1999 (int effect, vec3_t org, vec3_t dir) 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 + 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 ); } @@ -2963,49 +3240,49 @@ void LFX_ParticleEffect1999 (int effect, vec3_t org, vec3_t dir) 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 + 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 + 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 ); } @@ -3022,10 +3299,22 @@ void LFX_ParticleEffect1999 (int effect, vec3_t org, vec3_t dir) // 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; + 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); }