light: make sure lightstyles reset upon round respawn
This commit is contained in:
parent
f13cb921b3
commit
95b60757e7
1 changed files with 27 additions and 26 deletions
|
@ -6,37 +6,48 @@
|
|||
*
|
||||
****/
|
||||
|
||||
class light : CBaseTrigger
|
||||
class light:CBaseTrigger
|
||||
{
|
||||
string m_strPattern;
|
||||
int m_iEnabled;
|
||||
float m_flStyle;
|
||||
|
||||
void() light;
|
||||
virtual void() Trigger;
|
||||
virtual void() Respawn;
|
||||
};
|
||||
|
||||
void light :: Trigger ( void )
|
||||
void light::Trigger(void)
|
||||
{
|
||||
if ( m_iEnabled == TRUE ) {
|
||||
//dprint( "light: Turned off!\n" );
|
||||
lightstyle( m_flStyle, "a" );
|
||||
if (m_iEnabled == TRUE) {
|
||||
lightstyle(m_flStyle, "a");
|
||||
m_iEnabled = FALSE;
|
||||
} else {
|
||||
//dprint( "light: Turned on!\n" );
|
||||
lightstyle( m_flStyle, m_strPattern );
|
||||
lightstyle(m_flStyle, m_strPattern);
|
||||
m_iEnabled = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
void light :: light ( void )
|
||||
void light::Respawn(void)
|
||||
{
|
||||
for ( int i = 1; i < ( tokenize( __fullspawndata ) - 1 ); i += 2 ) {
|
||||
switch ( argv( i ) ) {
|
||||
if (spawnflags & 1) {
|
||||
lightstyle(m_flStyle, "a");
|
||||
m_iEnabled = FALSE;
|
||||
} else {
|
||||
lightstyle(m_flStyle, m_strPattern);
|
||||
m_iEnabled = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
void light::light(void)
|
||||
{
|
||||
for (int i = 1; i < (tokenize(__fullspawndata) - 1); i += 2) {
|
||||
switch (argv(i)) {
|
||||
case "pattern":
|
||||
m_strPattern = argv( i + 1 );
|
||||
m_strPattern = argv(i+1);
|
||||
break;
|
||||
case "style":
|
||||
m_flStyle = stof( argv( i + 1 ) );
|
||||
m_flStyle = stof(argv(i+1));
|
||||
style = __NULL__;
|
||||
break;
|
||||
default:
|
||||
|
@ -44,23 +55,13 @@ void light :: light ( void )
|
|||
}
|
||||
}
|
||||
|
||||
/*if ( !m_strPattern ) {
|
||||
m_strPattern = getlightstyle( m_flStyle );
|
||||
}*/
|
||||
|
||||
if ( !m_strPattern ) {
|
||||
if (!m_strPattern) {
|
||||
m_strPattern = "m";
|
||||
}
|
||||
|
||||
if ( spawnflags & 1 ) {
|
||||
lightstyle( m_flStyle, "a" );
|
||||
m_iEnabled = FALSE;
|
||||
} else {
|
||||
lightstyle( m_flStyle, m_strPattern );
|
||||
m_iEnabled = TRUE;
|
||||
}
|
||||
light::Respawn();
|
||||
}
|
||||
|
||||
CLASSEXPORT( light_spot, light )
|
||||
CLASSEXPORT( light_environment, light )
|
||||
CLASSEXPORT(light_spot, light)
|
||||
CLASSEXPORT(light_environment, light)
|
||||
|
||||
|
|
Loading…
Reference in a new issue