SetTextureFrameIndex(): Difference between revisions
Jump to navigation
Jump to search
Note:This function writes the input integer to an unsigned char without any bounds checking. As such, values above 255 or below 0 will
overflow. If this is an issue, clamp the input before calling this function.
Confirm:Does this work on models and sprites?
SirYodaJedi (talk | contribs) No edit summary |
SirYodaJedi (talk | contribs) No edit summary |
||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
{{code|SetTextureFrameIndex()}} is a C++ function available for the [[CBaseEntity]] class in all {{Source|4}} games. It takes one input, an integer. It sets the texture frame of all materials with the [[List Of Material Proxies#Entity integration|ToggleTexture]] to the specified integer. | {{code|SetTextureFrameIndex()}} is a C++ [[function]] available for the [[CBaseEntity]] class in all {{Source|4}} games. It takes one input, an [[integer]]. It sets the texture frame of all materials with the [[List Of Material Proxies#Entity integration|ToggleTexture]] to the specified integer. | ||
{{note|This function writes the input integer to an [[byte|unsigned char]] without any bounds checking. As such, values above 255 or below 0 will {{w|integer overflow|overflow}}. If this is an issue, clamp the input before calling this function.}} | |||
In most games, only {{ent|env_texturetoggle}} uses this function. {{hls|2}} uses this function to indicate whether [[func_healthcharger (Half-Life: Source)|health stations]] and [[func_recharge (Half-Life: Source)|HEV chargers]] have juice left or not. | In most games, only {{ent|env_texturetoggle}} uses this function. {{hls|2}} uses this function to indicate whether [[func_healthcharger (Half-Life: Source)|health stations]] and [[func_recharge (Half-Life: Source)|HEV chargers]] have juice left or not. |
Latest revision as of 08:08, 7 May 2025
SetTextureFrameIndex() is a C++ function available for the CBaseEntity class in all Source games. It takes one input, an integer. It sets the texture frame of all materials with the ToggleTexture to the specified integer.


In most games, only env_texturetoggle uses this function. Half-Life: Source uses this function to indicate whether health stations and HEV chargers have juice left or not.
Todo: Example code (perhaps by re-implementing func_wall's texture toggling from GoldSrc?)
