From 3bf9df6b2785fa6d951086978a3e66f49427166a Mon Sep 17 00:00:00 2001 From: FluorescentCIAAfricanAmerican <0934gj3049fk@protonmail.com> Date: Wed, 22 Apr 2020 12:56:21 -0400 Subject: 1 --- game/server/env_texturetoggle.cpp | 63 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 game/server/env_texturetoggle.cpp (limited to 'game/server/env_texturetoggle.cpp') diff --git a/game/server/env_texturetoggle.cpp b/game/server/env_texturetoggle.cpp new file mode 100644 index 0000000..53ccbd5 --- /dev/null +++ b/game/server/env_texturetoggle.cpp @@ -0,0 +1,63 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +//=============================================================================// + +#include "cbase.h" + +// memdbgon must be the last include file in a .cpp file!!! +#include "tier0/memdbgon.h" + +class CTextureToggle : public CPointEntity +{ +public: + DECLARE_CLASS( CTextureToggle, CPointEntity ); + + void InputIncrementBrushTexIndex( inputdata_t &inputdata ); + void InputSetBrushTexIndex( inputdata_t &inputdata ); + +private: + + DECLARE_DATADESC(); +}; + +LINK_ENTITY_TO_CLASS( env_texturetoggle, CTextureToggle ); + +BEGIN_DATADESC( CTextureToggle ) + + DEFINE_INPUTFUNC( FIELD_VOID, "IncrementTextureIndex", InputIncrementBrushTexIndex ), + DEFINE_INPUTFUNC( FIELD_INTEGER, "SetTextureIndex", InputSetBrushTexIndex ), + +END_DATADESC() + +//----------------------------------------------------------------------------- +// Purpose: +// Input : &inputdata - +//----------------------------------------------------------------------------- +void CTextureToggle::InputIncrementBrushTexIndex( inputdata_t& inputdata ) +{ + CBaseEntity *pEntity = gEntList.FindEntityByName( NULL, m_target ); + + while( pEntity ) + { + int iCurrentIndex = pEntity->GetTextureFrameIndex() + 1; + pEntity->SetTextureFrameIndex( iCurrentIndex ); + + pEntity = gEntList.FindEntityByName( pEntity, m_target ); + } +} + +void CTextureToggle::InputSetBrushTexIndex( inputdata_t& inputdata ) +{ + CBaseEntity *pEntity = gEntList.FindEntityByName( NULL, m_target ); + + while( pEntity ) + { + int iData = inputdata.value.Int(); + + pEntity->SetTextureFrameIndex( iData ); + pEntity = gEntList.FindEntityByName( pEntity, m_target ); + } +} + -- cgit v1.2.3