mirror of
https://github.com/celisej567/Fake-CSM-Mapbase.git
synced 2026-09-15 20:09:48 +03:00
Angles
-Now You not have to copy pitch from "Pitch" to "Angles" in light_env. -Fixed pitch problems
This commit is contained in:
@@ -236,12 +236,61 @@ LINK_ENTITY_TO_CLASS( light_glspot, CLight );
|
||||
|
||||
LINK_ENTITY_TO_CLASS( light_environment, CEnvLight );
|
||||
|
||||
BEGIN_DATADESC(CEnvLight)
|
||||
|
||||
// Fuctions
|
||||
DEFINE_FUNCTION(FadeThink),
|
||||
|
||||
// Inputs
|
||||
DEFINE_INPUTFUNC(FIELD_VOID, "Toggle", InputToggle),
|
||||
DEFINE_INPUTFUNC(FIELD_VOID, "TurnOn", InputTurnOn),
|
||||
DEFINE_INPUTFUNC(FIELD_VOID, "TurnOff", InputTurnOff),
|
||||
|
||||
END_DATADESC()
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Purpose : Fade light to new starting pattern value then stop thinking
|
||||
//------------------------------------------------------------------------------
|
||||
void CEnvLight::FadeThink(void)
|
||||
{
|
||||
if (m_iCurrentFade < m_iTargetFade)
|
||||
{
|
||||
m_iCurrentFade++;
|
||||
}
|
||||
else if (m_iCurrentFade > m_iTargetFade)
|
||||
{
|
||||
m_iCurrentFade--;
|
||||
}
|
||||
|
||||
// If we're done fading instantiate our light pattern and stop thinking
|
||||
if (m_iCurrentFade == m_iTargetFade)
|
||||
{
|
||||
engine->LightStyle(m_iStyle, (char*)STRING(m_iszPattern));
|
||||
SetNextThink(TICK_NEVER_THINK);
|
||||
}
|
||||
// Otherwise instantiate our current fade value and keep thinking
|
||||
else
|
||||
{
|
||||
char sCurString[2];
|
||||
sCurString[0] = m_iCurrentFade;
|
||||
sCurString[1] = 0;
|
||||
engine->LightStyle(m_iStyle, sCurString);
|
||||
|
||||
// UNDONE: Consider making this settable war to control fade speed
|
||||
SetNextThink(gpGlobals->curtime + 0.1f);
|
||||
}
|
||||
}
|
||||
|
||||
bool CEnvLight::KeyValue( const char *szKeyName, const char *szValue )
|
||||
{
|
||||
if (FStrEq(szKeyName, "_light"))
|
||||
{
|
||||
// nothing
|
||||
}
|
||||
else if (FStrEq(szKeyName, "pitch"))
|
||||
{
|
||||
m_iPitch = atoi(szValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
return BaseClass::KeyValue( szKeyName, szValue );
|
||||
@@ -250,8 +299,77 @@ bool CEnvLight::KeyValue( const char *szKeyName, const char *szValue )
|
||||
return true;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Turn the light on
|
||||
//-----------------------------------------------------------------------------
|
||||
void CEnvLight::TurnOn(void)
|
||||
{
|
||||
if (m_iszPattern != NULL_STRING)
|
||||
{
|
||||
engine->LightStyle(m_iStyle, (char*)STRING(m_iszPattern));
|
||||
}
|
||||
else
|
||||
{
|
||||
engine->LightStyle(m_iStyle, "m");
|
||||
}
|
||||
|
||||
CLEARBITS(m_spawnflags, SF_LIGHT_START_OFF);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Turn the light off
|
||||
//-----------------------------------------------------------------------------
|
||||
void CEnvLight::TurnOff(void)
|
||||
{
|
||||
engine->LightStyle(m_iStyle, "a");
|
||||
SETBITS(m_spawnflags, SF_LIGHT_START_OFF);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Toggle the light on/off
|
||||
//-----------------------------------------------------------------------------
|
||||
void CEnvLight::Toggle(void)
|
||||
{
|
||||
//Toggle it
|
||||
if (FBitSet(m_spawnflags, SF_LIGHT_START_OFF))
|
||||
{
|
||||
TurnOn();
|
||||
}
|
||||
else
|
||||
{
|
||||
TurnOff();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CEnvLight::Spawn( void )
|
||||
{
|
||||
BaseClass::Spawn( );
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Handle the "turnon" input handler
|
||||
// Input : &inputdata -
|
||||
//-----------------------------------------------------------------------------
|
||||
void CEnvLight::InputTurnOn(inputdata_t& inputdata)
|
||||
{
|
||||
TurnOn();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Handle the "turnoff" input handler
|
||||
// Input : &inputdata -
|
||||
//-----------------------------------------------------------------------------
|
||||
void CEnvLight::InputTurnOff(inputdata_t& inputdata)
|
||||
{
|
||||
TurnOff();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Handle the "toggle" input handler
|
||||
// Input : &inputdata -
|
||||
//-----------------------------------------------------------------------------
|
||||
void CEnvLight::InputToggle(inputdata_t& inputdata)
|
||||
{
|
||||
Toggle();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user