diff options
| -rw-r--r-- | src/game/editor/layer_tiles.cpp | 14 | ||||
| -rw-r--r-- | src/game/editor/popups.cpp | 30 |
2 files changed, 41 insertions, 3 deletions
diff --git a/src/game/editor/layer_tiles.cpp b/src/game/editor/layer_tiles.cpp index 5662613c..eb78a23d 100644 --- a/src/game/editor/layer_tiles.cpp +++ b/src/game/editor/layer_tiles.cpp @@ -473,7 +473,19 @@ int CLayerTiles::RenderProperties(CUIRect *pToolBox) m_Color.a = NewVal&0xff; } if(Prop == PROP_COLOR_ENV) - m_ColorEnv = clamp(NewVal-1, -1, m_pEditor->m_Map.m_lEnvelopes.size()-1); + { + int Index = clamp(NewVal-1, -1, m_pEditor->m_Map.m_lEnvelopes.size()-1); + int Step = (Index-m_ColorEnv)%2; + if(Step != 0) + { + for(; Index >= -1 && Index < m_pEditor->m_Map.m_lEnvelopes.size(); Index += Step) + if(Index == -1 || m_pEditor->m_Map.m_lEnvelopes[Index]->m_Channels == 4) + { + m_ColorEnv = Index; + break; + } + } + } if(Prop == PROP_COLOR_ENV_OFFSET) m_ColorEnvOffset = NewVal; diff --git a/src/game/editor/popups.cpp b/src/game/editor/popups.cpp index 59f731fa..0d8036e3 100644 --- a/src/game/editor/popups.cpp +++ b/src/game/editor/popups.cpp @@ -458,9 +458,35 @@ int CEditor::PopupQuad(CEditor *pEditor, CUIRect View) for(int k = 0; k < 5; ++k) pQuad->m_aPoints[k].y += Offset; } - if(Prop == PROP_POS_ENV) pQuad->m_PosEnv = clamp(NewVal-1, -1, pEditor->m_Map.m_lEnvelopes.size()-1); + if(Prop == PROP_POS_ENV) + { + int Index = clamp(NewVal-1, -1, pEditor->m_Map.m_lEnvelopes.size()-1); + int Step = (Index-pQuad->m_PosEnv)%2; + if(Step != 0) + { + for(; Index >= -1 && Index < pEditor->m_Map.m_lEnvelopes.size(); Index += Step) + if(Index == -1 || pEditor->m_Map.m_lEnvelopes[Index]->m_Channels == 3) + { + pQuad->m_PosEnv = Index; + break; + } + } + } if(Prop == PROP_POS_ENV_OFFSET) pQuad->m_PosEnvOffset = NewVal; - if(Prop == PROP_COLOR_ENV) pQuad->m_ColorEnv = clamp(NewVal-1, -1, pEditor->m_Map.m_lEnvelopes.size()-1); + if(Prop == PROP_COLOR_ENV) + { + int Index = clamp(NewVal-1, -1, pEditor->m_Map.m_lEnvelopes.size()-1); + int Step = (Index-pQuad->m_ColorEnv)%2; + if(Step != 0) + { + for(; Index >= -1 && Index < pEditor->m_Map.m_lEnvelopes.size(); Index += Step) + if(Index == -1 || pEditor->m_Map.m_lEnvelopes[Index]->m_Channels == 4) + { + pQuad->m_ColorEnv = Index; + break; + } + } + } if(Prop == PROP_COLOR_ENV_OFFSET) pQuad->m_ColorEnvOffset = NewVal; return 0; |