DDraceNetwork Docs
editor.h
Go to the documentation of this file.
1/* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */
2/* If you are missing that file, acquire a complete release at teeworlds.com. */
3#ifndef GAME_EDITOR_EDITOR_H
4#define GAME_EDITOR_EDITOR_H
5
6#include <base/bezier.h>
7#include <base/system.h>
8
10#include <game/client/ui.h>
12#include <game/mapitems.h>
13
14#include <game/editor/enums.h>
27
28#include <engine/console.h>
29#include <engine/editor.h>
30#include <engine/engine.h>
31#include <engine/graphics.h>
33#include <engine/shared/jobs.h>
34
35#include "editor_history.h"
37#include "editor_trackers.h"
38#include "editor_ui.h"
39#include "layer_selector.h"
40#include "map_view.h"
41#include "smooth_value.h"
42#include <game/editor/prompt.h>
44
45#include <deque>
46#include <functional>
47#include <map>
48#include <memory>
49#include <string>
50#include <vector>
51
52typedef std::function<void(int *pIndex)> FIndexModifyFunction;
53template<typename T>
54using FDropdownRenderCallback = std::function<void(const T &, char (&aOutput)[128], std::vector<STextColorSplit> &)>;
55
56// CEditor SPECIFIC
57enum
58{
63
68};
69
70class CEditorImage;
71class CEditorSound;
72
74{
75 void MakeGameGroup(std::shared_ptr<CLayerGroup> pGroup);
76 void MakeGameLayer(const std::shared_ptr<CLayer> &pLayer);
77
78public:
80
82 {
83 Clean();
84 }
85
87 {
88 Clean();
89 }
90
91 bool m_Modified; // unsaved changes in manual save
92 bool m_ModifiedAuto; // unsaved changes in autosave
96 void OnModify();
97
98 std::vector<std::shared_ptr<CLayerGroup>> m_vpGroups;
99 std::vector<std::shared_ptr<CEditorImage>> m_vpImages;
100 std::vector<std::shared_ptr<CEnvelope>> m_vpEnvelopes;
101 std::vector<std::shared_ptr<CEditorSound>> m_vpSounds;
102
104 {
105 public:
106 char m_aAuthor[32];
107 char m_aVersion[16];
108 char m_aCredits[128];
109 char m_aLicense[32];
110
111 void Reset()
112 {
113 m_aAuthor[0] = '\0';
114 m_aVersion[0] = '\0';
115 m_aCredits[0] = '\0';
116 m_aLicense[0] = '\0';
117 }
118
119 void Copy(const CMapInfo &Source)
120 {
125 }
126 };
129
130 std::vector<CEditorMapSetting> m_vSettings;
131
132 std::shared_ptr<class CLayerGame> m_pGameLayer;
133 std::shared_ptr<CLayerGroup> m_pGameGroup;
134
135 std::shared_ptr<CEnvelope> NewEnvelope(CEnvelope::EType Type)
136 {
137 OnModify();
138 std::shared_ptr<CEnvelope> pEnv = std::make_shared<CEnvelope>(Type);
139 m_vpEnvelopes.push_back(pEnv);
140 return pEnv;
141 }
142
143 void DeleteEnvelope(int Index);
144 void SwapEnvelopes(int Index0, int Index1);
145 template<typename F>
146 void VisitEnvelopeReferences(F &&Visitor);
147
148 std::shared_ptr<CLayerGroup> NewGroup()
149 {
150 OnModify();
151 std::shared_ptr<CLayerGroup> pGroup = std::make_shared<CLayerGroup>();
152 pGroup->m_pMap = this;
153 m_vpGroups.push_back(pGroup);
154 return pGroup;
155 }
156
157 int SwapGroups(int Index0, int Index1)
158 {
159 if(Index0 < 0 || Index0 >= (int)m_vpGroups.size())
160 return Index0;
161 if(Index1 < 0 || Index1 >= (int)m_vpGroups.size())
162 return Index0;
163 if(Index0 == Index1)
164 return Index0;
165 OnModify();
166 std::swap(m_vpGroups[Index0], m_vpGroups[Index1]);
167 return Index1;
168 }
169
170 void DeleteGroup(int Index)
171 {
172 if(Index < 0 || Index >= (int)m_vpGroups.size())
173 return;
174 OnModify();
175 m_vpGroups.erase(m_vpGroups.begin() + Index);
176 }
177
179 {
180 OnModify();
181 for(auto &pGroup : m_vpGroups)
182 pGroup->ModifyImageIndex(pfnFunc);
183 }
184
186 {
187 OnModify();
188 for(auto &pGroup : m_vpGroups)
189 pGroup->ModifyEnvelopeIndex(pfnFunc);
190 }
191
193 {
194 OnModify();
195 for(auto &pGroup : m_vpGroups)
196 pGroup->ModifySoundIndex(pfnFunc);
197 }
198
199 void Clean();
200 void CreateDefault(IGraphics::CTextureHandle EntitiesTexture);
201
202 // io
203 bool Save(const char *pFilename, const std::function<void(const char *pErrorMessage)> &ErrorHandler);
204 bool PerformPreSaveSanityChecks(const std::function<void(const char *pErrorMessage)> &ErrorHandler);
205 bool Load(const char *pFilename, int StorageType, const std::function<void(const char *pErrorMessage)> &ErrorHandler);
206 void PerformSanityChecks(const std::function<void(const char *pErrorMessage)> &ErrorHandler);
207
208 // DDRace
209
210 std::shared_ptr<class CLayerTele> m_pTeleLayer;
211 std::shared_ptr<class CLayerSpeedup> m_pSpeedupLayer;
212 std::shared_ptr<class CLayerFront> m_pFrontLayer;
213 std::shared_ptr<class CLayerSwitch> m_pSwitchLayer;
214 std::shared_ptr<class CLayerTune> m_pTuneLayer;
215 void MakeTeleLayer(const std::shared_ptr<CLayer> &pLayer);
216 void MakeSpeedupLayer(const std::shared_ptr<CLayer> &pLayer);
217 void MakeFrontLayer(const std::shared_ptr<CLayer> &pLayer);
218 void MakeSwitchLayer(const std::shared_ptr<CLayer> &pLayer);
219 void MakeTuneLayer(const std::shared_ptr<CLayer> &pLayer);
220};
221
223{
224public:
225 CProperty(const char *pName, int Value, int Type, int Min, int Max) :
226 m_pName(pName), m_Value(Value), m_Type(Type), m_Min(Min), m_Max(Max) {}
227
228 CProperty(std::nullptr_t) :
229 m_pName(nullptr), m_Value(0), m_Type(0), m_Min(0), m_Max(0) {}
230
231 const char *m_pName;
234 int m_Min;
235 int m_Max;
236};
237
238enum
239{
250};
251
253{
257
258 void Run() override
259 {
261 }
262
263public:
264 CDataFileWriterFinishJob(const char *pRealFileName, const char *pTempFileName, CDataFileWriter &&Writer) :
265 m_Writer(std::move(Writer))
266 {
267 str_copy(m_aRealFileName, pRealFileName);
268 str_copy(m_aTempFileName, pTempFileName);
269 }
270
271 const char *GetRealFileName() const { return m_aRealFileName; }
272 const char *GetTempFileName() const { return m_aTempFileName; }
273};
274
275class CEditor : public IEditor
276{
277 class IInput *m_pInput = nullptr;
278 class IClient *m_pClient = nullptr;
280 class CConfig *m_pConfig = nullptr;
281 class IConsole *m_pConsole = nullptr;
282 class IEngine *m_pEngine = nullptr;
283 class IGraphics *m_pGraphics = nullptr;
284 class ITextRender *m_pTextRender = nullptr;
285 class ISound *m_pSound = nullptr;
286 class IStorage *m_pStorage = nullptr;
289
290 std::vector<std::reference_wrapper<CEditorComponent>> m_vComponents;
294
296
298
304
305 int GetTextureUsageFlag() const;
306
308 {
312 };
313
314 std::shared_ptr<CLayerGroup> m_apSavedBrushes[10];
316
317public:
318 class IInput *Input() const { return m_pInput; }
319 class IClient *Client() const { return m_pClient; }
321 class CConfig *Config() const { return m_pConfig; }
322 class IConsole *Console() const { return m_pConsole; }
323 class IEngine *Engine() const { return m_pEngine; }
324 class IGraphics *Graphics() const { return m_pGraphics; }
325 class ISound *Sound() const { return m_pSound; }
326 class ITextRender *TextRender() const { return m_pTextRender; }
327 class IStorage *Storage() const { return m_pStorage; }
328 CUi *Ui() { return &m_UI; }
330
331 CMapView *MapView() { return &m_MapView; }
332 const CMapView *MapView() const { return &m_MapView; }
334
335 void SelectNextLayer();
336 void SelectPreviousLayer();
337
338 void FillGameTiles(EGameTileOp FillTile) const;
339 bool CanFillGameTiles() const;
340 void AddQuadOrSound();
341 void AddGroup();
342 void AddSoundLayer();
343 void AddTileLayer();
344 void AddQuadsLayer();
345 void AddSwitchLayer();
346 void AddFrontLayer();
347 void AddTuneLayer();
348 void AddSpeedupLayer();
349 void AddTeleLayer();
350 void DeleteSelectedLayer();
351 void LayerSelectImage();
352 bool IsNonGameTileLayerSelected() const;
353 void MapDetails();
354#define REGISTER_QUICK_ACTION(name, text, callback, disabled, active, button_color, description) CQuickAction m_QuickAction##name;
356#undef REGISTER_QUICK_ACTION
357
359#define REGISTER_QUICK_ACTION(name, text, callback, disabled, active, button_color, description) m_QuickAction##name(text, description, callback, disabled, active, button_color),
360#include <game/editor/quick_actions.h>
362 m_ZoomEnvelopeX(1.0f, 0.1f, 600.0f),
363 m_ZoomEnvelopeY(640.0f, 0.1f, 32000.0f),
365 {
372
374 m_Dialog = 0;
375
376 m_BrushColorEnabled = true;
377
378 m_aFileName[0] = '\0';
379 m_aFileNamePending[0] = '\0';
380 m_aFileSaveName[0] = '\0';
381 m_ValidSaveFilename = false;
382
383 m_PopupEventActivated = false;
385
389 m_pFileDialogTitle = nullptr;
390 m_pFileDialogButtonText = nullptr;
391 m_pFileDialogUser = nullptr;
393 m_aFileDialogCurrentLink[0] = '\0';
394 m_aFilesSelectedName[0] = '\0';
396 m_FileDialogOpening = false;
398
402
404
405 m_SelectEntitiesImage = "DDNet";
406
407 m_ResetZoomEnvelope = true;
408 m_OffsetEnvelopeX = 0.1f;
409 m_OffsetEnvelopeY = 0.5f;
410
411 m_ShowMousePointer = true;
412
413 m_GuiActive = true;
414 m_PreviewZoom = false;
415
417 m_ShowDetail = true;
418 m_Animate = false;
419 m_AnimateStart = 0;
420 m_AnimateTime = 0;
421 m_AnimateSpeed = 1;
422 m_AnimateUpdatePopup = false;
423
426
428 m_UpdateEnvPointInfo = false;
429 m_SelectedTangentInPoint = std::pair(-1, -1);
430 m_SelectedTangentOutPoint = std::pair(-1, -1);
432
433 m_QuadKnifeActive = false;
436
437 for(size_t i = 0; i < std::size(m_aSavedColors); ++i)
438 {
439 m_aSavedColors[i] = color_cast<ColorRGBA>(ColorHSLA(i / (float)std::size(m_aSavedColors), 1.0f, 0.5f));
440 }
441
443 for(auto &CursorTexture : m_aCursorTextures)
444 CursorTexture.Invalidate();
445
447
448 ms_pUiGotContext = nullptr;
449
450 // DDRace
451
452 m_TeleNumber = 1;
455
456 m_SwitchNum = 1;
457 m_TuningNum = 1;
458 m_SwitchDelay = 0;
459 m_SpeedupForce = 50;
461 m_SpeedupAngle = 0;
462 m_LargeLayerWasWarned = false;
466 }
467
469 {
470 public:
471 CHoverTile(int Group, int Layer, int x, int y, const CTile Tile) :
472 m_Group(Group),
473 m_Layer(Layer),
474 m_X(x),
475 m_Y(y),
476 m_Tile(Tile)
477 {
478 }
479
482 int m_X;
483 int m_Y;
485 };
486 std::vector<CHoverTile> m_vHoverTiles;
487 const std::vector<CHoverTile> &HoverTiles() const { return m_vHoverTiles; }
488
489 void Init() override;
490 void OnUpdate() override;
491 void OnRender() override;
492 void OnActivate() override;
493 void OnWindowResize() override;
494 void OnClose() override;
495 void OnDialogClose() override;
496 bool HasUnsavedData() const override { return m_Map.m_Modified; }
497 void UpdateMentions() override { m_Mentions++; }
498 void ResetMentions() override { m_Mentions = 0; }
499 void OnIngameMoved() override { m_IngameMoved = true; }
500 void ResetIngameMoved() override { m_IngameMoved = false; }
501
503 void OnMouseMove(vec2 MousePos);
504 void HandleAutosave();
505 bool PerformAutosave();
507
509 void FilelistPopulate(int StorageType, bool KeepSelection = false);
510 void InvokeFileDialog(int StorageType, int FileType, const char *pTitle, const char *pButtonText,
511 const char *pBasepath, bool FilenameAsDefault,
512 bool (*pfnFunc)(const char *pFilename, int StorageType, void *pUser), void *pUser);
514 {
515 bool operator()(const char *pLhs, const char *pRhs) const
516 {
517 return str_comp(pLhs, pRhs) < 0;
518 }
519 };
520 std::map<const char *, CUi::SMessagePopupContext *, SStringKeyComparator> m_PopupMessageContexts;
521 void ShowFileDialogError(const char *pFormat, ...)
522 GNUC_ATTRIBUTE((format(printf, 2, 3)));
523
524 void Reset(bool CreateDefault = true);
525 bool Save(const char *pFilename) override;
526 bool Load(const char *pFilename, int StorageType) override;
527 bool HandleMapDrop(const char *pFilename, int StorageType) override;
528 bool Append(const char *pFilename, int StorageType, bool IgnoreHistory = false);
529 void LoadCurrentMap();
530 void Render();
531
532 void RenderPressedKeys(CUIRect View);
535 void UpdateColorPipette();
536 void RenderMousePointer();
537
538 std::vector<CQuad *> GetSelectedQuads();
539 std::shared_ptr<CLayer> GetSelectedLayerType(int Index, int Type) const;
540 std::shared_ptr<CLayer> GetSelectedLayer(int Index) const;
541 std::shared_ptr<CLayerGroup> GetSelectedGroup() const;
543 void SelectLayer(int LayerIndex, int GroupIndex = -1);
544 void AddSelectedLayer(int LayerIndex);
545 void SelectQuad(int Index);
546 void ToggleSelectQuad(int Index);
547 void DeselectQuads();
548 void DeselectQuadPoints();
549 void SelectQuadPoint(int QuadIndex, int Index);
550 void ToggleSelectQuadPoint(int QuadIndex, int Index);
551 void DeleteSelectedQuads();
552 bool IsQuadSelected(int Index) const;
553 bool IsQuadCornerSelected(int Index) const;
554 bool IsQuadPointSelected(int QuadIndex, int Index) const;
555 int FindSelectedQuadIndex(int Index) const;
556
557 int FindEnvPointIndex(int Index, int Channel) const;
558 void SelectEnvPoint(int Index);
559 void SelectEnvPoint(int Index, int Channel);
560 void ToggleEnvPoint(int Index, int Channel);
561 bool IsEnvPointSelected(int Index, int Channel) const;
562 bool IsEnvPointSelected(int Index) const;
563 void DeselectEnvPoints();
564 void SelectTangentOutPoint(int Index, int Channel);
565 bool IsTangentOutPointSelected(int Index, int Channel) const;
566 void SelectTangentInPoint(int Index, int Channel);
567 bool IsTangentInPointSelected(int Index, int Channel) const;
568 bool IsTangentInSelected() const;
569 bool IsTangentOutSelected() const;
570 bool IsTangentSelected() const;
571 std::pair<int, int> EnvGetSelectedTimeAndValue() const;
572
573 template<typename E>
574 SEditResult<E> DoPropertiesWithState(CUIRect *pToolbox, CProperty *pProps, int *pIds, int *pNewVal, const std::vector<ColorRGBA> &vColors = {});
575 int DoProperties(CUIRect *pToolbox, CProperty *pProps, int *pIds, int *pNewVal, const std::vector<ColorRGBA> &vColors = {});
576
578 const void *m_pColorPickerPopupActiveId = nullptr;
579 void DoColorPickerButton(const void *pId, const CUIRect *pRect, ColorRGBA Color, const std::function<void(ColorRGBA Color)> &SetColor);
580
583 char m_aTooltip[256] = "";
584
586
591
592 enum
593 {
614 };
615
623
624 int m_Mentions = 0;
625 bool m_IngameMoved = false;
626
627 enum
628 {
633 };
634
640 bool (*m_pfnFileDialogFunc)(const char *pFileName, int StorageType, void *pUser);
653
660
662
664 {
671 };
672 std::vector<CFilelistItem> m_vCompleteFileList;
673 std::vector<const CFilelistItem *> m_vpFilteredFileList;
674
675 static bool CompareFilenameAscending(const CFilelistItem *pLhs, const CFilelistItem *pRhs)
676 {
677 if(str_comp(pLhs->m_aFilename, "..") == 0)
678 return true;
679 if(str_comp(pRhs->m_aFilename, "..") == 0)
680 return false;
681 if(pLhs->m_IsLink != pRhs->m_IsLink)
682 return pLhs->m_IsLink;
683 if(pLhs->m_IsDir != pRhs->m_IsDir)
684 return pLhs->m_IsDir;
685 return str_comp_filenames(pLhs->m_aName, pRhs->m_aName) < 0;
686 }
687
688 static bool CompareFilenameDescending(const CFilelistItem *pLhs, const CFilelistItem *pRhs)
689 {
690 if(str_comp(pLhs->m_aFilename, "..") == 0)
691 return true;
692 if(str_comp(pRhs->m_aFilename, "..") == 0)
693 return false;
694 if(pLhs->m_IsLink != pRhs->m_IsLink)
695 return pLhs->m_IsLink;
696 if(pLhs->m_IsDir != pRhs->m_IsDir)
697 return pLhs->m_IsDir;
698 return str_comp_filenames(pLhs->m_aName, pRhs->m_aName) > 0;
699 }
700
701 static bool CompareTimeModifiedAscending(const CFilelistItem *pLhs, const CFilelistItem *pRhs)
702 {
703 if(str_comp(pLhs->m_aFilename, "..") == 0)
704 return true;
705 if(str_comp(pRhs->m_aFilename, "..") == 0)
706 return false;
707 if(pLhs->m_IsLink || pRhs->m_IsLink)
708 return pLhs->m_IsLink;
709 if(pLhs->m_IsDir != pRhs->m_IsDir)
710 return pLhs->m_IsDir;
711 return pLhs->m_TimeModified < pRhs->m_TimeModified;
712 }
713
714 static bool CompareTimeModifiedDescending(const CFilelistItem *pLhs, const CFilelistItem *pRhs)
715 {
716 if(str_comp(pLhs->m_aFilename, "..") == 0)
717 return true;
718 if(str_comp(pRhs->m_aFilename, "..") == 0)
719 return false;
720 if(pLhs->m_IsLink || pRhs->m_IsLink)
721 return pLhs->m_IsLink;
722 if(pLhs->m_IsDir != pRhs->m_IsDir)
723 return pLhs->m_IsDir;
724 return pLhs->m_TimeModified > pRhs->m_TimeModified;
725 }
726
730
731 std::vector<std::string> m_vSelectEntitiesFiles;
733
734 // Zooming
737
739
742
745
748 float m_MouseWorldScale = 1.0f; // Mouse (i.e. UI) scale relative to the World (selected Group)
749 vec2 m_MouseWorldPos = vec2(0.0f, 0.0f);
754 char m_MapEditorId; // UI element ID for the main map editor
755
757 {
761 };
764
770
772 {
778 };
780 float m_aExtraEditorSplits[NUM_EXTRAEDITORS] = {250.0f, 250.0f, 250.0f};
781 float m_ToolBoxWidth = 100.0f;
782
784 {
788 };
791
792 std::vector<int> m_vSelectedLayers;
793 std::vector<int> m_vSelectedQuads;
799 std::vector<std::pair<int, int>> m_vSelectedEnvelopePoints;
805 std::pair<int, int> m_SelectedTangentInPoint;
806 std::pair<int, int> m_SelectedTangentOutPoint;
808
812
813 // Color palette and pipette
815 ColorRGBA m_PipetteColor = ColorRGBA(1.0f, 1.0f, 1.0f, 1.0f);
817
819
821 {
826 };
829
831
832 std::shared_ptr<CLayerGroup> m_pBrush;
833 std::shared_ptr<CLayerTiles> m_pTilesetPicker;
834 std::shared_ptr<CLayerQuads> m_pQuadsetPicker;
835
836 static const void *ms_pUiGotContext;
837
839 std::deque<std::shared_ptr<CDataFileWriterFinishJob>> m_WriterFinishJobs;
840
842
843 static void EnvelopeEval(int TimeOffsetMillis, int Env, ColorRGBA &Result, size_t Channels, void *pUser);
844
848
851 void AddTileart(bool IgnoreHistory = false);
852 void TileartCheckColors();
853
854 void PlaceBorderTiles();
855
856 void UpdateTooltip(const void *pId, const CUIRect *pRect, const char *pToolTip);
857 int DoButton_Editor_Common(const void *pId, const char *pText, int Checked, const CUIRect *pRect, int Flags, const char *pToolTip);
858 int DoButton_Editor(const void *pId, const char *pText, int Checked, const CUIRect *pRect, int Flags, const char *pToolTip);
859 int DoButton_Env(const void *pId, const char *pText, int Checked, const CUIRect *pRect, const char *pToolTip, ColorRGBA Color, int Corners);
860
861 int DoButton_Ex(const void *pId, const char *pText, int Checked, const CUIRect *pRect, int Flags, const char *pToolTip, int Corners, float FontSize = EditorFontSizes::MENU, int Align = TEXTALIGN_MC);
862 int DoButton_FontIcon(const void *pId, const char *pText, int Checked, const CUIRect *pRect, int Flags, const char *pToolTip, int Corners, float FontSize = 10.0f);
863 int DoButton_MenuItem(const void *pId, const char *pText, int Checked, const CUIRect *pRect, int Flags = 0, const char *pToolTip = nullptr);
864
865 int DoButton_DraggableEx(const void *pId, const char *pText, int Checked, const CUIRect *pRect, bool *pClicked, bool *pAbrupted, int Flags, const char *pToolTip = nullptr, int Corners = IGraphics::CORNER_ALL, float FontSize = 10.0f);
866
867 bool DoEditBox(CLineInput *pLineInput, const CUIRect *pRect, float FontSize, int Corners = IGraphics::CORNER_ALL, const char *pToolTip = nullptr, const std::vector<STextColorSplit> &vColorSplits = {});
868 bool DoClearableEditBox(CLineInput *pLineInput, const CUIRect *pRect, float FontSize, int Corners = IGraphics::CORNER_ALL, const char *pToolTip = nullptr, const std::vector<STextColorSplit> &vColorSplits = {});
869
870 void DoMapSettingsEditBox(CMapSettingsBackend::CContext *pContext, const CUIRect *pRect, float FontSize, float DropdownMaxHeight, int Corners = IGraphics::CORNER_ALL, const char *pToolTip = nullptr);
871
872 template<typename T>
873 int DoEditBoxDropdown(SEditBoxDropdownContext *pDropdown, CLineInput *pLineInput, const CUIRect *pEditBoxRect, int x, float MaxHeight, bool AutoWidth, const std::vector<T> &vData, const FDropdownRenderCallback<T> &pfnMatchCallback);
874 template<typename T>
875 int RenderEditBoxDropdown(SEditBoxDropdownContext *pDropdown, CUIRect View, CLineInput *pLineInput, int x, float MaxHeight, bool AutoWidth, const std::vector<T> &vData, const FDropdownRenderCallback<T> &pfnMatchCallback);
876
877 void RenderBackground(CUIRect View, IGraphics::CTextureHandle Texture, float Size, float Brightness) const;
878
879 SEditResult<int> UiDoValueSelector(void *pId, CUIRect *pRect, const char *pLabel, int Current, int Min, int Max, int Step, float Scale, const char *pToolTip, bool IsDegree = false, bool IsHex = false, int Corners = IGraphics::CORNER_ALL, const ColorRGBA *pColor = nullptr, bool ShowValue = true);
880
881 static CUi::EPopupMenuFunctionResult PopupMenuFile(void *pContext, CUIRect View, bool Active);
882 static CUi::EPopupMenuFunctionResult PopupMenuTools(void *pContext, CUIRect View, bool Active);
883 static CUi::EPopupMenuFunctionResult PopupMenuSettings(void *pContext, CUIRect View, bool Active);
884 static CUi::EPopupMenuFunctionResult PopupGroup(void *pContext, CUIRect View, bool Active);
886 {
888 std::vector<std::shared_ptr<CLayerTiles>> m_vpLayers;
889 std::vector<int> m_vLayerIndices;
891 };
892 static CUi::EPopupMenuFunctionResult PopupLayer(void *pContext, CUIRect View, bool Active);
893 static CUi::EPopupMenuFunctionResult PopupQuad(void *pContext, CUIRect View, bool Active);
894 static CUi::EPopupMenuFunctionResult PopupSource(void *pContext, CUIRect View, bool Active);
895 static CUi::EPopupMenuFunctionResult PopupPoint(void *pContext, CUIRect View, bool Active);
896 static CUi::EPopupMenuFunctionResult PopupEnvPoint(void *pContext, CUIRect View, bool Active);
897 static CUi::EPopupMenuFunctionResult PopupEnvPointMulti(void *pContext, CUIRect View, bool Active);
898 static CUi::EPopupMenuFunctionResult PopupEnvPointCurveType(void *pContext, CUIRect View, bool Active);
899 static CUi::EPopupMenuFunctionResult PopupImage(void *pContext, CUIRect View, bool Active);
900 static CUi::EPopupMenuFunctionResult PopupSound(void *pContext, CUIRect View, bool Active);
901 static CUi::EPopupMenuFunctionResult PopupNewFolder(void *pContext, CUIRect View, bool Active);
902 static CUi::EPopupMenuFunctionResult PopupMapInfo(void *pContext, CUIRect View, bool Active);
903 static CUi::EPopupMenuFunctionResult PopupEvent(void *pContext, CUIRect View, bool Active);
904 static CUi::EPopupMenuFunctionResult PopupSelectImage(void *pContext, CUIRect View, bool Active);
905 static CUi::EPopupMenuFunctionResult PopupSelectSound(void *pContext, CUIRect View, bool Active);
906 static CUi::EPopupMenuFunctionResult PopupSelectGametileOp(void *pContext, CUIRect View, bool Active);
907 static CUi::EPopupMenuFunctionResult PopupSelectConfigAutoMap(void *pContext, CUIRect View, bool Active);
908 static CUi::EPopupMenuFunctionResult PopupTele(void *pContext, CUIRect View, bool Active);
909 static CUi::EPopupMenuFunctionResult PopupSpeedup(void *pContext, CUIRect View, bool Active);
910 static CUi::EPopupMenuFunctionResult PopupSwitch(void *pContext, CUIRect View, bool Active);
911 static CUi::EPopupMenuFunctionResult PopupTune(void *pContext, CUIRect View, bool Active);
912 static CUi::EPopupMenuFunctionResult PopupGoto(void *pContext, CUIRect View, bool Active);
913 static CUi::EPopupMenuFunctionResult PopupEntities(void *pContext, CUIRect View, bool Active);
914 static CUi::EPopupMenuFunctionResult PopupProofMode(void *pContext, CUIRect View, bool Active);
915 static CUi::EPopupMenuFunctionResult PopupAnimateSettings(void *pContext, CUIRect View, bool Active);
917 static CUi::EPopupMenuFunctionResult PopupEnvelopeCurvetype(void *pContext, CUIRect View, bool Active);
918
919 static bool CallbackOpenMap(const char *pFileName, int StorageType, void *pUser);
920 static bool CallbackAppendMap(const char *pFileName, int StorageType, void *pUser);
921 static bool CallbackSaveMap(const char *pFileName, int StorageType, void *pUser);
922 static bool CallbackSaveCopyMap(const char *pFileName, int StorageType, void *pUser);
923 static bool CallbackAddTileart(const char *pFilepath, int StorageType, void *pUser);
924 static bool CallbackSaveImage(const char *pFileName, int StorageType, void *pUser);
925 static bool CallbackSaveSound(const char *pFileName, int StorageType, void *pUser);
926 static bool CallbackCustomEntities(const char *pFileName, int StorageType, void *pUser);
927
928 void PopupSelectImageInvoke(int Current, float x, float y);
930
931 void PopupSelectGametileOpInvoke(float x, float y);
933
934 void PopupSelectConfigAutoMapInvoke(int Current, float x, float y);
936
937 void PopupSelectSoundInvoke(int Current, float x, float y);
939
940 void DoQuadEnvelopes(const std::vector<CQuad> &vQuads, IGraphics::CTextureHandle Texture = IGraphics::CTextureHandle());
941 void DoQuadEnvPoint(const CQuad *pQuad, int QIndex, int pIndex);
942 void DoQuadPoint(int LayerIndex, const std::shared_ptr<CLayerQuads> &pLayer, CQuad *pQuad, int QuadIndex, int v);
943 void SetHotQuadPoint(const std::shared_ptr<CLayerQuads> &pLayer);
944
945 float TriangleArea(vec2 A, vec2 B, vec2 C);
946 bool IsInTriangle(vec2 Point, vec2 A, vec2 B, vec2 C);
947 void DoQuadKnife(int QuadIndex);
948
949 void DoSoundSource(int LayerIndex, CSoundSource *pSource, int Index);
950
951 enum class EAxis
952 {
953 AXIS_NONE = 0,
954 AXIS_X,
955 AXIS_Y
956 };
958 {
959 enum
960 {
967 };
969 };
970 void DoMapEditor(CUIRect View);
971 void DoToolbarLayers(CUIRect Toolbar);
972 void DoToolbarImages(CUIRect Toolbar);
973 void DoToolbarSounds(CUIRect Toolbar);
974 void DoQuad(int LayerIndex, const std::shared_ptr<CLayerQuads> &pLayer, CQuad *pQuad, int Index);
975 void PreparePointDrag(const std::shared_ptr<CLayerQuads> &pLayer, CQuad *pQuad, int QuadIndex, int PointIndex);
976 void DoPointDrag(const std::shared_ptr<CLayerQuads> &pLayer, CQuad *pQuad, int QuadIndex, int PointIndex, int OffsetX, int OffsetY);
977 EAxis GetDragAxis(int OffsetX, int OffsetY) const;
978 void DrawAxis(EAxis Axis, CPoint &OriginalPoint, CPoint &Point) const;
979 void DrawAABB(const SAxisAlignedBoundingBox &AABB, int OffsetX = 0, int OffsetY = 0) const;
980 ColorRGBA GetButtonColor(const void *pId, int Checked);
981
982 // Alignment methods
983 // These methods take `OffsetX` and `OffsetY` because the calculations are made with the original positions
984 // of the quad(s), before we started dragging. This allows us to edit `OffsetX` and `OffsetY` based on the previously
985 // calculated alignments.
987 {
988 CPoint m_AlignedPoint; // The "aligned" point, which we want to align/snap to
989 union
990 {
991 // The current changing value when aligned to this point. When aligning to a point on the X axis, then the X value is changing because
992 // we aligned the Y values (X axis aligned => Y values are the same, Y axis aligned => X values are the same).
993 int m_X;
994 int m_Y;
995 };
996 EAxis m_Axis; // The axis we are aligning on
997 int m_PointIndex; // The point index we are aligning
998 int m_Diff; // Store the difference
999 };
1000 void ComputePointAlignments(const std::shared_ptr<CLayerQuads> &pLayer, CQuad *pQuad, int QuadIndex, int PointIndex, int OffsetX, int OffsetY, std::vector<SAlignmentInfo> &vAlignments, bool Append = false) const;
1001 void ComputePointsAlignments(const std::shared_ptr<CLayerQuads> &pLayer, bool Pivot, int OffsetX, int OffsetY, std::vector<SAlignmentInfo> &vAlignments) const;
1002 void ComputeAABBAlignments(const std::shared_ptr<CLayerQuads> &pLayer, const SAxisAlignedBoundingBox &AABB, int OffsetX, int OffsetY, std::vector<SAlignmentInfo> &vAlignments) const;
1003 void DrawPointAlignments(const std::vector<SAlignmentInfo> &vAlignments, int OffsetX, int OffsetY) const;
1004 void QuadSelectionAABB(const std::shared_ptr<CLayerQuads> &pLayer, SAxisAlignedBoundingBox &OutAABB);
1005 void ApplyAlignments(const std::vector<SAlignmentInfo> &vAlignments, int &OffsetX, int &OffsetY);
1006 void ApplyAxisAlignment(int &OffsetX, int &OffsetY) const;
1007
1008 bool ReplaceImage(const char *pFilename, int StorageType, bool CheckDuplicate);
1009 static bool ReplaceImageCallback(const char *pFilename, int StorageType, void *pUser);
1010 bool ReplaceSound(const char *pFileName, int StorageType, bool CheckDuplicate);
1011 static bool ReplaceSoundCallback(const char *pFileName, int StorageType, void *pUser);
1012 static bool AddImage(const char *pFilename, int StorageType, void *pUser);
1013 static bool AddSound(const char *pFileName, int StorageType, void *pUser);
1014 static bool IsAssetUsed(int FileType, int Index, void *pUser);
1015
1016 bool IsEnvelopeUsed(int EnvelopeIndex) const;
1017 void RemoveUnusedEnvelopes();
1018
1019 static bool IsVanillaImage(const char *pImage);
1020
1021 void RenderLayers(CUIRect LayersBox);
1022 void RenderImagesList(CUIRect Toolbox);
1023 void RenderSelectedImage(CUIRect View);
1024 void RenderSounds(CUIRect Toolbox);
1025 void RenderModebar(CUIRect View);
1026 void RenderStatusbar(CUIRect View, CUIRect *pTooltipRect);
1027 void RenderTooltip(CUIRect TooltipRect);
1028
1029 void RenderEnvelopeEditor(CUIRect View);
1030
1032 void RenderServerSettingsEditor(CUIRect View, bool ShowServerSettingsEditorLast);
1033 static void MapSettingsDropdownRenderCallback(const SPossibleValueMatch &Match, char (&aOutput)[128], std::vector<STextColorSplit> &vColorSplits);
1034
1035 void RenderEditorHistory(CUIRect View);
1036
1037 enum class EDragSide // Which side is the drag bar on
1038 {
1039 SIDE_BOTTOM,
1040 SIDE_LEFT,
1041 SIDE_TOP,
1042 SIDE_RIGHT
1043 };
1044 void DoEditorDragBar(CUIRect View, CUIRect *pDragBar, EDragSide Side, float *pValue, float MinValue = 100.0f, float MaxValue = 400.0f);
1045
1046 void SetHotEnvelopePoint(const CUIRect &View, const std::shared_ptr<CEnvelope> &pEnvelope, int ActiveChannels);
1047
1048 void RenderMenubar(CUIRect Menubar);
1049 void RenderFileDialog();
1050
1051 void SelectGameLayer();
1052 std::vector<int> SortImages();
1053
1054 void DoAudioPreview(CUIRect View, const void *pPlayPauseButtonId, const void *pStopButtonId, const void *pSeekBarId, int SampleId);
1055
1056 // Tile Numbers For Explanations - TODO: Add/Improve tiles and explanations
1057 enum
1058 {
1063
1072
1075 };
1076
1077 enum
1078 {
1085
1088
1100
1105
1106 enum
1107 {
1119 };
1120
1121 // Explanations
1122 enum class EExplanation
1123 {
1124 NONE,
1125 DDNET,
1126 FNG,
1127 RACE,
1128 VANILLA,
1129 BLOCKWORLDS
1130 };
1131 static const char *ExplainDDNet(int Tile, int Layer);
1132 static const char *ExplainFNG(int Tile, int Layer);
1133 static const char *ExplainVanilla(int Tile, int Layer);
1134 static const char *Explain(EExplanation Explanation, int Tile, int Layer);
1135
1136 // Zooming
1137 void ZoomAdaptOffsetX(float ZoomFactor, const CUIRect &View);
1138 void UpdateZoomEnvelopeX(const CUIRect &View);
1139
1140 void ZoomAdaptOffsetY(float ZoomFactor, const CUIRect &View);
1141 void UpdateZoomEnvelopeY(const CUIRect &View);
1142
1143 void ResetZoomEnvelope(const std::shared_ptr<CEnvelope> &pEnvelope, int ActiveChannels);
1144 void RemoveTimeOffsetEnvelope(const std::shared_ptr<CEnvelope> &pEnvelope);
1145 float ScreenToEnvelopeX(const CUIRect &View, float x) const;
1146 float EnvelopeToScreenX(const CUIRect &View, float x) const;
1147 float ScreenToEnvelopeY(const CUIRect &View, float y) const;
1148 float EnvelopeToScreenY(const CUIRect &View, float y) const;
1149 float ScreenToEnvelopeDX(const CUIRect &View, float DeltaX);
1150 float ScreenToEnvelopeDY(const CUIRect &View, float DeltaY);
1151
1152 // DDRace
1153
1159
1160 unsigned char m_TeleNumber;
1162 unsigned char m_ViewTeleNumber;
1163
1164 unsigned char m_TuningNum;
1165
1166 unsigned char m_SpeedupForce;
1167 unsigned char m_SpeedupMaxSpeed;
1169
1170 unsigned char m_SwitchNum;
1171 unsigned char m_SwitchDelay;
1172 unsigned char m_ViewSwitch;
1173
1174 void AdjustBrushSpecialTiles(bool UseNextFree, int Adjust = 0);
1176 int FindNextFreeTeleNumber(bool Checkpoint = false);
1177
1178 // Undo/Redo
1184
1185private:
1186 void UndoLastAction();
1187 void RedoLastAction();
1188
1189 std::map<int, CPoint[5]> m_QuadDragOriginalPoints;
1190};
1191
1192// make sure to inline this function
1193inline class IGraphics *CLayer::Graphics() { return m_pEditor->Graphics(); }
1195
1196#endif
Definition: config.h:23
Definition: editor.h:253
void Run() override
Definition: editor.h:258
CDataFileWriter m_Writer
Definition: editor.h:256
const char * GetRealFileName() const
Definition: editor.h:271
const char * GetTempFileName() const
Definition: editor.h:272
char m_aTempFileName[IO_MAX_PATH_LENGTH]
Definition: editor.h:255
CDataFileWriterFinishJob(const char *pRealFileName, const char *pTempFileName, CDataFileWriter &&Writer)
Definition: editor.h:264
char m_aRealFileName[IO_MAX_PATH_LENGTH]
Definition: editor.h:254
Definition: datafile.h:71
void Finish()
Definition: datafile.cpp:770
Definition: editor_history.h:11
Definition: image.h:10
Definition: editor.h:104
char m_aAuthor[32]
Definition: editor.h:106
char m_aCredits[128]
Definition: editor.h:108
void Copy(const CMapInfo &Source)
Definition: editor.h:119
char m_aVersion[16]
Definition: editor.h:107
void Reset()
Definition: editor.h:111
char m_aLicense[32]
Definition: editor.h:109
Definition: editor.h:74
bool m_Modified
Definition: editor.h:91
void VisitEnvelopeReferences(F &&Visitor)
Definition: map.cpp:51
CMapInfo m_MapInfoTmp
Definition: editor.h:128
CEditor * m_pEditor
Definition: editor.h:79
void MakeGameGroup(std::shared_ptr< CLayerGroup > pGroup)
Definition: map.cpp:90
void OnModify()
Definition: map.cpp:5
std::vector< CEditorMapSetting > m_vSettings
Definition: editor.h:130
void MakeTuneLayer(const std::shared_ptr< CLayer > &pLayer)
Definition: map.cpp:174
float m_LastSaveTime
Definition: editor.h:94
void CreateDefault(IGraphics::CTextureHandle EntitiesTexture)
Definition: map.cpp:122
void PerformSanityChecks(const std::function< void(const char *pErrorMessage)> &ErrorHandler)
Definition: map_io.cpp:1049
std::shared_ptr< class CLayerSpeedup > m_pSpeedupLayer
Definition: editor.h:211
void SwapEnvelopes(int Index0, int Index1)
Definition: map.cpp:29
std::vector< std::shared_ptr< CLayerGroup > > m_vpGroups
Definition: editor.h:98
std::vector< std::shared_ptr< CEditorImage > > m_vpImages
Definition: editor.h:99
float m_LastAutosaveUpdateTime
Definition: editor.h:95
std::shared_ptr< CEnvelope > NewEnvelope(CEnvelope::EType Type)
Definition: editor.h:135
bool PerformPreSaveSanityChecks(const std::function< void(const char *pErrorMessage)> &ErrorHandler)
Definition: map_io.cpp:411
void DeleteGroup(int Index)
Definition: editor.h:170
std::vector< std::shared_ptr< CEditorSound > > m_vpSounds
Definition: editor.h:101
void Clean()
Definition: map.cpp:97
void DeleteEnvelope(int Index)
Definition: map.cpp:12
void ModifyImageIndex(FIndexModifyFunction pfnFunc)
Definition: editor.h:178
float m_LastModifiedTime
Definition: editor.h:93
void MakeSpeedupLayer(const std::shared_ptr< CLayer > &pLayer)
Definition: map.cpp:156
bool Load(const char *pFilename, int StorageType, const std::function< void(const char *pErrorMessage)> &ErrorHandler)
Definition: map_io.cpp:439
CEditorMap()
Definition: editor.h:81
CMapInfo m_MapInfo
Definition: editor.h:127
void MakeTeleLayer(const std::shared_ptr< CLayer > &pLayer)
Definition: map.cpp:150
std::vector< std::shared_ptr< CEnvelope > > m_vpEnvelopes
Definition: editor.h:100
bool m_ModifiedAuto
Definition: editor.h:92
void MakeSwitchLayer(const std::shared_ptr< CLayer > &pLayer)
Definition: map.cpp:168
void ModifyEnvelopeIndex(FIndexModifyFunction pfnFunc)
Definition: editor.h:185
std::shared_ptr< CLayerGroup > m_pGameGroup
Definition: editor.h:133
void ModifySoundIndex(FIndexModifyFunction pfnFunc)
Definition: editor.h:192
void MakeGameLayer(const std::shared_ptr< CLayer > &pLayer)
Definition: map.cpp:84
std::shared_ptr< class CLayerFront > m_pFrontLayer
Definition: editor.h:212
void MakeFrontLayer(const std::shared_ptr< CLayer > &pLayer)
Definition: map.cpp:162
std::shared_ptr< class CLayerTele > m_pTeleLayer
Definition: editor.h:210
std::shared_ptr< class CLayerTune > m_pTuneLayer
Definition: editor.h:214
~CEditorMap()
Definition: editor.h:86
std::shared_ptr< class CLayerSwitch > m_pSwitchLayer
Definition: editor.h:213
int SwapGroups(int Index0, int Index1)
Definition: editor.h:157
std::shared_ptr< class CLayerGame > m_pGameLayer
Definition: editor.h:132
bool Save(const char *pFilename, const std::function< void(const char *pErrorMessage)> &ErrorHandler)
Definition: map_io.cpp:37
std::shared_ptr< CLayerGroup > NewGroup()
Definition: editor.h:148
Definition: sound.h:8
Definition: editor.h:469
CHoverTile(int Group, int Layer, int x, int y, const CTile Tile)
Definition: editor.h:471
int m_Layer
Definition: editor.h:481
const CTile m_Tile
Definition: editor.h:484
int m_Group
Definition: editor.h:480
int m_X
Definition: editor.h:482
int m_Y
Definition: editor.h:483
Definition: editor.h:276
int FindNextFreeTeleNumber(bool Checkpoint=false)
Definition: editor.cpp:9253
static const char * ExplainFNG(int Tile, int Layer)
Definition: explanations.cpp:491
IGraphics::CTextureHandle GetSpeedupTexture()
Definition: editor.cpp:8484
unsigned char m_SpeedupForce
Definition: editor.h:1166
int m_ShiftBy
Definition: editor.h:841
static CUi::EPopupMenuFunctionResult PopupSelectImage(void *pContext, CUIRect View, bool Active)
Definition: popups.cpp:2221
class IStorage * m_pStorage
Definition: editor.h:286
static CUi::EPopupMenuFunctionResult PopupMenuFile(void *pContext, CUIRect View, bool Active)
Definition: popups.cpp:24
CEditorMap m_Map
Definition: editor.h:838
CEditorHistory m_EnvelopeEditorHistory
Definition: editor.h:1181
void OnClose() override
Definition: editor.cpp:8896
int m_QuadKnifeCount
Definition: editor.h:810
int DoButton_DraggableEx(const void *pId, const char *pText, int Checked, const CUIRect *pRect, bool *pClicked, bool *pAbrupted, int Flags, const char *pToolTip=nullptr, int Corners=IGraphics::CORNER_ALL, float FontSize=10.0f)
Definition: editor.cpp:262
void DoColorPickerButton(const void *pId, const CUIRect *pRect, ColorRGBA Color, const std::function< void(ColorRGBA Color)> &SetColor)
Definition: editor.cpp:3711
int DoButton_Env(const void *pId, const char *pText, int Checked, const CUIRect *pRect, const char *pToolTip, ColorRGBA Color, int Corners)
Definition: editor.cpp:206
int m_FileDialogStorageType
Definition: editor.h:635
int PopupSelectGameTileOpResult()
Definition: popups.cpp:2399
bool m_ShowMousePointer
Definition: editor.h:743
int m_ToolbarPreviewSound
Definition: editor.h:661
char m_aFileSaveName[IO_MAX_PATH_LENGTH]
Definition: editor.h:589
void ZoomAdaptOffsetY(float ZoomFactor, const CUIRect &View)
Definition: editor.cpp:6023
void RenderPressedKeys(CUIRect View)
Definition: editor.cpp:8257
static CUi::EPopupMenuFunctionResult PopupLayer(void *pContext, CUIRect View, bool Active)
Definition: popups.cpp:682
static bool CallbackCustomEntities(const char *pFileName, int StorageType, void *pUser)
Definition: editor.cpp:941
bool IsNonGameTileLayerSelected() const
Definition: quick_actions.cpp:142
void DoMapSettingsEditBox(CMapSettingsBackend::CContext *pContext, const CUIRect *pRect, float FontSize, float DropdownMaxHeight, int Corners=IGraphics::CORNER_ALL, const char *pToolTip=nullptr)
Definition: editor_server_settings.cpp:289
void DoMapEditor(CUIRect View)
Definition: editor.cpp:3046
CPrompt m_Prompt
Definition: editor.h:293
int RenderEditBoxDropdown(SEditBoxDropdownContext *pDropdown, CUIRect View, CLineInput *pLineInput, int x, float MaxHeight, bool AutoWidth, const std::vector< T > &vData, const FDropdownRenderCallback< T > &pfnMatchCallback)
Definition: editor_server_settings.cpp:463
char m_aFileName[IO_MAX_PATH_LENGTH]
Definition: editor.h:587
bool m_IngameMoved
Definition: editor.h:625
IGraphics::CTextureHandle GetFrontTexture()
Definition: editor.cpp:8470
int m_SelectedSource
Definition: editor.h:804
int m_FilePreviewImageWidth
Definition: editor.h:657
bool m_BrushColorEnabled
Definition: editor.h:585
float m_AnimateSpeed
Definition: editor.h:768
std::vector< int > SortImages()
Definition: editor.cpp:4764
static bool ReplaceSoundCallback(const char *pFileName, int StorageType, void *pUser)
Definition: editor.cpp:4701
bool m_ValidSaveFilename
Definition: editor.h:590
bool m_EditorWasUsedBefore
Definition: editor.h:295
IGraphics::CTextureHandle GetTuneTexture()
Definition: editor.cpp:8498
void RenderEnvelopeEditor(CUIRect View)
Definition: editor.cpp:6277
void DeselectQuads()
Definition: editor.cpp:520
static CUi::EPopupMenuFunctionResult PopupSource(void *pContext, CUIRect View, bool Active)
Definition: popups.cpp:1057
CMapSettingsBackend::CContext m_MapSettingsCommandContext
Definition: editor.h:847
bool HasUnsavedData() const override
Definition: editor.h:496
CLineInputBuffered< IO_MAX_PATH_LENGTH > m_FileDialogFilterInput
Definition: editor.h:646
std::shared_ptr< CLayerTiles > m_pTilesetPicker
Definition: editor.h:833
IGraphics::CTextureHandle m_FrontTexture
Definition: editor.h:299
int DoButton_Editor(const void *pId, const char *pText, int Checked, const CUIRect *pRect, int Flags, const char *pToolTip)
Definition: editor.cpp:197
unsigned char m_ViewSwitch
Definition: editor.h:1172
void DeleteSelectedLayer()
Definition: quick_actions.cpp:193
CLayerSelector m_LayerSelector
Definition: editor.h:292
void DoQuadPoint(int LayerIndex, const std::shared_ptr< CLayerQuads > &pLayer, CQuad *pQuad, int QuadIndex, int v)
Definition: editor.cpp:2343
void RenderMousePointer()
Definition: editor.cpp:8365
void * m_pFileDialogUser
Definition: editor.h:641
void AddGroup()
Definition: quick_actions.cpp:49
vec2 m_MouseDeltaWorld
Definition: editor.h:751
void Init() override
Definition: editor.cpp:8512
static CUi::EPopupMenuFunctionResult PopupGoto(void *pContext, CUIRect View, bool Active)
Definition: popups.cpp:2761
bool m_ShowPicker
Definition: editor.h:790
std::map< const char *, CUi::SMessagePopupContext *, SStringKeyComparator > m_PopupMessageContexts
Definition: editor.h:520
std::vector< CHoverTile > m_vHoverTiles
Definition: editor.h:486
void OnUpdate() override
Definition: editor.cpp:8803
int m_FilesSelectedIndex
Definition: editor.h:651
void PopupSelectImageInvoke(int Current, float x, float y)
Definition: popups.cpp:2283
void DoQuadEnvelopes(const std::vector< CQuad > &vQuads, IGraphics::CTextureHandle Texture=IGraphics::CTextureHandle())
Definition: editor.cpp:2818
void OnDialogClose() override
Definition: editor.cpp:8906
std::vector< CQuad * > GetSelectedQuads()
Definition: editor.cpp:465
static CUi::EPopupMenuFunctionResult PopupSwitch(void *pContext, CUIRect View, bool Active)
Definition: popups.cpp:2636
const void * m_pContainerPannedLast
Definition: editor.h:753
void SelectNextLayer()
Definition: editor.cpp:741
unsigned char m_SpeedupMaxSpeed
Definition: editor.h:1167
float ScreenToEnvelopeDX(const CUIRect &View, float DeltaX)
Definition: editor.cpp:6120
bool Save(const char *pFilename) override
Definition: editor.cpp:8932
IGraphics::CTextureHandle m_TuneTexture
Definition: editor.h:303
CUi * Ui()
Definition: editor.h:328
vec2 m_MouseWorldNoParaPos
Definition: editor.h:750
float m_ToolBoxWidth
Definition: editor.h:781
void RenderMenubar(CUIRect Menubar)
Definition: editor.cpp:7835
@ TILE_FNG_SPIKE_OLD3
Definition: editor.h:1103
@ TILE_FNG_SPIKE_RED
Definition: editor.h:1081
@ TILE_FNG_LASER
Definition: editor.h:1099
@ TILE_FNG_SHOTGUN
Definition: editor.h:1096
@ TILE_FNG_SPIKE_GOLD
Definition: editor.h:1079
@ TILE_FNG_FLAG_BLUE
Definition: editor.h:1093
@ TILE_FNG_SPIKE_BLUE
Definition: editor.h:1082
@ TILE_FNG_SPIKE_OLD2
Definition: editor.h:1102
@ TILE_FNG_SPAWN_RED
Definition: editor.h:1090
@ TILE_FNG_SPIKE_PURPLE
Definition: editor.h:1087
@ TILE_FNG_SPAWN
Definition: editor.h:1089
@ TILE_FNG_NINJA
Definition: editor.h:1098
@ TILE_FNG_SPIKE_OLD1
Definition: editor.h:1101
@ TILE_FNG_FLAG_RED
Definition: editor.h:1092
@ TILE_FNG_HEART
Definition: editor.h:1095
@ TILE_FNG_SCORE_BLUE
Definition: editor.h:1084
@ TILE_FNG_SPAWN_BLUE
Definition: editor.h:1091
@ TILE_FNG_SPIKE_NORMAL
Definition: editor.h:1080
@ TILE_FNG_SCORE_RED
Definition: editor.h:1083
@ TILE_FNG_SHIELD
Definition: editor.h:1094
@ TILE_FNG_GRENADE
Definition: editor.h:1097
@ TILE_FNG_SPIKE_GREEN
Definition: editor.h:1086
IGraphics::CTextureHandle GetEntitiesTexture()
Definition: editor.cpp:8505
IGraphics::CTextureHandle GetTeleTexture()
Definition: editor.cpp:8477
char m_aTileartFilename[IO_MAX_PATH_LENGTH]
Definition: editor.h:850
char m_aFilesSelectedName[IO_MAX_PATH_LENGTH]
Definition: editor.h:645
char m_aFileDialogCurrentFolder[IO_MAX_PATH_LENGTH]
Definition: editor.h:643
bool m_GuiActive
Definition: editor.h:744
IGraphics::CTextureHandle m_FilePreviewImage
Definition: editor.h:654
int DoProperties(CUIRect *pToolbox, CProperty *pProps, int *pIds, int *pNewVal, const std::vector< ColorRGBA > &vColors={})
Definition: editor_props.cpp:12
@ TILE_PUB_CREDITS3
Definition: editor.h:1066
@ TILE_PUB_CREDITS7
Definition: editor.h:1070
@ TILE_PUB_ENTITIES_OFF2
Definition: editor.h:1074
@ TILE_PUB_CREDITS1
Definition: editor.h:1064
@ TILE_PUB_CREDITS6
Definition: editor.h:1069
@ TILE_PUB_CREDITS5
Definition: editor.h:1068
@ TILE_PUB_DEATH
Definition: editor.h:1061
@ TILE_PUB_AIR
Definition: editor.h:1059
@ TILE_PUB_ENTITIES_OFF1
Definition: editor.h:1073
@ TILE_PUB_CREDITS8
Definition: editor.h:1071
@ TILE_PUB_UNHOOKABLE
Definition: editor.h:1062
@ TILE_PUB_CREDITS4
Definition: editor.h:1067
@ TILE_PUB_CREDITS2
Definition: editor.h:1065
@ TILE_PUB_HOOKABLE
Definition: editor.h:1060
char * m_pFileDialogPath
Definition: editor.h:647
EAxis GetDragAxis(int OffsetX, int OffsetY) const
Definition: editor.cpp:1569
char m_aFileNamePending[IO_MAX_PATH_LENGTH]
Definition: editor.h:588
void AddSoundLayer()
Definition: quick_actions.cpp:56
unsigned char m_TeleCheckpointNumber
Definition: editor.h:1161
void ShowFileDialogError(const char *pFormat,...) GNUC_ATTRIBUTE((format(printf
Definition: editor.cpp:5813
void DeleteSelectedQuads()
Definition: editor.cpp:556
int m_PopupEventActivated
Definition: editor.h:617
bool m_LargeLayerWasWarned
Definition: editor.h:619
int FindNextFreeSwitchNumber()
Definition: editor.cpp:9238
void DoEditorDragBar(CUIRect View, CUIRect *pDragBar, EDragSide Side, float *pValue, float MinValue=100.0f, float MaxValue=400.0f)
Definition: editor.cpp:7781
std::pair< int, int > m_SelectedTangentOutPoint
Definition: editor.h:806
class ITextRender * TextRender() const
Definition: editor.h:326
void HandleCursorMovement()
Definition: editor.cpp:8582
void OnRender() override
Definition: editor.cpp:8844
bool m_FileDialogMultipleStorages
Definition: editor.h:649
std::map< int, CPoint[5]> m_QuadDragOriginalPoints
Definition: editor.h:1189
void ToggleSelectQuadPoint(int QuadIndex, int Index)
Definition: editor.cpp:536
void SelectLayer(int LayerIndex, int GroupIndex=-1)
Definition: editor.cpp:487
void LayerSelectImage()
Definition: quick_actions.cpp:161
static bool CallbackSaveMap(const char *pFileName, int StorageType, void *pUser)
Definition: editor.cpp:822
void DoToolbarLayers(CUIRect Toolbar)
Definition: editor.cpp:1059
int m_SelectedQuadPoints
Definition: editor.h:797
CUi::SColorPickerPopupContext m_ColorPickerPopupContext
Definition: editor.h:577
void ResetZoomEnvelope(const std::shared_ptr< CEnvelope > &pEnvelope, int ActiveChannels)
Definition: editor.cpp:6036
bool m_Animate
Definition: editor.h:765
static CUi::EPopupMenuFunctionResult PopupEntities(void *pContext, CUIRect View, bool Active)
Definition: popups.cpp:2805
class IConfigManager * ConfigManager() const
Definition: editor.h:320
static bool CallbackSaveSound(const char *pFileName, int StorageType, void *pUser)
Definition: editor.cpp:913
void SelectGameLayer()
Definition: editor.cpp:4749
vec2 m_aQuadKnifePoints[4]
Definition: editor.h:811
void PopupSelectGametileOpInvoke(float x, float y)
Definition: popups.cpp:2392
const char * m_pFileDialogTitle
Definition: editor.h:638
EAxis
Definition: editor.h:952
bool IsEnvelopeUsed(int EnvelopeIndex) const
Definition: editor.cpp:5949
bool IsTangentSelected() const
Definition: editor.cpp:703
static CUi::EPopupMenuFunctionResult PopupEnvPointMulti(void *pContext, CUIRect View, bool Active)
Definition: popups.cpp:1505
bool IsTangentInSelected() const
Definition: editor.cpp:693
EExplanation
Definition: editor.h:1123
static CUi::EPopupMenuFunctionResult PopupAnimateSettings(void *pContext, CUIRect View, bool Active)
Definition: popups.cpp:2867
bool IsTangentOutSelected() const
Definition: editor.cpp:698
static CUi::EPopupMenuFunctionResult PopupTune(void *pContext, CUIRect View, bool Active)
Definition: popups.cpp:2734
static CUi::EPopupMenuFunctionResult PopupEnvPointCurveType(void *pContext, CUIRect View, bool Active)
Definition: popups.cpp:1522
const CMapView * MapView() const
Definition: editor.h:332
bool Append(const char *pFilename, int StorageType, bool IgnoreHistory=false)
Definition: editor.cpp:8985
void TileartCheckColors()
Definition: tileart.cpp:173
void PopupSelectConfigAutoMapInvoke(int Current, float x, float y)
Definition: popups.cpp:2448
const std::vector< CHoverTile > & HoverTiles() const
Definition: editor.h:487
std::shared_ptr< CLayer > GetSelectedLayer(int Index) const
Definition: editor.cpp:441
float TriangleArea(vec2 A, vec2 B, vec2 C)
Definition: editor.cpp:2569
int DoButton_MenuItem(const void *pId, const char *pText, int Checked, const CUIRect *pRect, int Flags=0, const char *pToolTip=nullptr)
Definition: editor.cpp:218
static CUi::EPopupMenuFunctionResult PopupSpeedup(void *pContext, CUIRect View, bool Active)
Definition: popups.cpp:2597
bool m_QuadKnifeActive
Definition: editor.h:809
unsigned char m_TeleNumber
Definition: editor.h:1160
void AddTeleLayer()
Definition: quick_actions.cpp:131
IGraphics::CTextureHandle m_aCursorTextures[ECursorType::NUM_CURSORS]
Definition: editor.h:827
bool IsEnvPointSelected(int Index, int Channel) const
Definition: editor.cpp:647
bool ReplaceImage(const char *pFilename, int StorageType, bool CheckDuplicate)
Definition: editor.cpp:4460
int m_SelectedEnvelope
Definition: editor.h:798
std::shared_ptr< CLayer > GetSelectedLayerType(int Index, int Type) const
Definition: editor.cpp:457
bool(* m_pfnFileDialogFunc)(const char *pFileName, int StorageType, void *pUser)
Definition: editor.h:640
std::shared_ptr< CLayerGroup > m_pBrush
Definition: editor.h:832
void HandleAutosave()
Definition: editor.cpp:8677
void UpdateColorPipette()
Definition: editor.cpp:8313
static bool ReplaceImageCallback(const char *pFilename, int StorageType, void *pUser)
Definition: editor.cpp:4516
void DoToolbarSounds(CUIRect Toolbar)
Definition: editor.cpp:1423
bool IsTangentInPointSelected(int Index, int Channel) const
Definition: editor.cpp:688
void DoToolbarImages(CUIRect Toolbar)
Definition: editor.cpp:1409
void RenderBackground(CUIRect View, IGraphics::CTextureHandle Texture, float Size, float Brightness) const
Definition: editor.cpp:284
void DoQuadEnvPoint(const CQuad *pQuad, int QIndex, int pIndex)
Definition: editor.cpp:2945
EShowTile
Definition: editor.h:757
@ SHOW_TILE_DECIMAL
Definition: editor.h:759
@ SHOW_TILE_OFF
Definition: editor.h:758
@ SHOW_TILE_HEXADECIMAL
Definition: editor.h:760
void AddFrontLayer()
Definition: quick_actions.cpp:98
CSmoothValue m_ZoomEnvelopeY
Definition: editor.h:736
class IConsole * m_pConsole
Definition: editor.h:281
void AddTileart(bool IgnoreHistory=false)
Definition: tileart.cpp:141
int m_Mode
Definition: editor.h:581
CSoundSource * GetSelectedSource() const
Definition: editor.cpp:477
static const char * ExplainDDNet(int Tile, int Layer)
Definition: explanations.cpp:6
ColorRGBA m_PipetteColor
Definition: editor.h:815
static CUi::EPopupMenuFunctionResult PopupEnvPoint(void *pContext, CUIRect View, bool Active)
Definition: popups.cpp:1332
CEnvelopeEditorOperationTracker m_EnvOpTracker
Definition: editor.h:1183
class IEngine * m_pEngine
Definition: editor.h:282
EShowTile m_ShowTileInfo
Definition: editor.h:762
char m_MapEditorId
Definition: editor.h:754
IGraphics::CTextureHandle m_CheckerTexture
Definition: editor.h:818
CLineInputBuffered< 256 > m_SettingsCommandInput
Definition: editor.h:845
void DoQuadKnife(int QuadIndex)
Definition: editor.cpp:2595
static void MapSettingsDropdownRenderCallback(const SPossibleValueMatch &Match, char(&aOutput)[128], std::vector< STextColorSplit > &vColorSplits)
Definition: editor_server_settings.cpp:1020
int m_SelectedImage
Definition: editor.h:802
static bool CompareTimeModifiedAscending(const CFilelistItem *pLhs, const CFilelistItem *pRhs)
Definition: editor.h:701
char m_aFileDialogCurrentLink[IO_MAX_PATH_LENGTH]
Definition: editor.h:644
bool HandleMapDrop(const char *pFilename, int StorageType) override
Definition: editor.cpp:8945
static bool IsAssetUsed(int FileType, int Index, void *pUser)
Definition: editor.cpp:4706
void RenderModebar(CUIRect View)
Definition: editor.cpp:5838
EShowEnvelope
Definition: editor.h:784
@ SHOWENV_ALL
Definition: editor.h:787
@ SHOWENV_NONE
Definition: editor.h:785
@ SHOWENV_SELECTED
Definition: editor.h:786
static bool CallbackAppendMap(const char *pFileName, int StorageType, void *pUser)
Definition: editor.cpp:806
ECursorType m_CursorType
Definition: editor.h:828
int m_FileDialogLastPopulatedStorageType
Definition: editor.h:636
IGraphics::CTextureHandle m_SpeedupTexture
Definition: editor.h:301
void AddQuadsLayer()
Definition: quick_actions.cpp:77
int DoEditBoxDropdown(SEditBoxDropdownContext *pDropdown, CLineInput *pLineInput, const CUIRect *pEditBoxRect, int x, float MaxHeight, bool AutoWidth, const std::vector< T > &vData, const FDropdownRenderCallback< T > &pfnMatchCallback)
Definition: editor_server_settings.cpp:402
static CUi::EPopupMenuFunctionResult PopupProofMode(void *pContext, CUIRect View, bool Active)
Definition: popups.cpp:2842
float EnvelopeToScreenX(const CUIRect &View, float x) const
Definition: editor.cpp:6105
void SelectTangentOutPoint(int Index, int Channel)
Definition: editor.cpp:671
void AddSpeedupLayer()
Definition: quick_actions.cpp:120
void ApplyAxisAlignment(int &OffsetX, int &OffsetY) const
Definition: editor.cpp:2014
char m_aTooltip[256]
Definition: editor.h:583
int DoButton_Ex(const void *pId, const char *pText, int Checked, const CUIRect *pRect, int Flags, const char *pToolTip, int Corners, float FontSize=EditorFontSizes::MENU, int Align=TEXTALIGN_MC)
Definition: editor.cpp:234
class IInput * Input() const
Definition: editor.h:318
bool DoEditBox(CLineInput *pLineInput, const CUIRect *pRect, float FontSize, int Corners=IGraphics::CORNER_ALL, const char *pToolTip=nullptr, const std::vector< STextColorSplit > &vColorSplits={})
Definition: editor.cpp:114
CMapSettingsBackend m_MapSettingsBackend
Definition: editor.h:846
void RenderServerSettingsEditor(CUIRect View, bool ShowServerSettingsEditorLast)
Definition: editor_server_settings.cpp:55
static bool CallbackOpenMap(const char *pFileName, int StorageType, void *pUser)
Definition: editor.cpp:789
static CUi::EPopupMenuFunctionResult PopupQuad(void *pContext, CUIRect View, bool Active)
Definition: popups.cpp:796
const void * m_pColorPickerPopupActiveId
Definition: editor.h:578
class IStorage * Storage() const
Definition: editor.h:327
std::vector< std::pair< int, int > > m_vSelectedEnvelopePoints
Definition: editor.h:799
void AdjustBrushSpecialTiles(bool UseNextFree, int Adjust=0)
Definition: editor.cpp:9146
vec2 m_MouseWorldPos
Definition: editor.h:749
static CUi::EPopupMenuFunctionResult PopupEnvelopeCurvetype(void *pContext, CUIRect View, bool Active)
Definition: popups.cpp:2924
float m_OffsetEnvelopeY
Definition: editor.h:741
class IGraphics * m_pGraphics
Definition: editor.h:283
int PopupSelectConfigAutoMapResult()
Definition: popups.cpp:2459
class IClient * m_pClient
Definition: editor.h:278
void FreeDynamicPopupMenus()
Definition: editor.cpp:8297
static CUi::EPopupMenuFunctionResult PopupImage(void *pContext, CUIRect View, bool Active)
Definition: popups.cpp:1627
static CUi::EPopupMenuFunctionResult PopupPoint(void *pContext, CUIRect View, bool Active)
Definition: popups.cpp:1248
void RenderTooltip(CUIRect TooltipRect)
Definition: editor.cpp:5932
std::vector< std::reference_wrapper< CEditorComponent > > m_vComponents
Definition: editor.h:290
void ToggleSelectQuad(int Index)
Definition: editor.cpp:511
void DoPointDrag(const std::shared_ptr< CLayerQuads > &pLayer, CQuad *pQuad, int QuadIndex, int PointIndex, int OffsetX, int OffsetY)
Definition: editor.cpp:1563
void SelectTangentInPoint(int Index, int Channel)
Definition: editor.cpp:682
std::vector< std::string > m_vSelectEntitiesFiles
Definition: editor.h:731
static CUi::EPopupMenuFunctionResult PopupSelectSound(void *pContext, CUIRect View, bool Active)
Definition: popups.cpp:2304
IGraphics::CTextureHandle m_SwitchTexture
Definition: editor.h:302
int m_SortByTimeModified
Definition: editor.h:729
EExtraEditor m_ActiveExtraEditor
Definition: editor.h:779
void SetHotQuadPoint(const std::shared_ptr< CLayerQuads > &pLayer)
Definition: editor.cpp:3666
static void EnvelopeEval(int TimeOffsetMillis, int Env, ColorRGBA &Result, size_t Channels, void *pUser)
Definition: editor.cpp:97
EPreviewState
Definition: editor.h:308
@ PREVIEW_UNLOADED
Definition: editor.h:309
@ PREVIEW_ERROR
Definition: editor.h:311
@ PREVIEW_LOADED
Definition: editor.h:310
static CUi::EPopupMenuFunctionResult PopupGroup(void *pContext, CUIRect View, bool Active)
Definition: popups.cpp:419
bool DoClearableEditBox(CLineInput *pLineInput, const CUIRect *pRect, float FontSize, int Corners=IGraphics::CORNER_ALL, const char *pToolTip=nullptr, const std::vector< STextColorSplit > &vColorSplits={})
Definition: editor.cpp:120
void MapDetails()
Definition: quick_actions.cpp:175
int GetTextureUsageFlag() const
Definition: editor.cpp:8465
void SelectQuad(int Index)
Definition: editor.cpp:505
void DrawAABB(const SAxisAlignedBoundingBox &AABB, int OffsetX=0, int OffsetY=0) const
Definition: editor.cpp:1924
int m_PopupEnvelopeSelectedPoint
Definition: editor.h:916
std::vector< int > m_vSelectedQuads
Definition: editor.h:793
int DoButton_Editor_Common(const void *pId, const char *pText, int Checked, const CUIRect *pRect, int Flags, const char *pToolTip)
Definition: editor.cpp:185
CEditorHistory m_EditorHistory
Definition: editor.h:1179
int FindEnvPointIndex(int Index, int Channel) const
Definition: editor.cpp:605
void RenderStatusbar(CUIRect View, CUIRect *pTooltipRect)
Definition: editor.cpp:5906
int m_CurrentQuadIndex
Definition: editor.h:801
float ScreenToEnvelopeX(const CUIRect &View, float x) const
Definition: editor.cpp:6100
static CUi::EPopupMenuFunctionResult PopupNewFolder(void *pContext, CUIRect View, bool Active)
Definition: popups.cpp:1875
static bool CompareTimeModifiedDescending(const CFilelistItem *pLhs, const CFilelistItem *pRhs)
Definition: editor.h:714
void OnIngameMoved() override
Definition: editor.h:499
void QuadSelectionAABB(const std::shared_ptr< CLayerQuads > &pLayer, SAxisAlignedBoundingBox &OutAABB)
Definition: editor.cpp:1948
void void Reset(bool CreateDefault=true)
Definition: editor.cpp:8415
int m_Dialog
Definition: editor.h:582
class IClient * Client() const
Definition: editor.h:319
void UpdateMentions() override
Definition: editor.h:497
void OnActivate() override
Definition: editor.cpp:8885
static const char * ExplainVanilla(int Tile, int Layer)
Definition: explanations.cpp:599
void ComputeAABBAlignments(const std::shared_ptr< CLayerQuads > &pLayer, const SAxisAlignedBoundingBox &AABB, int OffsetX, int OffsetY, std::vector< SAlignmentInfo > &vAlignments) const
Definition: editor.cpp:1788
int m_FilePreviewSound
Definition: editor.h:655
void AddSelectedLayer(int LayerIndex)
Definition: editor.cpp:498
static bool IsVanillaImage(const char *pImage)
Definition: editor.cpp:80
std::pair< int, int > EnvGetSelectedTimeAndValue() const
Definition: editor.cpp:708
void RemoveUnusedEnvelopes()
Definition: editor.cpp:5988
void OnWindowResize() override
Definition: editor.cpp:8891
float m_AnimateTime
Definition: editor.h:767
bool m_ColorPipetteActive
Definition: editor.h:816
bool m_UpdateEnvPointInfo
Definition: editor.h:807
bool m_ResetZoomEnvelope
Definition: editor.h:738
void RenderSavingIndicator(CUIRect View)
Definition: editor.cpp:8279
class ISound * Sound() const
Definition: editor.h:325
std::shared_ptr< CLayerGroup > m_apSavedBrushes[10]
Definition: editor.h:314
void FilelistPopulate(int StorageType, bool KeepSelection=false)
Definition: editor.cpp:5684
class ISound * m_pSound
Definition: editor.h:285
void RemoveTimeOffsetEnvelope(const std::shared_ptr< CEnvelope > &pEnvelope)
Definition: editor.cpp:6130
const void * m_pContainerPanned
Definition: editor.h:752
EDragSide
Definition: editor.h:1038
float ScreenToEnvelopeY(const CUIRect &View, float y) const
Definition: editor.cpp:6110
static CUi::EPopupMenuFunctionResult PopupEvent(void *pContext, CUIRect View, bool Active)
Definition: popups.cpp:2001
@ TILE_VANILLA_FLAG_RED
Definition: editor.h:1111
@ TILE_VANILLA_SPAWN
Definition: editor.h:1108
@ TILE_VANILLA_SHIELD
Definition: editor.h:1113
@ TILE_VANILLA_SHOTGUN
Definition: editor.h:1115
@ TILE_VANILLA_NINJA
Definition: editor.h:1117
@ TILE_VANILLA_GRENADE
Definition: editor.h:1116
@ TILE_VANILLA_HEART
Definition: editor.h:1114
@ TILE_VANILLA_SPAWN_BLUE
Definition: editor.h:1110
@ TILE_VANILLA_SPAWN_RED
Definition: editor.h:1109
@ TILE_VANILLA_LASER
Definition: editor.h:1118
@ TILE_VANILLA_FLAG_BLUE
Definition: editor.h:1112
void DrawPointAlignments(const std::vector< SAlignmentInfo > &vAlignments, int OffsetX, int OffsetY) const
Definition: editor.cpp:1900
void DoQuad(int LayerIndex, const std::shared_ptr< CLayerQuads > &pLayer, CQuad *pQuad, int Index)
Definition: editor.cpp:2023
static bool AddImage(const char *pFilename, int StorageType, void *pUser)
Definition: editor.cpp:4521
bool IsQuadPointSelected(int QuadIndex, int Index) const
Definition: editor.cpp:592
char m_aMenuBackgroundTooltip[256]
Definition: editor.h:746
bool m_AnimateUpdatePopup
Definition: editor.h:769
static const void * ms_pUiGotContext
Definition: editor.h:836
static bool CallbackSaveImage(const char *pFileName, int StorageType, void *pUser)
Definition: editor.cpp:885
class IConsole * Console() const
Definition: editor.h:322
CQuadEditTracker m_QuadTracker
Definition: editor.h:1182
int64_t m_AnimateStart
Definition: editor.h:766
static CUi::EPopupMenuFunctionResult PopupMapInfo(void *pContext, CUIRect View, bool Active)
Definition: popups.cpp:1926
class ITextRender * m_pTextRender
Definition: editor.h:284
int FindSelectedQuadIndex(int Index) const
Definition: editor.cpp:597
const char * m_pFileDialogButtonText
Definition: editor.h:639
int DoButton_FontIcon(const void *pId, const char *pText, int Checked, const CUIRect *pRect, int Flags, const char *pToolTip, int Corners, float FontSize=10.0f)
Definition: editor.cpp:249
void ComputePointsAlignments(const std::shared_ptr< CLayerQuads > &pLayer, bool Pivot, int OffsetX, int OffsetY, std::vector< SAlignmentInfo > &vAlignments) const
Definition: editor.cpp:1725
void ApplyAlignments(const std::vector< SAlignmentInfo > &vAlignments, int &OffsetX, int &OffsetY)
Definition: editor.cpp:1982
void AddTuneLayer()
Definition: quick_actions.cpp:109
int m_SelectedQuadPoint
Definition: editor.h:794
void OnMouseMove(vec2 MousePos)
Definition: editor.cpp:8629
bool CanFillGameTiles() const
Definition: quick_actions.cpp:15
std::vector< CFilelistItem > m_vCompleteFileList
Definition: editor.h:672
bool IsQuadCornerSelected(int Index) const
Definition: editor.cpp:587
CRenderTools m_RenderTools
Definition: editor.h:287
void SetHotEnvelopePoint(const CUIRect &View, const std::shared_ptr< CEnvelope > &pEnvelope, int ActiveChannels)
Definition: editor.cpp:6223
void PreparePointDrag(const std::shared_ptr< CLayerQuads > &pLayer, CQuad *pQuad, int QuadIndex, int PointIndex)
Definition: editor.cpp:1558
IGraphics::CTextureHandle GetSwitchTexture()
Definition: editor.cpp:8491
static CUi::EPopupMenuFunctionResult PopupMenuSettings(void *pContext, CUIRect View, bool Active)
Definition: popups.cpp:219
void ToggleEnvPoint(int Index, int Channel)
Definition: editor.cpp:632
int m_SelectedSound
Definition: editor.h:803
std::shared_ptr< CLayerGroup > GetSelectedGroup() const
Definition: editor.cpp:434
void SelectEnvPoint(int Index)
Definition: editor.cpp:618
float EnvelopeToScreenY(const CUIRect &View, float y) const
Definition: editor.cpp:6115
static CUi::EPopupMenuFunctionResult PopupTele(void *pContext, CUIRect View, bool Active)
Definition: popups.cpp:2471
@ POPEVENT_REMOVE_USED_IMAGE
Definition: editor.h:612
@ POPEVENT_IMAGE_MAX
Definition: editor.h:606
@ POPEVENT_LOAD
Definition: editor.h:595
@ POPEVENT_LARGELAYER
Definition: editor.h:603
@ POPEVENT_SAVE_COPY
Definition: editor.h:600
@ POPEVENT_EXIT
Definition: editor.h:594
@ POPEVENT_SOUND_MAX
Definition: editor.h:607
@ POPEVENT_SAVE_SOUND
Definition: editor.h:602
@ POPEVENT_LOADCURRENT
Definition: editor.h:596
@ POPEVENT_REMOVE_USED_SOUND
Definition: editor.h:613
@ POPEVENT_NEW
Definition: editor.h:598
@ POPEVENT_PIXELART_BIG_IMAGE
Definition: editor.h:609
@ POPEVENT_PREVENTUNUSEDTILES
Definition: editor.h:604
@ POPEVENT_PLACE_BORDER_TILES
Definition: editor.h:608
@ POPEVENT_SAVE
Definition: editor.h:599
@ POPEVENT_SAVE_IMG
Definition: editor.h:601
@ POPEVENT_LOADDROP
Definition: editor.h:597
@ POPEVENT_PIXELART_TOO_MANY_COLORS
Definition: editor.h:611
@ POPEVENT_PIXELART_MANY_COLORS
Definition: editor.h:610
@ POPEVENT_IMAGEDIV16
Definition: editor.h:605
std::string m_SelectEntitiesImage
Definition: editor.h:732
@ FILETYPE_IMG
Definition: editor.h:630
@ FILETYPE_MAP
Definition: editor.h:629
@ NUM_FILETYPES
Definition: editor.h:632
@ FILETYPE_SOUND
Definition: editor.h:631
class IConfigManager * m_pConfigManager
Definition: editor.h:279
class CConfig * Config() const
Definition: editor.h:321
bool m_BrushDrawDestructive
Definition: editor.h:622
class IInput * m_pInput
Definition: editor.h:277
bool m_PreviewZoom
Definition: editor.h:747
float m_OffsetEnvelopeX
Definition: editor.h:740
void RenderMapSettingsErrorDialog()
Definition: editor_server_settings.cpp:547
void AddSwitchLayer()
Definition: quick_actions.cpp:87
ColorRGBA GetButtonColor(const void *pId, int Checked)
Definition: editor.cpp:126
class IEngine * Engine() const
Definition: editor.h:323
static const char * Explain(EExplanation Explanation, int Tile, int Layer)
Definition: explanations.cpp:669
int PopupSelectImageResult()
Definition: popups.cpp:2291
void UpdateZoomEnvelopeX(const CUIRect &View)
Definition: editor.cpp:6016
CMapView * MapView()
Definition: editor.h:331
ECursorType
Definition: editor.h:821
@ NUM_CURSORS
Definition: editor.h:825
@ CURSOR_NORMAL
Definition: editor.h:822
@ CURSOR_RESIZE_V
Definition: editor.h:823
@ CURSOR_RESIZE_H
Definition: editor.h:824
static bool CompareFilenameDescending(const CFilelistItem *pLhs, const CFilelistItem *pRhs)
Definition: editor.h:688
std::pair< int, int > m_SelectedTangentInPoint
Definition: editor.h:805
void RedoLastAction()
Definition: editor.cpp:9136
void HandleWriterFinishJobs()
Definition: editor.cpp:8745
void Render()
Definition: editor.cpp:7923
EPreviewState m_FilePreviewState
Definition: editor.h:656
static bool CompareFilenameAscending(const CFilelistItem *pLhs, const CFilelistItem *pRhs)
Definition: editor.h:675
void ResetIngameMoved() override
Definition: editor.h:500
int m_SelectedGroup
Definition: editor.h:796
class CConfig * m_pConfig
Definition: editor.h:280
bool m_FileDialogSaveAction
Definition: editor.h:637
static const ColorRGBA ms_DefaultPropColor
Definition: editor.h:315
void RenderSelectedImage(CUIRect View)
Definition: editor.cpp:4949
void DeselectQuadPoints()
Definition: editor.cpp:525
int m_SelectedQuadEnvelope
Definition: editor.h:800
CMapView m_MapView
Definition: editor.h:291
IGraphics::CTextureHandle m_EntitiesTexture
Definition: editor.h:297
void PlaceBorderTiles()
Definition: editor.cpp:8559
bool Load(const char *pFilename, int StorageType) override
Definition: editor.cpp:8960
void UpdateZoomEnvelopeY(const CUIRect &View)
Definition: editor.cpp:6029
void RefreshFilteredFileList()
Definition: editor.cpp:5649
short m_SpeedupAngle
Definition: editor.h:1168
bool ReplaceSound(const char *pFileName, int StorageType, bool CheckDuplicate)
Definition: editor.cpp:4649
unsigned char m_ViewTeleNumber
Definition: editor.h:1162
void AddQuadOrSound()
Definition: quick_actions.cpp:23
EExtraEditor
Definition: editor.h:772
@ EXTRAEDITOR_ENVELOPES
Definition: editor.h:774
@ EXTRAEDITOR_NONE
Definition: editor.h:773
@ NUM_EXTRAEDITORS
Definition: editor.h:777
@ EXTRAEDITOR_SERVER_SETTINGS
Definition: editor.h:775
@ EXTRAEDITOR_HISTORY
Definition: editor.h:776
std::shared_ptr< CLayerQuads > m_pQuadsetPicker
Definition: editor.h:834
int m_FileDialogFileType
Definition: editor.h:648
ColorRGBA m_aSavedColors[8]
Definition: editor.h:814
void InvokeFileDialog(int StorageType, int FileType, const char *pTitle, const char *pButtonText, const char *pBasepath, bool FilenameAsDefault, bool(*pfnFunc)(const char *pFilename, int StorageType, void *pUser), void *pUser)
Definition: editor.cpp:5760
void RenderImagesList(CUIRect Toolbox)
Definition: editor.cpp:4798
void PopupSelectSoundInvoke(int Current, float x, float y)
Definition: popups.cpp:2338
static bool AddSound(const char *pFileName, int StorageType, void *pUser)
Definition: editor.cpp:4585
CLineInputBuffered< IO_MAX_PATH_LENGTH > m_FileDialogFileNameInput
Definition: editor.h:642
int m_PopupEventType
Definition: editor.h:616
unsigned char m_TuningNum
Definition: editor.h:1164
void UpdateTooltip(const void *pId, const CUIRect *pRect, const char *pToolTip)
Definition: editor.cpp:177
void DoAudioPreview(CUIRect View, const void *pPlayPauseButtonId, const void *pStopButtonId, const void *pSeekBarId, int SampleId)
Definition: editor.cpp:972
static CUi::EPopupMenuFunctionResult PopupSelectGametileOp(void *pContext, CUIRect View, bool Active)
Definition: popups.cpp:2374
int m_SortByFilename
Definition: editor.h:728
SEditResult< int > UiDoValueSelector(void *pId, CUIRect *pRect, const char *pLabel, int Current, int Min, int Max, int Step, float Scale, const char *pToolTip, bool IsDegree=false, bool IsHex=false, int Corners=IGraphics::CORNER_ALL, const ColorRGBA *pColor=nullptr, bool ShowValue=true)
Definition: editor.cpp:296
int m_AllowPlaceUnusedTiles
Definition: editor.h:621
int m_PopupEventWasActivated
Definition: editor.h:618
float ScreenToEnvelopeDY(const CUIRect &View, float DeltaY)
Definition: editor.cpp:6125
static CUi::EPopupMenuFunctionResult PopupMenuTools(void *pContext, CUIRect View, bool Active)
Definition: popups.cpp:143
void RenderLayers(CUIRect LayersBox)
Definition: editor.cpp:3773
CEditor()
Definition: editor.h:358
void ZoomAdaptOffsetX(float ZoomFactor, const CUIRect &View)
Definition: editor.cpp:6010
int m_SelectedQuadIndex
Definition: editor.h:795
bool IsTangentOutPointSelected(int Index, int Channel) const
Definition: editor.cpp:677
class IGraphics * Graphics() const
Definition: editor.h:324
void AddTileLayer()
Definition: quick_actions.cpp:66
bool m_ShowDetail
Definition: editor.h:763
CRenderTools * RenderTools()
Definition: editor.h:329
int m_Mentions
Definition: editor.h:624
void ComputePointAlignments(const std::shared_ptr< CLayerQuads > &pLayer, CQuad *pQuad, int QuadIndex, int PointIndex, int OffsetX, int OffsetY, std::vector< SAlignmentInfo > &vAlignments, bool Append=false) const
Definition: editor.cpp:1602
bool m_FileDialogOpening
Definition: editor.h:659
CImageInfo m_TileartImageInfo
Definition: editor.h:849
static bool CallbackAddTileart(const char *pFilepath, int StorageType, void *pUser)
Definition: tileart.cpp:192
int m_FilePreviewImageHeight
Definition: editor.h:658
CSmoothValue m_ZoomEnvelopeX
Definition: editor.h:735
void FillGameTiles(EGameTileOp FillTile) const
Definition: quick_actions.cpp:8
static CUi::EPopupMenuFunctionResult PopupSound(void *pContext, CUIRect View, bool Active)
Definition: popups.cpp:1768
void RenderSounds(CUIRect Toolbox)
Definition: editor.cpp:4972
bool IsQuadSelected(int Index) const
Definition: editor.cpp:582
float m_aExtraEditorSplits[NUM_EXTRAEDITORS]
Definition: editor.h:780
std::deque< std::shared_ptr< CDataFileWriterFinishJob > > m_WriterFinishJobs
Definition: editor.h:839
CEditorHistory m_ServerSettingsHistory
Definition: editor.h:1180
bool IsInTriangle(vec2 Point, vec2 A, vec2 B, vec2 C)
Definition: editor.cpp:2574
std::vector< int > m_vSelectedLayers
Definition: editor.h:792
CLayerSelector * LayerSelector()
Definition: editor.h:333
void LoadCurrentMap()
Definition: editor.cpp:8914
void SortFilteredFileList()
Definition: editor.cpp:5090
void DoSoundSource(int LayerIndex, CSoundSource *pSource, int Index)
Definition: editor.cpp:1455
void RenderEditorHistory(CUIRect View)
Definition: editor.cpp:7630
bool PerformAutosave()
Definition: editor.cpp:8709
void SelectPreviousLayer()
Definition: editor.cpp:765
CLineInputBuffered< IO_MAX_PATH_LENGTH > m_FileDialogNewFolderNameInput
Definition: editor.h:652
int PopupSelectSoundResult()
Definition: popups.cpp:2346
SEditResult< E > DoPropertiesWithState(CUIRect *pToolbox, CProperty *pProps, int *pIds, int *pNewVal, const std::vector< ColorRGBA > &vColors={})
Definition: editor_props.cpp:19
unsigned char m_SwitchDelay
Definition: editor.h:1171
void UndoLastAction()
Definition: editor.cpp:9126
void DeselectEnvPoints()
Definition: editor.cpp:664
bool m_PreventUnusedTilesWasWarned
Definition: editor.h:620
bool m_FileDialogShowingRoot
Definition: editor.h:650
void SelectQuadPoint(int QuadIndex, int Index)
Definition: editor.cpp:530
CUi m_UI
Definition: editor.h:288
IGraphics::CTextureHandle m_TeleTexture
Definition: editor.h:300
static bool CallbackSaveCopyMap(const char *pFileName, int StorageType, void *pUser)
Definition: editor.cpp:860
std::vector< const CFilelistItem * > m_vpFilteredFileList
Definition: editor.h:673
unsigned char m_SwitchNum
Definition: editor.h:1170
float m_MouseWorldScale
Definition: editor.h:748
static CUi::EPopupMenuFunctionResult PopupSelectConfigAutoMap(void *pContext, CUIRect View, bool Active)
Definition: popups.cpp:2412
EShowEnvelope m_ShowEnvelopePreview
Definition: editor.h:789
void ResetMentions() override
Definition: editor.h:498
void DrawAxis(EAxis Axis, CPoint &OriginalPoint, CPoint &Point) const
Definition: editor.cpp:1580
void RenderFileDialog()
Definition: editor.cpp:5111
Definition: editor_trackers.h:73
EType
Definition: envelope.h:15
Definition: image.h:12
Definition: layer_group.h:10
Definition: layer_selector.h:7
Definition: layer.h:16
class ITextRender * TextRender()
Definition: editor.h:1194
class CEditor * m_pEditor
Definition: layer.h:18
class IGraphics * Graphics()
Definition: editor.h:1193
Definition: lineinput.h:25
Definition: editor_server_settings.h:227
Definition: editor_server_settings.h:195
Definition: map_view.h:14
Definition: prompt.h:11
Definition: editor.h:223
int m_Max
Definition: editor.h:235
int m_Value
Definition: editor.h:232
int m_Type
Definition: editor.h:233
CProperty(std::nullptr_t)
Definition: editor.h:228
CProperty(const char *pName, int Value, int Type, int Min, int Max)
Definition: editor.h:225
const char * m_pName
Definition: editor.h:231
int m_Min
Definition: editor.h:234
Definition: editor_trackers.h:19
Definition: render.h:188
Definition: smooth_value.h:12
Definition: mapitems.h:236
Definition: ui_rect.h:11
Definition: ui.h:283
EPopupMenuFunctionResult
Definition: ui.h:289
Definition: color.h:173
Definition: color.h:210
Definition: client.h:36
Definition: config.h:9
Definition: console.h:18
Definition: editor.h:8
Definition: engine.h:15
Definition: graphics.h:201
void Invalidate()
Definition: graphics.h:214
Definition: graphics.h:184
@ CORNER_ALL
Definition: graphics.h:416
Definition: input.h:18
Definition: jobs.h:20
Definition: sound.h:12
Definition: storage.h:20
Definition: textrender.h:314
std::function< void(int *pIndex)> FIndexModifyFunction
Definition: editor.h:52
#define REGISTER_QUICK_ACTION(name, text, callback, disabled, active, button_color, description)
Definition: editor.h:354
@ DIALOG_NONE
Definition: editor.h:64
@ DIALOG_QUICK_PROMPT
Definition: editor.h:67
@ DIALOG_FILE
Definition: editor.h:65
@ MODE_SOUNDS
Definition: editor.h:61
@ MODE_LAYERS
Definition: editor.h:59
@ DIALOG_MAPSETTINGS_ERROR
Definition: editor.h:66
@ NUM_MODES
Definition: editor.h:62
@ MODE_IMAGES
Definition: editor.h:60
std::function< void(const T &, char(&aOutput)[128], std::vector< STextColorSplit > &)> FDropdownRenderCallback
Definition: editor.h:54
@ PROPTYPE_NULL
Definition: editor.h:240
@ PROPTYPE_BOOL
Definition: editor.h:241
@ PROPTYPE_SHIFT
Definition: editor.h:247
@ PROPTYPE_COLOR
Definition: editor.h:244
@ PROPTYPE_ENVELOPE
Definition: editor.h:246
@ PROPTYPE_AUTOMAPPER
Definition: editor.h:249
@ PROPTYPE_ANGLE_SCROLL
Definition: editor.h:243
@ PROPTYPE_IMAGE
Definition: editor.h:245
@ PROPTYPE_SOUND
Definition: editor.h:248
@ PROPTYPE_INT
Definition: editor.h:242
EGameTileOp
Definition: enums.h:20
#define E(buf, str)
void mem_zero(T *block, size_t size)
Definition: system.h:178
int str_comp_filenames(const char *a, const char *b)
Definition: system.cpp:2984
int str_comp(const char *a, const char *b)
Definition: system.cpp:2974
int str_copy(char *dst, const char *src, int dst_size)
Definition: system.cpp:2761
#define GNUC_ATTRIBUTE(x)
Definition: log.h:10
static MAYBE_UNUSED constexpr float MENU
Definition: editor_ui.h:19
Definition: editor.h:664
bool m_IsLink
Definition: editor.h:668
bool m_IsDir
Definition: editor.h:667
int m_StorageType
Definition: editor.h:669
time_t m_TimeModified
Definition: editor.h:670
char m_aName[IO_MAX_PATH_LENGTH]
Definition: editor.h:666
char m_aFilename[IO_MAX_PATH_LENGTH]
Definition: editor.h:665
Definition: editor.h:987
int m_Diff
Definition: editor.h:998
CPoint m_AlignedPoint
Definition: editor.h:988
int m_X
Definition: editor.h:993
int m_Y
Definition: editor.h:994
int m_PointIndex
Definition: editor.h:997
EAxis m_Axis
Definition: editor.h:996
Definition: editor.h:958
CPoint m_aPoints[NUM_POINTS]
Definition: editor.h:968
@ NUM_POINTS
Definition: editor.h:966
@ POINT_CENTER
Definition: editor.h:965
@ POINT_TR
Definition: editor.h:962
@ POINT_TL
Definition: editor.h:961
@ POINT_BL
Definition: editor.h:963
@ POINT_BR
Definition: editor.h:964
Definition: editor.h:886
std::vector< int > m_vLayerIndices
Definition: editor.h:889
std::vector< std::shared_ptr< CLayerTiles > > m_vpLayers
Definition: editor.h:888
CLayerTiles::SCommonPropState m_CommonPropState
Definition: editor.h:890
CEditor * m_pEditor
Definition: editor.h:887
Definition: editor.h:514
bool operator()(const char *pLhs, const char *pRhs) const
Definition: editor.h:515
Definition: layer_tiles.h:140
Definition: mapitems.h:223
Definition: mapitems.h:483
Definition: ui.h:727
Definition: editor_ui.h:7
Definition: ui.h:33
Definition: ui.h:272
Definition: editor_server_settings.h:47
#define B(i, j)
@ TEXTALIGN_MC
Definition: textrender.h:35
@ IO_MAX_PATH_LENGTH
Definition: types.h:43
vector2_base< float > vec2
Definition: vmath.h:158