mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-20 15:08:19 +00:00
Merge pull request #7682 from furo321/clamp-volume-env
Clamp volume envelopes between 0.0f and 1.0f
This commit is contained in:
commit
a1b603a424
|
@ -6918,7 +6918,7 @@ void CEditor::RenderEnvelopeEditor(CUIRect View)
|
|||
s_vAccurateDragValuesY[k] -= DeltaY;
|
||||
pEnvelope->m_vPoints[SelectedIndex].m_aValues[SelectedChannel] = std::round(s_vAccurateDragValuesY[k]);
|
||||
|
||||
if(pEnvelope->GetChannels() == 4)
|
||||
if(pEnvelope->GetChannels() == 1 || pEnvelope->GetChannels() == 4)
|
||||
{
|
||||
pEnvelope->m_vPoints[i].m_aValues[c] = clamp(pEnvelope->m_vPoints[i].m_aValues[c], 0, 1024);
|
||||
s_vAccurateDragValuesY[k] = clamp<float>(s_vAccurateDragValuesY[k], 0, 1024);
|
||||
|
@ -7383,7 +7383,7 @@ void CEditor::RenderEnvelopeEditor(CUIRect View)
|
|||
else
|
||||
pEnvelope->m_vPoints[SelectedIndex].m_aValues[SelectedChannel] = std::round(s_vInitialPositionsY[k] * s_ScaleFactorY);
|
||||
|
||||
if(pEnvelope->GetChannels() == 4)
|
||||
if(pEnvelope->GetChannels() == 1 || pEnvelope->GetChannels() == 4)
|
||||
pEnvelope->m_vPoints[SelectedIndex].m_aValues[SelectedChannel] = clamp(pEnvelope->m_vPoints[SelectedIndex].m_aValues[SelectedChannel], 0, 1024);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1534,7 +1534,7 @@ void CEditorActionEditEnvelopePointValue::Apply(bool Undo)
|
|||
}
|
||||
else
|
||||
{
|
||||
if(pEnvelope->GetChannels() == 4)
|
||||
if(pEnvelope->GetChannels() == 1 || pEnvelope->GetChannels() == 4)
|
||||
CurrentValue = clamp(CurrentValue, 0.0f, 1.0f);
|
||||
pEnvelope->m_vPoints[m_PtIndex].m_aValues[m_Channel] = f2fx(CurrentValue);
|
||||
|
||||
|
|
Loading…
Reference in a new issue