1#include "references.h"
2
3#include <game/editor/mapitems/envelope.h>
4#include <game/editor/mapitems/layer_quads.h>
5#include <game/editor/mapitems/layer_sounds.h>
6#include <game/editor/mapitems/layer_tiles.h>
7
8void CLayerTilesEnvelopeReference::SetEnvelope(const std::shared_ptr<CEnvelope> &pEnvelope, int EnvIndex)
9{
10 if(pEnvelope->Type() == CEnvelope::EType::COLOR)
11 {
12 m_pLayerTiles->m_ColorEnv = EnvIndex;
13 }
14}
15
16void CLayerQuadsEnvelopeReference::SetEnvelope(const std::shared_ptr<CEnvelope> &pEnvelope, int EnvIndex)
17{
18 for(auto &QuadIndex : m_vQuadIndices)
19 {
20 if(QuadIndex >= 0 && QuadIndex < (int)m_pLayerQuads->m_vQuads.size())
21 {
22 if(pEnvelope->Type() == CEnvelope::EType::COLOR)
23 m_pLayerQuads->m_vQuads[QuadIndex].m_ColorEnv = EnvIndex;
24 else if(pEnvelope->Type() == CEnvelope::EType::POSITION)
25 m_pLayerQuads->m_vQuads[QuadIndex].m_PosEnv = EnvIndex;
26 }
27 }
28}
29
30void CLayerSoundEnvelopeReference::SetEnvelope(const std::shared_ptr<CEnvelope> &pEnvelope, int EnvIndex)
31{
32 for(auto &SoundSourceIndex : m_vSoundSourceIndices)
33 {
34 if(SoundSourceIndex >= 0 && SoundSourceIndex <= (int)m_pLayerSounds->m_vSources.size())
35 {
36 if(pEnvelope->Type() == CEnvelope::EType::SOUND)
37 m_pLayerSounds->m_vSources[SoundSourceIndex].m_SoundEnv = EnvIndex;
38 else if(pEnvelope->Type() == CEnvelope::EType::POSITION)
39 m_pLayerSounds->m_vSources[SoundSourceIndex].m_PosEnv = EnvIndex;
40 }
41 }
42}
43