MCPcopy Create free account
hub / github.com/carbonengine/trinity / Start

Method Start

trinity/Controllers/Actions/Tr2ActionPlaySound.cpp:19–49  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17}
18
19void Tr2ActionPlaySound::Start( ITr2ActionController& controller )
20{
21 ITr2SoundEmitterOwnerPtr owner = BlueCastPtr( controller.GetOwner() );
22
23 if( !m_target.empty() )
24 {
25 if( EveMultiEffectPtr multiEffect = BlueCastPtr( controller.GetOwner() ) )
26 {
27 if( EveMultiEffectParameterPtr mep = multiEffect->GetParameterByName( m_target ) )
28 {
29 owner = BlueCastPtr( mep->GetParameterObject() );
30 }
31 }
32 else if( IEveEffectChildrenOwnerPtr childEffectOwner = BlueCastPtr( controller.GetOwner() ) )
33 {
34 owner = BlueCastPtr( childEffectOwner->GetEffectChildByName( m_target.c_str() ) );
35 }
36 }
37
38 if( owner != nullptr )
39 {
40 if( auto emitter = owner->FindSoundEmitter( m_emitterName.c_str() ) )
41 {
42 emitter->SendEvent( static_cast<const wchar_t*>( CA2W( m_soundEvent.c_str() ) ), m_bypassPrefix );
43 }
44 }
45 else
46 {
47 CCP_LOGERR( "Tr2ActionPlaySound failed to find an owner! The target must be derived from ITr2SoundEmitterOwner." );
48 }
49}
50
51void Tr2ActionPlaySound::StartWithController( PyObject* obj )
52{

Callers

nothing calls this directly

Calls 6

emptyMethod · 0.80
GetParameterObjectMethod · 0.80
GetOwnerMethod · 0.45
GetParameterByNameMethod · 0.45
GetEffectChildByNameMethod · 0.45
FindSoundEmitterMethod · 0.45

Tested by

no test coverage detected