From 5e4d504c807aec7e4fe65b20edeee83ede5b111b Mon Sep 17 00:00:00 2001 From: H-M-H Date: Mon, 30 Mar 2015 13:06:05 +0200 Subject: [PATCH] improved envelopeswitching and deleting --- src/game/editor/editor.cpp | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/game/editor/editor.cpp b/src/game/editor/editor.cpp index 3f47a73de..fe954c842 100644 --- a/src/game/editor/editor.cpp +++ b/src/game/editor/editor.cpp @@ -4039,6 +4039,8 @@ void CEditor::RenderEnvelopeEditor(CUIRect View) ToolBar.Margin(2.0f, &ToolBar); CurveBar.Margin(2.0f, &CurveBar); + bool CurrentEnvelopeSwitched = false; + // do the toolbar { CUIRect Button; @@ -4116,11 +4118,23 @@ void CEditor::RenderEnvelopeEditor(CUIRect View) static int s_PrevButton = 0; if(DoButton_ButtonDec(&s_PrevButton, 0, 0, &Dec, 0, "Previous Envelope")) + { m_SelectedEnvelope--; + if(m_SelectedEnvelope < 0) + CurrentEnvelopeSwitched = false; + else + CurrentEnvelopeSwitched = true; + } static int s_NextButton = 0; if(DoButton_ButtonInc(&s_NextButton, 0, 0, &Inc, 0, "Next Envelope")) + { m_SelectedEnvelope++; + if(m_SelectedEnvelope >= m_Map.m_lEnvelopes.size()) + CurrentEnvelopeSwitched = false; + else + CurrentEnvelopeSwitched = true; + } if(pEnvelope) { @@ -4356,6 +4370,15 @@ void CEditor::RenderEnvelopeEditor(CUIRect View) static char s_aStrCurTime[32] = "0.000"; static char s_aStrCurValue[32] = "0.000"; + if(CurrentEnvelopeSwitched) + { + s_pID = 0; + + // update displayed text + str_format(s_aStrCurTime, sizeof(s_aStrCurTime), "0.000"); + str_format(s_aStrCurValue, sizeof(s_aStrCurValue), "0.000"); + } + { int CurrentValue = 0, CurrentTime = 0; @@ -4444,6 +4467,15 @@ void CEditor::RenderEnvelopeEditor(CUIRect View) // remove point if(UI()->MouseButtonClicked(1)) { + if(s_pID == pID) + { + s_pID = 0; + + // update displayed text + str_format(s_aStrCurTime, sizeof(s_aStrCurTime), "0.000"); + str_format(s_aStrCurValue, sizeof(s_aStrCurValue), "0.000"); + } + pEnvelope->m_lPoints.remove_index(i); m_Map.m_Modified = true; m_Map.m_UndoModified++;