mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
Merge #5862
5862: Replace magic numbers with enum `EShowEnvelope` r=def- a=Robyt3 <!-- What is the motivation for the changes of this pull request? --> <!-- Note that builds and other checks will be run for your change. Don't feel intimidated by failures in some of the checks. If you can't resolve them yourself, experienced devs can also resolve them before merging your pull request. --> ## Checklist - [ ] Tested the change ingame - [ ] Provided screenshots if it is a visual change - [ ] Tested in combination with possibly related configuration options - [ ] Written a unit test (especially base/) or added coverage to integration test - [ ] Considered possible null pointers and out of bounds array indexing - [ ] Changed no physics that affect existing maps - [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional) Co-authored-by: Robert Müller <robytemueller@gmail.com>
This commit is contained in:
commit
d64d76d627
|
@ -913,7 +913,7 @@ void CEditor::DoToolbar(CUIRect ToolBar)
|
|||
(Input()->KeyPress(KEY_I) && ModPressed))
|
||||
{
|
||||
m_ShowTileInfo = !m_ShowTileInfo;
|
||||
m_ShowEnvelopePreview = 0;
|
||||
m_ShowEnvelopePreview = SHOWENV_NONE;
|
||||
}
|
||||
|
||||
TB_Top.VSplitLeft(5.0f, nullptr, &TB_Top);
|
||||
|
@ -2093,7 +2093,7 @@ void CEditor::DoQuadEnvelopes(const std::vector<CQuad> &vQuads, IGraphics::CText
|
|||
mem_zero(apEnvelope, sizeof(CEnvelope *) * Num); // NOLINT(bugprone-sizeof-expression)
|
||||
for(size_t i = 0; i < Num; i++)
|
||||
{
|
||||
if((m_ShowEnvelopePreview == 1 && vQuads[i].m_PosEnv == m_SelectedEnvelope) || m_ShowEnvelopePreview == 2)
|
||||
if((m_ShowEnvelopePreview == SHOWENV_SELECTED && vQuads[i].m_PosEnv == m_SelectedEnvelope) || m_ShowEnvelopePreview == SHOWENV_ALL)
|
||||
if(vQuads[i].m_PosEnv >= 0 && vQuads[i].m_PosEnv < (int)m_Map.m_vpEnvelopes.size())
|
||||
apEnvelope[i] = m_Map.m_vpEnvelopes[vQuads[i].m_PosEnv];
|
||||
}
|
||||
|
@ -2787,8 +2787,8 @@ void CEditor::DoMapEditor(CUIRect View)
|
|||
{
|
||||
CLayerQuads *pLayer = (CLayerQuads *)apEditLayers[k];
|
||||
|
||||
if(!m_ShowEnvelopePreview)
|
||||
m_ShowEnvelopePreview = 2;
|
||||
if(m_ShowEnvelopePreview == SHOWENV_NONE)
|
||||
m_ShowEnvelopePreview = SHOWENV_ALL;
|
||||
|
||||
if(m_QuadKnifeActive)
|
||||
DoQuadKnife(m_vSelectedQuads[m_SelectedQuadIndex]);
|
||||
|
@ -2988,7 +2988,7 @@ void CEditor::DoMapEditor(CUIRect View)
|
|||
}
|
||||
}
|
||||
|
||||
if(!m_ShowPicker && m_ShowTileInfo && m_ShowEnvelopePreview != 0 && GetSelectedLayer(0) && GetSelectedLayer(0)->m_Type == LAYERTYPE_QUADS)
|
||||
if(!m_ShowPicker && m_ShowTileInfo && m_ShowEnvelopePreview != SHOWENV_NONE && GetSelectedLayer(0) && GetSelectedLayer(0)->m_Type == LAYERTYPE_QUADS)
|
||||
{
|
||||
GetSelectedGroup()->MapScreen();
|
||||
|
||||
|
@ -2998,7 +2998,7 @@ void CEditor::DoMapEditor(CUIRect View)
|
|||
Texture = m_Map.m_vpImages[pLayer->m_Image]->m_Texture;
|
||||
|
||||
DoQuadEnvelopes(pLayer->m_vQuads, Texture);
|
||||
m_ShowEnvelopePreview = 0;
|
||||
m_ShowEnvelopePreview = SHOWENV_NONE;
|
||||
}
|
||||
|
||||
UI()->MapScreen();
|
||||
|
@ -5052,7 +5052,7 @@ void CEditor::RenderEnvelopeEditor(CUIRect View)
|
|||
m_Map.m_Modified = true;
|
||||
}
|
||||
|
||||
m_ShowEnvelopePreview = 1;
|
||||
m_ShowEnvelopePreview = SHOWENV_SELECTED;
|
||||
m_pTooltip = "Press right mouse button to create a new point";
|
||||
}
|
||||
}
|
||||
|
@ -5237,7 +5237,7 @@ void CEditor::RenderEnvelopeEditor(CUIRect View)
|
|||
}
|
||||
|
||||
m_SelectedQuadEnvelope = m_SelectedEnvelope;
|
||||
m_ShowEnvelopePreview = 1;
|
||||
m_ShowEnvelopePreview = SHOWENV_SELECTED;
|
||||
m_SelectedEnvelopePoint = i;
|
||||
m_Map.m_Modified = true;
|
||||
}
|
||||
|
@ -5272,7 +5272,7 @@ void CEditor::RenderEnvelopeEditor(CUIRect View)
|
|||
m_Map.m_Modified = true;
|
||||
}
|
||||
|
||||
m_ShowEnvelopePreview = 1;
|
||||
m_ShowEnvelopePreview = SHOWENV_SELECTED;
|
||||
ColorMod = 100.0f;
|
||||
Graphics()->SetColor(1, 0.75f, 0.75f, 1);
|
||||
m_pTooltip = "Left mouse to drag. Hold ctrl to be more precise. Hold shift to alter time point as well. Right click to delete.";
|
||||
|
@ -6035,7 +6035,7 @@ void CEditor::Reset(bool CreateDefault)
|
|||
|
||||
m_Map.m_Modified = false;
|
||||
|
||||
m_ShowEnvelopePreview = 0;
|
||||
m_ShowEnvelopePreview = SHOWENV_NONE;
|
||||
m_ShiftBy = 1;
|
||||
|
||||
m_Map.m_Modified = false;
|
||||
|
|
|
@ -810,7 +810,7 @@ public:
|
|||
m_ShowEnvelopeEditor = 0;
|
||||
m_ShowServerSettingsEditor = false;
|
||||
|
||||
m_ShowEnvelopePreview = 0;
|
||||
m_ShowEnvelopePreview = SHOWENV_NONE;
|
||||
m_SelectedQuadEnvelope = -1;
|
||||
m_SelectedEnvelopePoint = -1;
|
||||
|
||||
|
@ -994,7 +994,14 @@ public:
|
|||
float m_AnimateSpeed;
|
||||
|
||||
int m_ShowEnvelopeEditor;
|
||||
int m_ShowEnvelopePreview; //Values: 0-Off|1-Selected Envelope|2-All
|
||||
|
||||
enum EShowEnvelope
|
||||
{
|
||||
SHOWENV_NONE = 0,
|
||||
SHOWENV_SELECTED,
|
||||
SHOWENV_ALL
|
||||
};
|
||||
EShowEnvelope m_ShowEnvelopePreview;
|
||||
bool m_ShowServerSettingsEditor;
|
||||
bool m_ShowPicker;
|
||||
|
||||
|
|
Loading…
Reference in a new issue