void CMomentaryRotButton :: UpdateAllButtons( void ) { // NOTE: all the momentary buttons linked with same targetname // will be updated only in forward direction // in backward direction each button uses private AutoReturn code // update all rot buttons attached to my target CBaseEntity *pTarget = NULL; while( 1 ) { pTarget = UTIL_FindEntityByTarget( pTarget, STRING( pev->target )); if( FNullEnt( pTarget )) break; if( FClassnameIs( pTarget->pev, "momentary_rot_button" ) || FClassnameIs( pTarget->pev, "momentary_rot_door" )) { CMomentaryRotButton *pEntity = (CMomentaryRotButton *)pTarget; if( pEntity != this ) { // indirect use. disable update targets to avoid fire it twice // and prevent possible recursion pEntity->m_bUpdateTarget = false; } pEntity->UpdateButton(); } } }
void CMultiSource::Register( void ) { m_iTotal = 0; memset( m_rgEntities, 0, MS_MAX_TARGETS * sizeof( EHANDLE ) ); SetThink( &CMultiSource::SUB_DoNothing ); // search for all entities which target this multisource (GetTargetname()) CBaseEntity* pTarget = nullptr; while( ( pTarget = UTIL_FindEntityByTarget( pTarget, GetTargetname() ) ) != nullptr && ( m_iTotal < MS_MAX_TARGETS ) ) { m_rgEntities[ m_iTotal++ ] = pTarget; } pTarget = nullptr; while( ( pTarget = UTIL_FindEntityByClassname( pTarget, "multi_manager" ) ) != nullptr && ( m_iTotal < MS_MAX_TARGETS ) ) { if( pTarget->HasTarget( GetTargetname() ) ) m_rgEntities[ m_iTotal++ ] = pTarget; } GetSpawnFlags().ClearFlags( SF_MULTI_INIT ); }
void CMultiSource :: Register( void ) { m_iTotal = 0; memset( m_rgEntities, 0, MAX_MASTER_TARGETS * sizeof( EHANDLE )); SetThink( NULL ); // search for all entities which target this multisource (pev->target) CBaseEntity *pTarget = UTIL_FindEntityByTarget( NULL, GetTargetname( )); while( pTarget && ( m_iTotal < MAX_MASTER_TARGETS )) { m_rgEntities[m_iTotal++] = pTarget; pTarget = UTIL_FindEntityByTarget( pTarget, GetTargetname( )); } // search for all monsters which target this multisource (TriggerTarget) pTarget = UTIL_FindEntityByMonsterTarget( NULL, GetTargetname( )); while( pTarget && ( m_iTotal < MAX_MASTER_TARGETS )) { m_rgEntities[m_iTotal++] = pTarget; pTarget = UTIL_FindEntityByMonsterTarget( pTarget, GetTargetname( )); } pTarget = UTIL_FindEntityByClassname( NULL, "multi_manager" ); while( pTarget && ( m_iTotal < MAX_MASTER_TARGETS )) { if( pTarget->HasTarget( pev->targetname )) m_rgEntities[m_iTotal++] = pTarget; pTarget = UTIL_FindEntityByClassname( pTarget, "multi_manager" ); } ClearBits( pev->spawnflags, SF_MULTI_INIT ); }