CompileTeam: Difference between revisions
		
		
		
		
		
		Jump to navigation
		Jump to search
		
				
		
		
	
SirYodaJedi (talk | contribs) No edit summary  | 
				SirYodaJedi (talk | contribs)  m (→VBSP code)  | 
				||
| (5 intermediate revisions by 2 users not shown) | |||
| Line 1: | Line 1: | ||
{{subpage|[[Material map compile flags]]}}{{DISPLAYTITLE:%CompileTeam}}  | {{subpage|[[Material map compile flags]]}}{{DISPLAYTITLE:%CompileTeam}}{{toc-right}}  | ||
{{l4ds|since}}  | {{l4ds|since}}  | ||
Compiles the texture to only affect a specific team. For example, the climb texture is a ladder that only lets infected climb up it.<br>  | Compiles the texture to only affect a specific team. For example, the climb texture is a ladder that only lets infected climb up it.<br>  | ||
However, making a texture '''visible''' to only one team requires [[Material Proxy|Proxies]]. As seen in the example below.<br>  | However, making a texture '''visible''' to only one team requires [[Material Proxy|Proxies]]. As seen in the example below.<br>  | ||
Example  | == Example ==  | ||
  UnlitGeneric  |   UnlitGeneric  | ||
| Line 45: | Line 45: | ||
  	}  |   	}  | ||
  }  |   }  | ||
== VBSP code ==  | |||
While {{code|%CompileTeam}} only exists in {{l4d}} [[VBSP]] and newer, the [[contents flags]] it writes exist in all versions of Source. Adding the following to the SDK VBSP source code will allow {{code|%CompileTeam}} to be used in {{src13}} branches, without using leaked code.  | |||
First, add this to the appropriate section of PrintBrushContentsToString in csg.cpp:  | |||
<syntaxhighlight lang=cpp>  | |||
	ADD_CONTENTS(CONTENTS_TEAM1)  | |||
	ADD_CONTENTS(CONTENTS_TEAM2)  | |||
</syntaxhighlight>  | |||
Next, add the following to the appropriate section of FindMiptex in textures.cpp:  | |||
<syntaxhighlight lang=cpp>  | |||
// Handle L4D-style %CompileTeam (no leaked code used)  | |||
if ( propVal = GetMaterialVar( matID, "%compileTeam" ) )  | |||
{  | |||
	if ( ( atoi(propVal) ) == 1 )  | |||
	{  | |||
		textureref[i].contents |= CONTENTS_TEAM1;  | |||
	}  | |||
	else if ( ( atoi(propVal) ) == 2 )  | |||
	{  | |||
		textureref[i].contents |= CONTENTS_TEAM2;  | |||
	}  | |||
}  | |||
</syntaxhighlight>  | |||
[[Category:Material System]]  | [[Category:Material System]]  | ||
[[Category:Shader parameters]]  | [[Category:Shader parameters]]  | ||
Latest revision as of 11:10, 14 April 2025
(in all games since ![]()
)
Compiles the texture to only affect a specific team. For example, the climb texture is a ladder that only lets infected climb up it.
However, making a texture visible to only one team requires Proxies. As seen in the example below.
Example
UnlitGeneric
{
	$basetexture "tools\climb"
	$additive 1
	"%compileTeam" 2
	"%compilepassbullets" 1
	"%compileladder" 1
	$proxRange 0.0
	$proxTeam 1.0
	$one 1.0
	
	Proxies
	{
		PlayerTeam
		{
			team 3 //Note: "%compileTeam" and this "team" use different numbers. Because that's just how it is coded.
			resultVar $proxTeam
		}
		Subtract
		{
			srcVar1 $one
			srcVar2 $proxRange
			resultVar $alpha
		}
		Multiply
		{
			srcVar1 $alpha
			srcVar2 $proxTeam
			resultVar $alpha
		}
		TextureScroll
		{
			texturescrollvar $baseTextureTransform
			texturescrollrate 1
			texturescrollangle 90.00
		}
	}
}
VBSP code
While %CompileTeam only exists in 
 VBSP and newer, the contents flags it writes exist in all versions of Source. Adding the following to the SDK VBSP source code will allow %CompileTeam to be used in 
 branches, without using leaked code.
First, add this to the appropriate section of PrintBrushContentsToString in csg.cpp:
	ADD_CONTENTS(CONTENTS_TEAM1)
	ADD_CONTENTS(CONTENTS_TEAM2)
Next, add the following to the appropriate section of FindMiptex in textures.cpp:
// Handle L4D-style %CompileTeam (no leaked code used)
if ( propVal = GetMaterialVar( matID, "%compileTeam" ) )
{
	if ( ( atoi(propVal) ) == 1 )
	{
		textureref[i].contents |= CONTENTS_TEAM1;
	}
	else if ( ( atoi(propVal) ) == 2 )
	{
		textureref[i].contents |= CONTENTS_TEAM2;
	}
}