mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Disallow adding overlapping envelope points
Also now round is used to convert the mouse position to fixed precision time which places the added point closer to the mouse position.
This commit is contained in:
parent
2ea102ac9f
commit
93332af243
|
@ -6299,11 +6299,21 @@ void CEditor::RenderEnvelopeEditor(CUIRect View)
|
|||
pEnvelope->Eval(Time, Channels);
|
||||
else
|
||||
Channels = {0, 0, 0, 0};
|
||||
pEnvelope->AddPoint(f2fxt(Time),
|
||||
|
||||
int FixedTime = std::round(Time * 1000.0f);
|
||||
bool TimeFound = false;
|
||||
for(CEnvPoint &Point : pEnvelope->m_vPoints)
|
||||
{
|
||||
if(Point.m_Time == FixedTime)
|
||||
TimeFound = true;
|
||||
}
|
||||
|
||||
if(!TimeFound)
|
||||
pEnvelope->AddPoint(FixedTime,
|
||||
f2fx(Channels.r), f2fx(Channels.g),
|
||||
f2fx(Channels.b), f2fx(Channels.a));
|
||||
|
||||
if(Time < 0)
|
||||
if(FixedTime < 0)
|
||||
RemoveTimeOffsetEnvelope(pEnvelope);
|
||||
m_Map.OnModify();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue