Tremulous Forum
		Mods => Modding Center => Topic started by: optear on March 26, 2007, 01:16:04 am
		
			
			- 
				server sets EF_MOVER_STOP bit if basi stops
     legs.hModel = ci->nonSegModel;
 legs.customSkin = ci->nonSegSkin;
 
 if( es->weapon == WP_ALEVEL1_UPG )
 {
 //ZOMG UBER HACK
 if( es->eFlags & EF_MOVER_STOP)
 {
 if(!cent->invis)
 {
 cent->invisTime = cg.time;
 cent->invis = qtrue;
 }
 }
 else
 {
 if(cent->invis)
 {
 cent->invisTime = cg.time;
 cent->invis = qfalse;
 }
 }
 
 if( cent->invis)
 { //fade out in 1 second shader time is 0
 legs.shaderTime = cent->invisTime/1000.0f;
 if( cg.time - cent->invisTime < 1000  )
 legs.customShader = cgs.media.invisFadeShader;
 else
 legs.customShader = cgs.media.invisShader;
 }
 else
 {
 if( cg.time - cent->invisTime < 500  )
 { //fade in in .5 second :: shaderTime is 2 - .5
 legs.shaderTime = (cent->invisTime+500.0)/1000.0;
 legs.customShader = cgs.media.invisFadeShader;
 }
 }
 }
 and the corresponding shaders are
 
 gfx/invisfade
 {
 {
 map models/players/level1/level1upg.jpg
 blendFunc GL_ONE GL_ONE
 // sin wave of amp 1 and base 0 (usual sinwave)
 // starts from .25 -> PI/2 -> sinx = 1
 // .5 cycles per second -> period 2 second
 rgbgen wave sin 0.0 1.0 0.25 0.5
 }
 {
 animmap 24 gfx/invis.jpg gfx/invisa.jpg
 blendFunc GL_ONE GL_ONE
 tcmod scale 2 2
 tcMod scroll 0.2 -0.2
 //tcGen environment
 }
 }
 gfx/invis
 {
 nopicmip
 {
 animmap 24 gfx/invis.jpg gfx/invisa.jpg
 blendFunc GL_ONE GL_ONE
 tcmod scale 2 2
 tcMod scroll 0.2 -0.2
 //tcGen environment
 }
 }
 
 I want to learn if there is a better way of fading shaders manually or another way of doing this
 This works good so far ie when you stand still basi becomes invisible slowly and when you move it appears again a little faster