MCPcopy Create free account
hub / github.com/ddnet/ddnet / PopupEnvPointCurveType

Method PopupEnvPointCurveType

src/game/editor/popups.cpp:1589–1683  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1587}
1588
1589CUi::EPopupMenuFunctionResult CEditor::PopupEnvPointCurveType(void *pContext, CUIRect View, bool Active)
1590{
1591 CEditor *pEditor = static_cast<CEditor *>(pContext);
1592 const float RowHeight = 14.0f;
1593
1594 int CurveType = -1;
1595
1596 static int s_ButtonLinearId;
1597 CUIRect ButtonLinear;
1598 View.HSplitTop(RowHeight, &ButtonLinear, &View);
1599 if(pEditor->DoButton_MenuItem(&s_ButtonLinearId, "Linear", 0, &ButtonLinear))
1600 CurveType = CURVETYPE_LINEAR;
1601
1602 static int s_ButtonSlowId;
1603 CUIRect ButtonSlow;
1604 View.HSplitTop(RowHeight, &ButtonSlow, &View);
1605 if(pEditor->DoButton_MenuItem(&s_ButtonSlowId, "Slow", 0, &ButtonSlow))
1606 CurveType = CURVETYPE_SLOW;
1607
1608 static int s_ButtonFastId;
1609 CUIRect ButtonFast;
1610 View.HSplitTop(RowHeight, &ButtonFast, &View);
1611 if(pEditor->DoButton_MenuItem(&s_ButtonFastId, "Fast", 0, &ButtonFast))
1612 CurveType = CURVETYPE_FAST;
1613
1614 static int s_ButtonStepId;
1615 CUIRect ButtonStep;
1616 View.HSplitTop(RowHeight, &ButtonStep, &View);
1617 if(pEditor->DoButton_MenuItem(&s_ButtonStepId, "Step", 0, &ButtonStep))
1618 CurveType = CURVETYPE_STEP;
1619
1620 static int s_ButtonSmoothId;
1621 CUIRect ButtonSmooth;
1622 View.HSplitTop(RowHeight, &ButtonSmooth, &View);
1623 if(pEditor->DoButton_MenuItem(&s_ButtonSmoothId, "Smooth", 0, &ButtonSmooth))
1624 CurveType = CURVETYPE_SMOOTH;
1625
1626 std::vector<std::shared_ptr<IEditorAction>> vpActions;
1627
1628 if(CurveType >= 0)
1629 {
1630 std::shared_ptr<CEnvelope> pEnvelope = pEditor->Map()->m_vpEnvelopes.at(pEditor->Map()->m_SelectedEnvelope);
1631
1632 for(int c = 0; c < pEnvelope->GetChannels(); c++)
1633 {
1634 int FirstSelectedIndex = pEnvelope->m_vPoints.size();
1635 int LastSelectedIndex = -1;
1636 for(auto [SelectedIndex, SelectedChannel] : pEditor->Map()->m_vSelectedEnvelopePoints)
1637 {
1638 if(SelectedChannel == c)
1639 {
1640 FirstSelectedIndex = minimum(FirstSelectedIndex, SelectedIndex);
1641 LastSelectedIndex = maximum(LastSelectedIndex, SelectedIndex);
1642 }
1643 }
1644
1645 if(FirstSelectedIndex < (int)pEnvelope->m_vPoints.size() && LastSelectedIndex >= 0 && FirstSelectedIndex != LastSelectedIndex)
1646 {

Callers

nothing calls this directly

Calls 13

maximumFunction · 0.85
f2fxFunction · 0.85
HSplitTopMethod · 0.80
DoButton_MenuItemMethod · 0.80
GetChannelsMethod · 0.80
AddPointMethod · 0.80
EvalMethod · 0.80
RecordActionMethod · 0.80
OnModifyMethod · 0.80
minimumFunction · 0.50
ColorRGBAClass · 0.50
MapMethod · 0.45

Tested by

no test coverage detected