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
388 m_pFileDialogTitle = nullptr;
389 m_pFileDialogButtonText = nullptr;
390 m_pFileDialogUser = nullptr;
392 m_aFileDialogCurrentLink[0] = '\0';
393 m_aFilesSelectedName[0] = '\0';
395 m_FileDialogOpening = false;
397
401
403
404 m_SelectEntitiesImage = "DDNet";
405
406 m_ResetZoomEnvelope = true;
407 m_OffsetEnvelopeX = 0.1f;
408 m_OffsetEnvelopeY = 0.5f;
409
410 m_ShowMousePointer = true;
411
412 m_GuiActive = true;
413 m_PreviewZoom = false;
414
416 m_ShowDetail = true;
417 m_Animate = false;
418 m_AnimateStart = 0;
419 m_AnimateTime = 0;
420 m_AnimateSpeed = 1;
421 m_AnimateUpdatePopup = false;
422
425
427 m_UpdateEnvPointInfo = false;
428 m_SelectedTangentInPoint = std::pair(-1, -1);
429 m_SelectedTangentOutPoint = std::pair(-1, -1);
431
432 m_QuadKnifeActive = false;
435
436 for(size_t i = 0; i < std::size(m_aSavedColors); ++i)
437 {
438 m_aSavedColors[i] = color_cast<ColorRGBA>(ColorHSLA(i / (float)std::size(m_aSavedColors), 1.0f, 0.5f));
439 }
440
443 for(auto &CursorTexture : m_aCursorTextures)
444 CursorTexture.Invalidate();
445
447
448 ms_pUiGotContext = nullptr;
449
450 // DDRace
451
453 m_TeleNumbers = {
454 {TILE_TELEINEVIL, 1},
456 {TILE_TELEINHOOK, 1},
457 {TILE_TELEIN, 1},
458 {TILE_TELEOUT, 1},
459 {TILE_TELECHECK, 1},
460 {TILE_TELECHECKOUT, 1}};
461
462 m_SwitchNum = 1;
463 m_TuningNum = 1;
464 m_SwitchDelay = 0;
465 m_SpeedupForce = 50;
467 m_SpeedupAngle = 0;
468 m_LargeLayerWasWarned = false;
472 }
473
475 {
476 public:
477 CHoverTile(int Group, int Layer, int x, int y, const CTile Tile) :
478 m_Group(Group),
479 m_Layer(Layer),
480 m_X(x),
481 m_Y(y),
482 m_Tile(Tile)
483 {
484 }
485
488 int m_X;
489 int m_Y;
491 };
492 std::vector<CHoverTile> m_vHoverTiles;
493 const std::vector<CHoverTile> &HoverTiles() const { return m_vHoverTiles; }
494
495 void Init() override;
496 void OnUpdate() override;
497 void OnRender() override;
498 void OnActivate() override;
499 void OnWindowResize() override;
500 void OnClose() override;
501 void OnDialogClose() override;
502 bool HasUnsavedData() const override { return m_Map.m_Modified; }
503 void UpdateMentions() override { m_Mentions++; }
504 void ResetMentions() override { m_Mentions = 0; }
505 void OnIngameMoved() override { m_IngameMoved = true; }
506 void ResetIngameMoved() override { m_IngameMoved = false; }
507
509 void OnMouseMove(vec2 MousePos);
510 void HandleAutosave();
511 bool PerformAutosave();
513
515 void FilelistPopulate(int StorageType, bool KeepSelection = false);
516 void InvokeFileDialog(int StorageType, int FileType, const char *pTitle, const char *pButtonText,
517 const char *pBasepath, bool FilenameAsDefault,
518 bool (*pfnFunc)(const char *pFilename, int StorageType, void *pUser), void *pUser);
520 {
521 bool operator()(const char *pLhs, const char *pRhs) const
522 {
523 return str_comp(pLhs, pRhs) < 0;
524 }
525 };
526 std::map<const char *, CUi::SMessagePopupContext *, SStringKeyComparator> m_PopupMessageContexts;
527 void ShowFileDialogError(const char *pFormat, ...)
528 GNUC_ATTRIBUTE((format(printf, 2, 3)));
529
530 void Reset(bool CreateDefault = true);
531 bool Save(const char *pFilename) override;
532 bool Load(const char *pFilename, int StorageType) override;
533 bool HandleMapDrop(const char *pFilename, int StorageType) override;
534 bool Append(const char *pFilename, int StorageType, bool IgnoreHistory = false);
535 void LoadCurrentMap();
536 void Render();
537
538 void RenderPressedKeys(CUIRect View);
541 void UpdateColorPipette();
542 void RenderMousePointer();
543
544 std::vector<CQuad *> GetSelectedQuads();
545 std::shared_ptr<CLayer> GetSelectedLayerType(int Index, int Type) const;
546 std::shared_ptr<CLayer> GetSelectedLayer(int Index) const;
547 std::shared_ptr<CLayerGroup> GetSelectedGroup() const;
549 void SelectLayer(int LayerIndex, int GroupIndex = -1);
550 void AddSelectedLayer(int LayerIndex);
551 void SelectQuad(int Index);
552 void ToggleSelectQuad(int Index);
553 void DeselectQuads();
554 void DeselectQuadPoints();
555 void SelectQuadPoint(int QuadIndex, int Index);
556 void ToggleSelectQuadPoint(int QuadIndex, int Index);
557 void DeleteSelectedQuads();
558 bool IsQuadSelected(int Index) const;
559 bool IsQuadCornerSelected(int Index) const;
560 bool IsQuadPointSelected(int QuadIndex, int Index) const;
561 int FindSelectedQuadIndex(int Index) const;
562
563 int FindEnvPointIndex(int Index, int Channel) const;
564 void SelectEnvPoint(int Index);
565 void SelectEnvPoint(int Index, int Channel);
566 void ToggleEnvPoint(int Index, int Channel);
567 bool IsEnvPointSelected(int Index, int Channel) const;
568 bool IsEnvPointSelected(int Index) const;
569 void DeselectEnvPoints();
570 void SelectTangentOutPoint(int Index, int Channel);
571 bool IsTangentOutPointSelected(int Index, int Channel) const;
572 void SelectTangentInPoint(int Index, int Channel);
573 bool IsTangentInPointSelected(int Index, int Channel) const;
574 bool IsTangentInSelected() const;
575 bool IsTangentOutSelected() const;
576 bool IsTangentSelected() const;
577 std::pair<int, int> EnvGetSelectedTimeAndValue() const;
578
579 template<typename E>
580 SEditResult<E> DoPropertiesWithState(CUIRect *pToolbox, CProperty *pProps, int *pIds, int *pNewVal, const std::vector<ColorRGBA> &vColors = {});
581 int DoProperties(CUIRect *pToolbox, CProperty *pProps, int *pIds, int *pNewVal, const std::vector<ColorRGBA> &vColors = {});
582
584 const void *m_pColorPickerPopupActiveId = nullptr;
585 void DoColorPickerButton(const void *pId, const CUIRect *pRect, ColorRGBA Color, const std::function<void(ColorRGBA Color)> &SetColor);
586
589 char m_aTooltip[256] = "";
590
592
597
598 enum
599 {
618 };
619
627
628 int m_Mentions = 0;
629 bool m_IngameMoved = false;
630
631 enum
632 {
637 };
638
643 bool (*m_pfnFileDialogFunc)(const char *pFileName, int StorageType, void *pUser);
656
663
665
667 {
674 };
675 std::vector<CFilelistItem> m_vCompleteFileList;
676 std::vector<const CFilelistItem *> m_vpFilteredFileList;
677
678 static bool CompareFilenameAscending(const CFilelistItem *pLhs, const CFilelistItem *pRhs)
679 {
680 if(str_comp(pLhs->m_aFilename, "..") == 0)
681 return true;
682 if(str_comp(pRhs->m_aFilename, "..") == 0)
683 return false;
684 if(pLhs->m_IsLink != pRhs->m_IsLink)
685 return pLhs->m_IsLink;
686 if(pLhs->m_IsDir != pRhs->m_IsDir)
687 return pLhs->m_IsDir;
688 return str_comp_filenames(pLhs->m_aName, pRhs->m_aName) < 0;
689 }
690
691 static bool CompareFilenameDescending(const CFilelistItem *pLhs, const CFilelistItem *pRhs)
692 {
693 if(str_comp(pLhs->m_aFilename, "..") == 0)
694 return true;
695 if(str_comp(pRhs->m_aFilename, "..") == 0)
696 return false;
697 if(pLhs->m_IsLink != pRhs->m_IsLink)
698 return pLhs->m_IsLink;
699 if(pLhs->m_IsDir != pRhs->m_IsDir)
700 return pLhs->m_IsDir;
701 return str_comp_filenames(pLhs->m_aName, pRhs->m_aName) > 0;
702 }
703
704 static bool CompareTimeModifiedAscending(const CFilelistItem *pLhs, const CFilelistItem *pRhs)
705 {
706 if(str_comp(pLhs->m_aFilename, "..") == 0)
707 return true;
708 if(str_comp(pRhs->m_aFilename, "..") == 0)
709 return false;
710 if(pLhs->m_IsLink || pRhs->m_IsLink)
711 return pLhs->m_IsLink;
712 if(pLhs->m_IsDir != pRhs->m_IsDir)
713 return pLhs->m_IsDir;
714 return pLhs->m_TimeModified < pRhs->m_TimeModified;
715 }
716
717 static bool CompareTimeModifiedDescending(const CFilelistItem *pLhs, const CFilelistItem *pRhs)
718 {
719 if(str_comp(pLhs->m_aFilename, "..") == 0)
720 return true;
721 if(str_comp(pRhs->m_aFilename, "..") == 0)
722 return false;
723 if(pLhs->m_IsLink || pRhs->m_IsLink)
724 return pLhs->m_IsLink;
725 if(pLhs->m_IsDir != pRhs->m_IsDir)
726 return pLhs->m_IsDir;
727 return pLhs->m_TimeModified > pRhs->m_TimeModified;
728 }
729
733
734 std::vector<std::string> m_vSelectEntitiesFiles;
736
737 // Zooming
740
742
745
748
751 float m_MouseWorldScale = 1.0f; // Mouse (i.e. UI) scale relative to the World (selected Group)
752 vec2 m_MouseWorldPos = vec2(0.0f, 0.0f);
757 char m_MapEditorId; // UI element ID for the main map editor
758
760 {
764 };
767
773
775 {
781 };
783 float m_aExtraEditorSplits[NUM_EXTRAEDITORS] = {250.0f, 250.0f, 250.0f};
784 float m_ToolBoxWidth = 100.0f;
785
787 {
791 };
794
795 std::vector<int> m_vSelectedLayers;
796 std::vector<int> m_vSelectedQuads;
802 std::vector<std::pair<int, int>> m_vSelectedEnvelopePoints;
808 std::pair<int, int> m_SelectedTangentInPoint;
809 std::pair<int, int> m_SelectedTangentOutPoint;
811
815
816 // Color palette and pipette
818 ColorRGBA m_PipetteColor = ColorRGBA(1.0f, 1.0f, 1.0f, 1.0f);
820
823
825 {
830 };
833
835
836 std::shared_ptr<CLayerGroup> m_pBrush;
837 std::shared_ptr<CLayerTiles> m_pTilesetPicker;
838 std::shared_ptr<CLayerQuads> m_pQuadsetPicker;
839
840 static const void *ms_pUiGotContext;
841
843 std::deque<std::shared_ptr<CDataFileWriterFinishJob>> m_WriterFinishJobs;
844
846
847 static void EnvelopeEval(int TimeOffsetMillis, int Env, ColorRGBA &Result, size_t Channels, void *pUser);
848
852
855 void AddTileart(bool IgnoreHistory = false);
856 void TileartCheckColors();
857
858 void PlaceBorderTiles();
859
860 void UpdateTooltip(const void *pId, const CUIRect *pRect, const char *pToolTip);
861 int DoButton_Editor_Common(const void *pId, const char *pText, int Checked, const CUIRect *pRect, int Flags, const char *pToolTip);
862 int DoButton_Editor(const void *pId, const char *pText, int Checked, const CUIRect *pRect, int Flags, const char *pToolTip);
863 int DoButton_Env(const void *pId, const char *pText, int Checked, const CUIRect *pRect, const char *pToolTip, ColorRGBA Color, int Corners);
864
865 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);
866 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);
867 int DoButton_MenuItem(const void *pId, const char *pText, int Checked, const CUIRect *pRect, int Flags = 0, const char *pToolTip = nullptr);
868
869 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);
870
871 bool DoEditBox(CLineInput *pLineInput, const CUIRect *pRect, float FontSize, int Corners = IGraphics::CORNER_ALL, const char *pToolTip = nullptr, const std::vector<STextColorSplit> &vColorSplits = {});
872 bool DoClearableEditBox(CLineInput *pLineInput, const CUIRect *pRect, float FontSize, int Corners = IGraphics::CORNER_ALL, const char *pToolTip = nullptr, const std::vector<STextColorSplit> &vColorSplits = {});
873
874 void DoMapSettingsEditBox(CMapSettingsBackend::CContext *pContext, const CUIRect *pRect, float FontSize, float DropdownMaxHeight, int Corners = IGraphics::CORNER_ALL, const char *pToolTip = nullptr);
875
876 template<typename T>
877 int DoEditBoxDropdown(SEditBoxDropdownContext *pDropdown, CLineInput *pLineInput, const CUIRect *pEditBoxRect, int x, float MaxHeight, bool AutoWidth, const std::vector<T> &vData, const FDropdownRenderCallback<T> &pfnMatchCallback);
878 template<typename T>
879 int RenderEditBoxDropdown(SEditBoxDropdownContext *pDropdown, CUIRect View, CLineInput *pLineInput, int x, float MaxHeight, bool AutoWidth, const std::vector<T> &vData, const FDropdownRenderCallback<T> &pfnMatchCallback);
880
881 void RenderBackground(CUIRect View, IGraphics::CTextureHandle Texture, float Size, float Brightness) const;
882
883 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);
884
885 static CUi::EPopupMenuFunctionResult PopupMenuFile(void *pContext, CUIRect View, bool Active);
886 static CUi::EPopupMenuFunctionResult PopupMenuTools(void *pContext, CUIRect View, bool Active);
887 static CUi::EPopupMenuFunctionResult PopupMenuSettings(void *pContext, CUIRect View, bool Active);
888 static CUi::EPopupMenuFunctionResult PopupGroup(void *pContext, CUIRect View, bool Active);
890 {
892 std::vector<std::shared_ptr<CLayerTiles>> m_vpLayers;
893 std::vector<int> m_vLayerIndices;
895 };
896 static CUi::EPopupMenuFunctionResult PopupLayer(void *pContext, CUIRect View, bool Active);
897 static CUi::EPopupMenuFunctionResult PopupQuad(void *pContext, CUIRect View, bool Active);
898 static CUi::EPopupMenuFunctionResult PopupSource(void *pContext, CUIRect View, bool Active);
899 static CUi::EPopupMenuFunctionResult PopupPoint(void *pContext, CUIRect View, bool Active);
900 static CUi::EPopupMenuFunctionResult PopupEnvPoint(void *pContext, CUIRect View, bool Active);
901 static CUi::EPopupMenuFunctionResult PopupEnvPointMulti(void *pContext, CUIRect View, bool Active);
902 static CUi::EPopupMenuFunctionResult PopupEnvPointCurveType(void *pContext, CUIRect View, bool Active);
903 static CUi::EPopupMenuFunctionResult PopupImage(void *pContext, CUIRect View, bool Active);
904 static CUi::EPopupMenuFunctionResult PopupSound(void *pContext, CUIRect View, bool Active);
905 static CUi::EPopupMenuFunctionResult PopupNewFolder(void *pContext, CUIRect View, bool Active);
906 static CUi::EPopupMenuFunctionResult PopupMapInfo(void *pContext, CUIRect View, bool Active);
907 static CUi::EPopupMenuFunctionResult PopupEvent(void *pContext, CUIRect View, bool Active);
908 static CUi::EPopupMenuFunctionResult PopupSelectImage(void *pContext, CUIRect View, bool Active);
909 static CUi::EPopupMenuFunctionResult PopupSelectSound(void *pContext, CUIRect View, bool Active);
910 static CUi::EPopupMenuFunctionResult PopupSelectGametileOp(void *pContext, CUIRect View, bool Active);
911 static CUi::EPopupMenuFunctionResult PopupSelectConfigAutoMap(void *pContext, CUIRect View, bool Active);
912 static CUi::EPopupMenuFunctionResult PopupTele(void *pContext, CUIRect View, bool Active);
913 static CUi::EPopupMenuFunctionResult PopupSpeedup(void *pContext, CUIRect View, bool Active);
914 static CUi::EPopupMenuFunctionResult PopupSwitch(void *pContext, CUIRect View, bool Active);
915 static CUi::EPopupMenuFunctionResult PopupTune(void *pContext, CUIRect View, bool Active);
916 static CUi::EPopupMenuFunctionResult PopupGoto(void *pContext, CUIRect View, bool Active);
917 static CUi::EPopupMenuFunctionResult PopupEntities(void *pContext, CUIRect View, bool Active);
918 static CUi::EPopupMenuFunctionResult PopupProofMode(void *pContext, CUIRect View, bool Active);
919 static CUi::EPopupMenuFunctionResult PopupAnimateSettings(void *pContext, CUIRect View, bool Active);
921 static CUi::EPopupMenuFunctionResult PopupEnvelopeCurvetype(void *pContext, CUIRect View, bool Active);
922
923 static bool CallbackOpenMap(const char *pFileName, int StorageType, void *pUser);
924 static bool CallbackAppendMap(const char *pFileName, int StorageType, void *pUser);
925 static bool CallbackSaveMap(const char *pFileName, int StorageType, void *pUser);
926 static bool CallbackSaveCopyMap(const char *pFileName, int StorageType, void *pUser);
927 static bool CallbackAddTileart(const char *pFilepath, int StorageType, void *pUser);
928 static bool CallbackSaveImage(const char *pFileName, int StorageType, void *pUser);
929 static bool CallbackSaveSound(const char *pFileName, int StorageType, void *pUser);
930 static bool CallbackCustomEntities(const char *pFileName, int StorageType, void *pUser);
931
932 void PopupSelectImageInvoke(int Current, float x, float y);
934
935 void PopupSelectGametileOpInvoke(float x, float y);
937
938 void PopupSelectConfigAutoMapInvoke(int Current, float x, float y);
940
941 void PopupSelectSoundInvoke(int Current, float x, float y);
943
944 void DoQuadEnvelopes(const std::vector<CQuad> &vQuads, IGraphics::CTextureHandle Texture = IGraphics::CTextureHandle());
945 void DoQuadEnvPoint(const CQuad *pQuad, int QIndex, int pIndex);
946 void DoQuadPoint(int LayerIndex, const std::shared_ptr<CLayerQuads> &pLayer, CQuad *pQuad, int QuadIndex, int v);
947 void SetHotQuadPoint(const std::shared_ptr<CLayerQuads> &pLayer);
948
949 float TriangleArea(vec2 A, vec2 B, vec2 C);
950 bool IsInTriangle(vec2 Point, vec2 A, vec2 B, vec2 C);
951 void DoQuadKnife(int QuadIndex);
952
953 void DoSoundSource(int LayerIndex, CSoundSource *pSource, int Index);
954
955 enum class EAxis
956 {
957 AXIS_NONE = 0,
958 AXIS_X,
959 AXIS_Y
960 };
962 {
963 enum
964 {
971 };
973 };
974 void DoMapEditor(CUIRect View);
975 void DoToolbarLayers(CUIRect Toolbar);
976 void DoToolbarSounds(CUIRect Toolbar);
977 void DoQuad(int LayerIndex, const std::shared_ptr<CLayerQuads> &pLayer, CQuad *pQuad, int Index);
978 void PreparePointDrag(const std::shared_ptr<CLayerQuads> &pLayer, CQuad *pQuad, int QuadIndex, int PointIndex);
979 void DoPointDrag(const std::shared_ptr<CLayerQuads> &pLayer, CQuad *pQuad, int QuadIndex, int PointIndex, int OffsetX, int OffsetY);
980 EAxis GetDragAxis(int OffsetX, int OffsetY) const;
981 void DrawAxis(EAxis Axis, CPoint &OriginalPoint, CPoint &Point) const;
982 void DrawAABB(const SAxisAlignedBoundingBox &AABB, int OffsetX = 0, int OffsetY = 0) const;
983 ColorRGBA GetButtonColor(const void *pId, int Checked);
984
985 // Alignment methods
986 // These methods take `OffsetX` and `OffsetY` because the calculations are made with the original positions
987 // of the quad(s), before we started dragging. This allows us to edit `OffsetX` and `OffsetY` based on the previously
988 // calculated alignments.
990 {
991 CPoint m_AlignedPoint; // The "aligned" point, which we want to align/snap to
992 union
993 {
994 // 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
995 // we aligned the Y values (X axis aligned => Y values are the same, Y axis aligned => X values are the same).
996 int m_X;
997 int m_Y;
998 };
999 EAxis m_Axis; // The axis we are aligning on
1000 int m_PointIndex; // The point index we are aligning
1001 int m_Diff; // Store the difference
1002 };
1003 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;
1004 void ComputePointsAlignments(const std::shared_ptr<CLayerQuads> &pLayer, bool Pivot, int OffsetX, int OffsetY, std::vector<SAlignmentInfo> &vAlignments) const;
1005 void ComputeAABBAlignments(const std::shared_ptr<CLayerQuads> &pLayer, const SAxisAlignedBoundingBox &AABB, int OffsetX, int OffsetY, std::vector<SAlignmentInfo> &vAlignments) const;
1006 void DrawPointAlignments(const std::vector<SAlignmentInfo> &vAlignments, int OffsetX, int OffsetY) const;
1007 void QuadSelectionAABB(const std::shared_ptr<CLayerQuads> &pLayer, SAxisAlignedBoundingBox &OutAABB);
1008 void ApplyAlignments(const std::vector<SAlignmentInfo> &vAlignments, int &OffsetX, int &OffsetY);
1009 void ApplyAxisAlignment(int &OffsetX, int &OffsetY) const;
1010
1011 bool ReplaceImage(const char *pFilename, int StorageType, bool CheckDuplicate);
1012 static bool ReplaceImageCallback(const char *pFilename, int StorageType, void *pUser);
1013 bool ReplaceSound(const char *pFileName, int StorageType, bool CheckDuplicate);
1014 static bool ReplaceSoundCallback(const char *pFileName, int StorageType, void *pUser);
1015 static bool AddImage(const char *pFilename, int StorageType, void *pUser);
1016 static bool AddSound(const char *pFileName, int StorageType, void *pUser);
1017
1018 bool IsEnvelopeUsed(int EnvelopeIndex) const;
1019 void RemoveUnusedEnvelopes();
1020
1021 static bool IsVanillaImage(const char *pImage);
1022
1023 void RenderLayers(CUIRect LayersBox);
1024 void RenderImagesList(CUIRect Toolbox);
1025 void RenderSelectedImage(CUIRect View);
1026 void RenderSounds(CUIRect Toolbox);
1027 void RenderModebar(CUIRect View);
1028 void RenderStatusbar(CUIRect View, CUIRect *pTooltipRect);
1029 void RenderTooltip(CUIRect TooltipRect);
1030
1031 void RenderEnvelopeEditor(CUIRect View);
1032
1034 void RenderServerSettingsEditor(CUIRect View, bool ShowServerSettingsEditorLast);
1035 static void MapSettingsDropdownRenderCallback(const SPossibleValueMatch &Match, char (&aOutput)[128], std::vector<STextColorSplit> &vColorSplits);
1036
1037 void RenderEditorHistory(CUIRect View);
1038
1039 enum class EDragSide // Which side is the drag bar on
1040 {
1041 SIDE_BOTTOM,
1042 SIDE_LEFT,
1043 SIDE_TOP,
1044 SIDE_RIGHT
1045 };
1046 void DoEditorDragBar(CUIRect View, CUIRect *pDragBar, EDragSide Side, float *pValue, float MinValue = 100.0f, float MaxValue = 400.0f);
1047
1048 void SetHotEnvelopePoint(const CUIRect &View, const std::shared_ptr<CEnvelope> &pEnvelope, int ActiveChannels);
1049
1050 void RenderMenubar(CUIRect Menubar);
1051 void RenderFileDialog();
1052
1053 void SelectGameLayer();
1054 std::vector<int> SortImages();
1055
1056 void DoAudioPreview(CUIRect View, const void *pPlayPauseButtonId, const void *pStopButtonId, const void *pSeekBarId, int SampleId);
1057
1058 // Tile Numbers For Explanations - TODO: Add/Improve tiles and explanations
1059 enum
1060 {
1065
1074
1077 };
1078
1079 enum
1080 {
1087
1090
1102
1107
1108 enum
1109 {
1121 };
1122
1123 // Explanations
1124 enum class EExplanation
1125 {
1126 NONE,
1127 DDNET,
1128 FNG,
1129 RACE,
1130 VANILLA,
1131 BLOCKWORLDS
1132 };
1133 static const char *ExplainDDNet(int Tile, int Layer);
1134 static const char *ExplainFNG(int Tile, int Layer);
1135 static const char *ExplainVanilla(int Tile, int Layer);
1136 static const char *Explain(EExplanation Explanation, int Tile, int Layer);
1137
1138 // Zooming
1139 void ZoomAdaptOffsetX(float ZoomFactor, const CUIRect &View);
1140 void UpdateZoomEnvelopeX(const CUIRect &View);
1141
1142 void ZoomAdaptOffsetY(float ZoomFactor, const CUIRect &View);
1143 void UpdateZoomEnvelopeY(const CUIRect &View);
1144
1145 void ResetZoomEnvelope(const std::shared_ptr<CEnvelope> &pEnvelope, int ActiveChannels);
1146 void RemoveTimeOffsetEnvelope(const std::shared_ptr<CEnvelope> &pEnvelope);
1147 float ScreenToEnvelopeX(const CUIRect &View, float x) const;
1148 float EnvelopeToScreenX(const CUIRect &View, float x) const;
1149 float ScreenToEnvelopeY(const CUIRect &View, float y) const;
1150 float EnvelopeToScreenY(const CUIRect &View, float y) const;
1151 float ScreenToEnvelopeDX(const CUIRect &View, float DeltaX);
1152 float ScreenToEnvelopeDY(const CUIRect &View, float DeltaY);
1153
1154 // DDRace
1155
1161
1162 unsigned char m_ViewTeleNumber;
1163 std::map<int, unsigned char> m_TeleNumbers;
1164
1165 unsigned char m_TuningNum;
1166
1167 unsigned char m_SpeedupForce;
1168 unsigned char m_SpeedupMaxSpeed;
1170
1171 unsigned char m_SwitchNum;
1172 unsigned char m_SwitchDelay;
1173 unsigned char m_ViewSwitch;
1174
1175 void AdjustBrushSpecialTiles(bool UseNextFree, int Adjust = 0);
1177 int FindNextFreeTeleNumber(int Index);
1178
1179 // Undo/Redo
1185
1186private:
1187 void UndoLastAction();
1188 void RedoLastAction();
1189
1190 std::map<int, CPoint[5]> m_QuadDragOriginalPoints;
1191};
1192
1193// make sure to inline this function
1194inline class IGraphics *CLayer::Graphics() { return m_pEditor->Graphics(); }
1196
1197#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:475
CHoverTile(int Group, int Layer, int x, int y, const CTile Tile)
Definition: editor.h:477
int m_Layer
Definition: editor.h:487
const CTile m_Tile
Definition: editor.h:490
int m_Group
Definition: editor.h:486
int m_X
Definition: editor.h:488
int m_Y
Definition: editor.h:489
Definition: editor.h:276
static const char * ExplainFNG(int Tile, int Layer)
Definition: explanations.cpp:491
IGraphics::CTextureHandle GetSpeedupTexture()
Definition: editor.cpp:8403
unsigned char m_SpeedupForce
Definition: editor.h:1167
int m_ShiftBy
Definition: editor.h:845
static CUi::EPopupMenuFunctionResult PopupSelectImage(void *pContext, CUIRect View, bool Active)
Definition: popups.cpp:2185
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:842
CEditorHistory m_EnvelopeEditorHistory
Definition: editor.h:1182
void OnClose() override
Definition: editor.cpp:8816
int m_QuadKnifeCount
Definition: editor.h:813
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
@ TILE_PUB_CREDITS3
Definition: editor.h:1068
@ TILE_PUB_CREDITS7
Definition: editor.h:1072
@ TILE_PUB_ENTITIES_OFF2
Definition: editor.h:1076
@ TILE_PUB_CREDITS1
Definition: editor.h:1066
@ TILE_PUB_CREDITS6
Definition: editor.h:1071
@ TILE_PUB_CREDITS5
Definition: editor.h:1070
@ TILE_PUB_DEATH
Definition: editor.h:1063
@ TILE_PUB_AIR
Definition: editor.h:1061
@ TILE_PUB_ENTITIES_OFF1
Definition: editor.h:1075
@ TILE_PUB_CREDITS8
Definition: editor.h:1073
@ TILE_PUB_UNHOOKABLE
Definition: editor.h:1064
@ TILE_PUB_CREDITS4
Definition: editor.h:1069
@ TILE_PUB_CREDITS2
Definition: editor.h:1067
@ TILE_PUB_HOOKABLE
Definition: editor.h:1062
void DoColorPickerButton(const void *pId, const CUIRect *pRect, ColorRGBA Color, const std::function< void(ColorRGBA Color)> &SetColor)
Definition: editor.cpp:3697
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:639
int PopupSelectGameTileOpResult()
Definition: popups.cpp:2363
bool m_ShowMousePointer
Definition: editor.h:746
int m_ToolbarPreviewSound
Definition: editor.h:664
char m_aFileSaveName[IO_MAX_PATH_LENGTH]
Definition: editor.h:595
void ZoomAdaptOffsetY(float ZoomFactor, const CUIRect &View)
Definition: editor.cpp:5945
void RenderPressedKeys(CUIRect View)
Definition: editor.cpp:8176
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:3032
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:593
bool m_IngameMoved
Definition: editor.h:629
std::map< int, unsigned char > m_TeleNumbers
Definition: editor.h:1163
IGraphics::CTextureHandle GetFrontTexture()
Definition: editor.cpp:8389
int m_SelectedSource
Definition: editor.h:807
int m_FilePreviewImageWidth
Definition: editor.h:660
bool m_BrushColorEnabled
Definition: editor.h:591
float m_AnimateSpeed
Definition: editor.h:771
std::vector< int > SortImages()
Definition: editor.cpp:4707
static bool ReplaceSoundCallback(const char *pFileName, int StorageType, void *pUser)
Definition: editor.cpp:4687
bool m_ValidSaveFilename
Definition: editor.h:596
bool m_EditorWasUsedBefore
Definition: editor.h:295
IGraphics::CTextureHandle GetTuneTexture()
Definition: editor.cpp:8417
void RenderEnvelopeEditor(CUIRect View)
Definition: editor.cpp:6199
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:851
bool HasUnsavedData() const override
Definition: editor.h:502
CLineInputBuffered< IO_MAX_PATH_LENGTH > m_FileDialogFilterInput
Definition: editor.h:649
std::shared_ptr< CLayerTiles > m_pTilesetPicker
Definition: editor.h:837
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:1173
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:2329
void RenderMousePointer()
Definition: editor.cpp:8284
void * m_pFileDialogUser
Definition: editor.h:644
void AddGroup()
Definition: quick_actions.cpp:49
vec2 m_MouseDeltaWorld
Definition: editor.h:754
void Init() override
Definition: editor.cpp:8431
static CUi::EPopupMenuFunctionResult PopupGoto(void *pContext, CUIRect View, bool Active)
Definition: popups.cpp:2722
bool m_ShowPicker
Definition: editor.h:793
std::map< const char *, CUi::SMessagePopupContext *, SStringKeyComparator > m_PopupMessageContexts
Definition: editor.h:526
std::vector< CHoverTile > m_vHoverTiles
Definition: editor.h:492
void OnUpdate() override
Definition: editor.cpp:8723
int m_FilesSelectedIndex
Definition: editor.h:654
void PopupSelectImageInvoke(int Current, float x, float y)
Definition: popups.cpp:2247
void DoQuadEnvelopes(const std::vector< CQuad > &vQuads, IGraphics::CTextureHandle Texture=IGraphics::CTextureHandle())
Definition: editor.cpp:2804
void OnDialogClose() override
Definition: editor.cpp:8826
std::vector< CQuad * > GetSelectedQuads()
Definition: editor.cpp:465
static CUi::EPopupMenuFunctionResult PopupSwitch(void *pContext, CUIRect View, bool Active)
Definition: popups.cpp:2597
const void * m_pContainerPannedLast
Definition: editor.h:756
void SelectNextLayer()
Definition: editor.cpp:741
unsigned char m_SpeedupMaxSpeed
Definition: editor.h:1168
float ScreenToEnvelopeDX(const CUIRect &View, float DeltaX)
Definition: editor.cpp:6042
bool Save(const char *pFilename) override
Definition: editor.cpp:8852
IGraphics::CTextureHandle m_TuneTexture
Definition: editor.h:303
CUi * Ui()
Definition: editor.h:328
vec2 m_MouseWorldNoParaPos
Definition: editor.h:753
float m_ToolBoxWidth
Definition: editor.h:784
void RenderMenubar(CUIRect Menubar)
Definition: editor.cpp:7757
IGraphics::CTextureHandle GetEntitiesTexture()
Definition: editor.cpp:8424
IGraphics::CTextureHandle GetTeleTexture()
Definition: editor.cpp:8396
char m_aTileartFilename[IO_MAX_PATH_LENGTH]
Definition: editor.h:854
char m_aFilesSelectedName[IO_MAX_PATH_LENGTH]
Definition: editor.h:648
char m_aFileDialogCurrentFolder[IO_MAX_PATH_LENGTH]
Definition: editor.h:646
bool m_GuiActive
Definition: editor.h:747
IGraphics::CTextureHandle m_FilePreviewImage
Definition: editor.h:657
int DoProperties(CUIRect *pToolbox, CProperty *pProps, int *pIds, int *pNewVal, const std::vector< ColorRGBA > &vColors={})
Definition: editor_props.cpp:12
char * m_pFileDialogPath
Definition: editor.h:650
EAxis GetDragAxis(int OffsetX, int OffsetY) const
Definition: editor.cpp:1555
char m_aFileNamePending[IO_MAX_PATH_LENGTH]
Definition: editor.h:594
void AddSoundLayer()
Definition: quick_actions.cpp:56
void ShowFileDialogError(const char *pFormat,...) GNUC_ATTRIBUTE((format(printf
Definition: editor.cpp:5735
void DeleteSelectedQuads()
Definition: editor.cpp:556
int FindNextFreeTeleNumber(int Index)
Definition: editor.cpp:9166
int m_PopupEventActivated
Definition: editor.h:621
bool m_LargeLayerWasWarned
Definition: editor.h:623
int FindNextFreeSwitchNumber()
Definition: editor.cpp:9151
void DoEditorDragBar(CUIRect View, CUIRect *pDragBar, EDragSide Side, float *pValue, float MinValue=100.0f, float MaxValue=400.0f)
Definition: editor.cpp:7703
std::pair< int, int > m_SelectedTangentOutPoint
Definition: editor.h:809
class ITextRender * TextRender() const
Definition: editor.h:326
void HandleCursorMovement()
Definition: editor.cpp:8502
void OnRender() override
Definition: editor.cpp:8764
bool m_FileDialogMultipleStorages
Definition: editor.h:652
std::map< int, CPoint[5]> m_QuadDragOriginalPoints
Definition: editor.h:1190
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
@ TILE_FNG_SPIKE_OLD3
Definition: editor.h:1105
@ TILE_FNG_SPIKE_RED
Definition: editor.h:1083
@ TILE_FNG_LASER
Definition: editor.h:1101
@ TILE_FNG_SHOTGUN
Definition: editor.h:1098
@ TILE_FNG_SPIKE_GOLD
Definition: editor.h:1081
@ TILE_FNG_FLAG_BLUE
Definition: editor.h:1095
@ TILE_FNG_SPIKE_BLUE
Definition: editor.h:1084
@ TILE_FNG_SPIKE_OLD2
Definition: editor.h:1104
@ TILE_FNG_SPAWN_RED
Definition: editor.h:1092
@ TILE_FNG_SPIKE_PURPLE
Definition: editor.h:1089
@ TILE_FNG_SPAWN
Definition: editor.h:1091
@ TILE_FNG_NINJA
Definition: editor.h:1100
@ TILE_FNG_SPIKE_OLD1
Definition: editor.h:1103
@ TILE_FNG_FLAG_RED
Definition: editor.h:1094
@ TILE_FNG_HEART
Definition: editor.h:1097
@ TILE_FNG_SCORE_BLUE
Definition: editor.h:1086
@ TILE_FNG_SPAWN_BLUE
Definition: editor.h:1093
@ TILE_FNG_SPIKE_NORMAL
Definition: editor.h:1082
@ TILE_FNG_SCORE_RED
Definition: editor.h:1085
@ TILE_FNG_SHIELD
Definition: editor.h:1096
@ TILE_FNG_GRENADE
Definition: editor.h:1099
@ TILE_FNG_SPIKE_GREEN
Definition: editor.h:1088
static bool CallbackSaveMap(const char *pFileName, int StorageType, void *pUser)
Definition: editor.cpp:822
void DoToolbarLayers(CUIRect Toolbar)
Definition: editor.cpp:1059
@ FILETYPE_IMG
Definition: editor.h:634
@ FILETYPE_MAP
Definition: editor.h:633
@ NUM_FILETYPES
Definition: editor.h:636
@ FILETYPE_SOUND
Definition: editor.h:635
int m_SelectedQuadPoints
Definition: editor.h:800
CUi::SColorPickerPopupContext m_ColorPickerPopupContext
Definition: editor.h:583
void ResetZoomEnvelope(const std::shared_ptr< CEnvelope > &pEnvelope, int ActiveChannels)
Definition: editor.cpp:5958
bool m_Animate
Definition: editor.h:768
static CUi::EPopupMenuFunctionResult PopupEntities(void *pContext, CUIRect View, bool Active)
Definition: popups.cpp:2766
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:4692
vec2 m_aQuadKnifePoints[4]
Definition: editor.h:814
void PopupSelectGametileOpInvoke(float x, float y)
Definition: popups.cpp:2356
const char * m_pFileDialogTitle
Definition: editor.h:641
EAxis
Definition: editor.h:956
bool IsEnvelopeUsed(int EnvelopeIndex) const
Definition: editor.cpp:5871
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:1125
static CUi::EPopupMenuFunctionResult PopupAnimateSettings(void *pContext, CUIRect View, bool Active)
Definition: popups.cpp:2828
bool IsTangentOutSelected() const
Definition: editor.cpp:698
static CUi::EPopupMenuFunctionResult PopupTune(void *pContext, CUIRect View, bool Active)
Definition: popups.cpp:2695
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:8905
void TileartCheckColors()
Definition: tileart.cpp:173
void PopupSelectConfigAutoMapInvoke(int Current, float x, float y)
Definition: popups.cpp:2412
const std::vector< CHoverTile > & HoverTiles() const
Definition: editor.h:493
std::shared_ptr< CLayer > GetSelectedLayer(int Index) const
Definition: editor.cpp:441
float TriangleArea(vec2 A, vec2 B, vec2 C)
Definition: editor.cpp:2555
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:2558
bool m_QuadKnifeActive
Definition: editor.h:812
void AddTeleLayer()
Definition: quick_actions.cpp:131
IGraphics::CTextureHandle m_aCursorTextures[ECursorType::NUM_CURSORS]
Definition: editor.h:831
bool IsEnvPointSelected(int Index, int Channel) const
Definition: editor.cpp:647
@ TILE_VANILLA_FLAG_RED
Definition: editor.h:1113
@ TILE_VANILLA_SPAWN
Definition: editor.h:1110
@ TILE_VANILLA_SHIELD
Definition: editor.h:1115
@ TILE_VANILLA_SHOTGUN
Definition: editor.h:1117
@ TILE_VANILLA_NINJA
Definition: editor.h:1119
@ TILE_VANILLA_GRENADE
Definition: editor.h:1118
@ TILE_VANILLA_HEART
Definition: editor.h:1116
@ TILE_VANILLA_SPAWN_BLUE
Definition: editor.h:1112
@ TILE_VANILLA_SPAWN_RED
Definition: editor.h:1111
@ TILE_VANILLA_LASER
Definition: editor.h:1120
@ TILE_VANILLA_FLAG_BLUE
Definition: editor.h:1114
bool ReplaceImage(const char *pFilename, int StorageType, bool CheckDuplicate)
Definition: editor.cpp:4446
int m_SelectedEnvelope
Definition: editor.h:801
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:643
std::shared_ptr< CLayerGroup > m_pBrush
Definition: editor.h:836
void HandleAutosave()
Definition: editor.cpp:8597
void UpdateColorPipette()
Definition: editor.cpp:8232
static bool ReplaceImageCallback(const char *pFilename, int StorageType, void *pUser)
Definition: editor.cpp:4502
void DoToolbarSounds(CUIRect Toolbar)
Definition: editor.cpp:1409
bool IsTangentInPointSelected(int Index, int Channel) const
Definition: editor.cpp:688
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:2931
EShowTile
Definition: editor.h:760
@ SHOW_TILE_DECIMAL
Definition: editor.h:762
@ SHOW_TILE_OFF
Definition: editor.h:761
@ SHOW_TILE_HEXADECIMAL
Definition: editor.h:763
void AddFrontLayer()
Definition: quick_actions.cpp:98
CSmoothValue m_ZoomEnvelopeY
Definition: editor.h:739
class IConsole * m_pConsole
Definition: editor.h:281
void AddTileart(bool IgnoreHistory=false)
Definition: tileart.cpp:141
int m_Mode
Definition: editor.h:587
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:818
static CUi::EPopupMenuFunctionResult PopupEnvPoint(void *pContext, CUIRect View, bool Active)
Definition: popups.cpp:1332
CEnvelopeEditorOperationTracker m_EnvOpTracker
Definition: editor.h:1184
class IEngine * m_pEngine
Definition: editor.h:282
EShowTile m_ShowTileInfo
Definition: editor.h:765
char m_MapEditorId
Definition: editor.h:757
IGraphics::CTextureHandle m_CheckerTexture
Definition: editor.h:821
CLineInputBuffered< 256 > m_SettingsCommandInput
Definition: editor.h:849
void DoQuadKnife(int QuadIndex)
Definition: editor.cpp:2581
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:805
static bool CompareTimeModifiedAscending(const CFilelistItem *pLhs, const CFilelistItem *pRhs)
Definition: editor.h:704
char m_aFileDialogCurrentLink[IO_MAX_PATH_LENGTH]
Definition: editor.h:647
bool HandleMapDrop(const char *pFilename, int StorageType) override
Definition: editor.cpp:8865
void RenderModebar(CUIRect View)
Definition: editor.cpp:5760
EShowEnvelope
Definition: editor.h:787
@ SHOWENV_ALL
Definition: editor.h:790
@ SHOWENV_NONE
Definition: editor.h:788
@ SHOWENV_SELECTED
Definition: editor.h:789
static bool CallbackAppendMap(const char *pFileName, int StorageType, void *pUser)
Definition: editor.cpp:806
ECursorType m_CursorType
Definition: editor.h:832
int m_FileDialogLastPopulatedStorageType
Definition: editor.h:640
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:2803
float EnvelopeToScreenX(const CUIRect &View, float x) const
Definition: editor.cpp:6027
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:2000
char m_aTooltip[256]
Definition: editor.h:589
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:850
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:584
class IStorage * Storage() const
Definition: editor.h:327
std::vector< std::pair< int, int > > m_vSelectedEnvelopePoints
Definition: editor.h:802
void AdjustBrushSpecialTiles(bool UseNextFree, int Adjust=0)
Definition: editor.cpp:9066
vec2 m_MouseWorldPos
Definition: editor.h:752
static CUi::EPopupMenuFunctionResult PopupEnvelopeCurvetype(void *pContext, CUIRect View, bool Active)
Definition: popups.cpp:2885
float m_OffsetEnvelopeY
Definition: editor.h:744
class IGraphics * m_pGraphics
Definition: editor.h:283
int PopupSelectConfigAutoMapResult()
Definition: popups.cpp:2423
class IClient * m_pClient
Definition: editor.h:278
void FreeDynamicPopupMenus()
Definition: editor.cpp:8216
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:5854
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:1549
void SelectTangentInPoint(int Index, int Channel)
Definition: editor.cpp:682
std::vector< std::string > m_vSelectEntitiesFiles
Definition: editor.h:734
static CUi::EPopupMenuFunctionResult PopupSelectSound(void *pContext, CUIRect View, bool Active)
Definition: popups.cpp:2268
IGraphics::CTextureHandle m_SwitchTexture
Definition: editor.h:302
int m_SortByTimeModified
Definition: editor.h:732
EExtraEditor m_ActiveExtraEditor
Definition: editor.h:782
void SetHotQuadPoint(const std::shared_ptr< CLayerQuads > &pLayer)
Definition: editor.cpp:3652
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:8384
void SelectQuad(int Index)
Definition: editor.cpp:505
void DrawAABB(const SAxisAlignedBoundingBox &AABB, int OffsetX=0, int OffsetY=0) const
Definition: editor.cpp:1910
int m_PopupEnvelopeSelectedPoint
Definition: editor.h:920
std::vector< int > m_vSelectedQuads
Definition: editor.h:796
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:1180
int FindEnvPointIndex(int Index, int Channel) const
Definition: editor.cpp:605
void RenderStatusbar(CUIRect View, CUIRect *pTooltipRect)
Definition: editor.cpp:5828
int m_CurrentQuadIndex
Definition: editor.h:804
float ScreenToEnvelopeX(const CUIRect &View, float x) const
Definition: editor.cpp:6022
static CUi::EPopupMenuFunctionResult PopupNewFolder(void *pContext, CUIRect View, bool Active)
Definition: popups.cpp:1859
static bool CompareTimeModifiedDescending(const CFilelistItem *pLhs, const CFilelistItem *pRhs)
Definition: editor.h:717
void OnIngameMoved() override
Definition: editor.h:505
void QuadSelectionAABB(const std::shared_ptr< CLayerQuads > &pLayer, SAxisAlignedBoundingBox &OutAABB)
Definition: editor.cpp:1934
void void Reset(bool CreateDefault=true)
Definition: editor.cpp:8334
int m_Dialog
Definition: editor.h:588
class IClient * Client() const
Definition: editor.h:319
void UpdateMentions() override
Definition: editor.h:503
void OnActivate() override
Definition: editor.cpp:8805
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:1774
int m_FilePreviewSound
Definition: editor.h:658
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:5910
void OnWindowResize() override
Definition: editor.cpp:8811
float m_AnimateTime
Definition: editor.h:770
bool m_ColorPipetteActive
Definition: editor.h:819
bool m_UpdateEnvPointInfo
Definition: editor.h:810
bool m_ResetZoomEnvelope
Definition: editor.h:741
void RenderSavingIndicator(CUIRect View)
Definition: editor.cpp:8198
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:5607
class ISound * m_pSound
Definition: editor.h:285
void RemoveTimeOffsetEnvelope(const std::shared_ptr< CEnvelope > &pEnvelope)
Definition: editor.cpp:6052
const void * m_pContainerPanned
Definition: editor.h:755
EDragSide
Definition: editor.h:1040
float ScreenToEnvelopeY(const CUIRect &View, float y) const
Definition: editor.cpp:6032
static CUi::EPopupMenuFunctionResult PopupEvent(void *pContext, CUIRect View, bool Active)
Definition: popups.cpp:1985
void DrawPointAlignments(const std::vector< SAlignmentInfo > &vAlignments, int OffsetX, int OffsetY) const
Definition: editor.cpp:1886
void DoQuad(int LayerIndex, const std::shared_ptr< CLayerQuads > &pLayer, CQuad *pQuad, int Index)
Definition: editor.cpp:2009
static bool AddImage(const char *pFilename, int StorageType, void *pUser)
Definition: editor.cpp:4507
bool IsQuadPointSelected(int QuadIndex, int Index) const
Definition: editor.cpp:592
char m_aMenuBackgroundTooltip[256]
Definition: editor.h:749
bool m_AnimateUpdatePopup
Definition: editor.h:772
static const void * ms_pUiGotContext
Definition: editor.h:840
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:1183
int64_t m_AnimateStart
Definition: editor.h:769
static CUi::EPopupMenuFunctionResult PopupMapInfo(void *pContext, CUIRect View, bool Active)
Definition: popups.cpp:1910
class ITextRender * m_pTextRender
Definition: editor.h:284
int FindSelectedQuadIndex(int Index) const
Definition: editor.cpp:597
const char * m_pFileDialogButtonText
Definition: editor.h:642
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:1711
void ApplyAlignments(const std::vector< SAlignmentInfo > &vAlignments, int &OffsetX, int &OffsetY)
Definition: editor.cpp:1968
void AddTuneLayer()
Definition: quick_actions.cpp:109
int m_SelectedQuadPoint
Definition: editor.h:797
void OnMouseMove(vec2 MousePos)
Definition: editor.cpp:8549
bool CanFillGameTiles() const
Definition: quick_actions.cpp:15
std::vector< CFilelistItem > m_vCompleteFileList
Definition: editor.h:675
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:6145
void PreparePointDrag(const std::shared_ptr< CLayerQuads > &pLayer, CQuad *pQuad, int QuadIndex, int PointIndex)
Definition: editor.cpp:1544
IGraphics::CTextureHandle GetSwitchTexture()
Definition: editor.cpp:8410
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:806
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:6037
static CUi::EPopupMenuFunctionResult PopupTele(void *pContext, CUIRect View, bool Active)
Definition: popups.cpp:2435
std::string m_SelectEntitiesImage
Definition: editor.h:735
@ POPEVENT_IMAGE_MAX
Definition: editor.h:612
@ POPEVENT_LOAD
Definition: editor.h:601
@ POPEVENT_LARGELAYER
Definition: editor.h:609
@ POPEVENT_SAVE_COPY
Definition: editor.h:606
@ POPEVENT_EXIT
Definition: editor.h:600
@ POPEVENT_SOUND_MAX
Definition: editor.h:613
@ POPEVENT_SAVE_SOUND
Definition: editor.h:608
@ POPEVENT_LOADCURRENT
Definition: editor.h:602
@ POPEVENT_NEW
Definition: editor.h:604
@ POPEVENT_PIXELART_BIG_IMAGE
Definition: editor.h:615
@ POPEVENT_PREVENTUNUSEDTILES
Definition: editor.h:610
@ POPEVENT_PLACE_BORDER_TILES
Definition: editor.h:614
@ POPEVENT_SAVE
Definition: editor.h:605
@ POPEVENT_SAVE_IMG
Definition: editor.h:607
@ POPEVENT_LOADDROP
Definition: editor.h:603
@ POPEVENT_PIXELART_TOO_MANY_COLORS
Definition: editor.h:617
@ POPEVENT_PIXELART_MANY_COLORS
Definition: editor.h:616
@ POPEVENT_IMAGEDIV16
Definition: editor.h:611
class IConfigManager * m_pConfigManager
Definition: editor.h:279
class CConfig * Config() const
Definition: editor.h:321
bool m_BrushDrawDestructive
Definition: editor.h:626
class IInput * m_pInput
Definition: editor.h:277
bool m_PreviewZoom
Definition: editor.h:750
float m_OffsetEnvelopeX
Definition: editor.h:743
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:2255
void UpdateZoomEnvelopeX(const CUIRect &View)
Definition: editor.cpp:5938
CMapView * MapView()
Definition: editor.h:331
ECursorType
Definition: editor.h:825
@ NUM_CURSORS
Definition: editor.h:829
@ CURSOR_NORMAL
Definition: editor.h:826
@ CURSOR_RESIZE_V
Definition: editor.h:827
@ CURSOR_RESIZE_H
Definition: editor.h:828
static bool CompareFilenameDescending(const CFilelistItem *pLhs, const CFilelistItem *pRhs)
Definition: editor.h:691
std::pair< int, int > m_SelectedTangentInPoint
Definition: editor.h:808
void RedoLastAction()
Definition: editor.cpp:9056
void HandleWriterFinishJobs()
Definition: editor.cpp:8665
void Render()
Definition: editor.cpp:7845
EPreviewState m_FilePreviewState
Definition: editor.h:659
static bool CompareFilenameAscending(const CFilelistItem *pLhs, const CFilelistItem *pRhs)
Definition: editor.h:678
void ResetIngameMoved() override
Definition: editor.h:506
int m_SelectedGroup
Definition: editor.h:799
class CConfig * m_pConfig
Definition: editor.h:280
static const ColorRGBA ms_DefaultPropColor
Definition: editor.h:315
void RenderSelectedImage(CUIRect View)
Definition: editor.cpp:4892
void DeselectQuadPoints()
Definition: editor.cpp:525
int m_SelectedQuadEnvelope
Definition: editor.h:803
CMapView m_MapView
Definition: editor.h:291
IGraphics::CTextureHandle m_EntitiesTexture
Definition: editor.h:297
void PlaceBorderTiles()
Definition: editor.cpp:8479
bool Load(const char *pFilename, int StorageType) override
Definition: editor.cpp:8880
void UpdateZoomEnvelopeY(const CUIRect &View)
Definition: editor.cpp:5951
void RefreshFilteredFileList()
Definition: editor.cpp:5572
short m_SpeedupAngle
Definition: editor.h:1169
bool ReplaceSound(const char *pFileName, int StorageType, bool CheckDuplicate)
Definition: editor.cpp:4635
unsigned char m_ViewTeleNumber
Definition: editor.h:1162
void AddQuadOrSound()
Definition: quick_actions.cpp:23
EExtraEditor
Definition: editor.h:775
@ EXTRAEDITOR_ENVELOPES
Definition: editor.h:777
@ EXTRAEDITOR_NONE
Definition: editor.h:776
@ NUM_EXTRAEDITORS
Definition: editor.h:780
@ EXTRAEDITOR_SERVER_SETTINGS
Definition: editor.h:778
@ EXTRAEDITOR_HISTORY
Definition: editor.h:779
std::shared_ptr< CLayerQuads > m_pQuadsetPicker
Definition: editor.h:838
int m_FileDialogFileType
Definition: editor.h:651
ColorRGBA m_aSavedColors[8]
Definition: editor.h:817
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:5683
void RenderImagesList(CUIRect Toolbox)
Definition: editor.cpp:4741
void PopupSelectSoundInvoke(int Current, float x, float y)
Definition: popups.cpp:2302
static bool AddSound(const char *pFileName, int StorageType, void *pUser)
Definition: editor.cpp:4571
CLineInputBuffered< IO_MAX_PATH_LENGTH > m_FileDialogFileNameInput
Definition: editor.h:645
int m_PopupEventType
Definition: editor.h:620
unsigned char m_TuningNum
Definition: editor.h:1165
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:2338
int m_SortByFilename
Definition: editor.h:731
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:625
int m_PopupEventWasActivated
Definition: editor.h:622
float ScreenToEnvelopeDY(const CUIRect &View, float DeltaY)
Definition: editor.cpp:6047
static CUi::EPopupMenuFunctionResult PopupMenuTools(void *pContext, CUIRect View, bool Active)
Definition: popups.cpp:143
void RenderLayers(CUIRect LayersBox)
Definition: editor.cpp:3759
CEditor()
Definition: editor.h:358
void ZoomAdaptOffsetX(float ZoomFactor, const CUIRect &View)
Definition: editor.cpp:5932
int m_SelectedQuadIndex
Definition: editor.h:798
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:766
CRenderTools * RenderTools()
Definition: editor.h:329
int m_Mentions
Definition: editor.h:628
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:1588
bool m_FileDialogOpening
Definition: editor.h:662
CImageInfo m_TileartImageInfo
Definition: editor.h:853
static bool CallbackAddTileart(const char *pFilepath, int StorageType, void *pUser)
Definition: tileart.cpp:192
int m_FilePreviewImageHeight
Definition: editor.h:661
CSmoothValue m_ZoomEnvelopeX
Definition: editor.h:738
void FillGameTiles(EGameTileOp FillTile) const
Definition: quick_actions.cpp:8
static CUi::EPopupMenuFunctionResult PopupSound(void *pContext, CUIRect View, bool Active)
Definition: popups.cpp:1760
void RenderSounds(CUIRect Toolbox)
Definition: editor.cpp:4915
bool IsQuadSelected(int Index) const
Definition: editor.cpp:582
float m_aExtraEditorSplits[NUM_EXTRAEDITORS]
Definition: editor.h:783
std::deque< std::shared_ptr< CDataFileWriterFinishJob > > m_WriterFinishJobs
Definition: editor.h:843
CEditorHistory m_ServerSettingsHistory
Definition: editor.h:1181
bool IsInTriangle(vec2 Point, vec2 A, vec2 B, vec2 C)
Definition: editor.cpp:2560
std::vector< int > m_vSelectedLayers
Definition: editor.h:795
CLayerSelector * LayerSelector()
Definition: editor.h:333
void LoadCurrentMap()
Definition: editor.cpp:8834
void SortFilteredFileList()
Definition: editor.cpp:5033
void DoSoundSource(int LayerIndex, CSoundSource *pSource, int Index)
Definition: editor.cpp:1441
IGraphics::CTextureHandle m_BackgroundTexture
Definition: editor.h:822
void RenderEditorHistory(CUIRect View)
Definition: editor.cpp:7552
bool PerformAutosave()
Definition: editor.cpp:8629
void SelectPreviousLayer()
Definition: editor.cpp:765
CLineInputBuffered< IO_MAX_PATH_LENGTH > m_FileDialogNewFolderNameInput
Definition: editor.h:655
int PopupSelectSoundResult()
Definition: popups.cpp:2310
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:1172
void UndoLastAction()
Definition: editor.cpp:9046
void DeselectEnvPoints()
Definition: editor.cpp:664
bool m_PreventUnusedTilesWasWarned
Definition: editor.h:624
bool m_FileDialogShowingRoot
Definition: editor.h:653
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:676
unsigned char m_SwitchNum
Definition: editor.h:1171
float m_MouseWorldScale
Definition: editor.h:751
static CUi::EPopupMenuFunctionResult PopupSelectConfigAutoMap(void *pContext, CUIRect View, bool Active)
Definition: popups.cpp:2376
EShowEnvelope m_ShowEnvelopePreview
Definition: editor.h:792
void ResetMentions() override
Definition: editor.h:504
void DrawAxis(EAxis Axis, CPoint &OriginalPoint, CPoint &Point) const
Definition: editor.cpp:1566
void RenderFileDialog()
Definition: editor.cpp:5054
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:1195
class CEditor * m_pEditor
Definition: layer.h:18
class IGraphics * Graphics()
Definition: editor.h:1194
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:200
void Invalidate()
Definition: graphics.h:213
Definition: graphics.h:183
@ CORNER_ALL
Definition: graphics.h:430
Definition: input.h:20
Definition: jobs.h:20
Definition: sound.h:12
Definition: storage.h:20
Definition: textrender.h:312
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
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
@ 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
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:2943
int str_comp(const char *a, const char *b)
Definition: system.cpp:2933
int str_copy(char *dst, const char *src, int dst_size)
Definition: system.cpp:2720
#define GNUC_ATTRIBUTE(x)
Definition: log.h:10
@ TILE_TELEINEVIL
Definition: mapitems.h:111
@ TILE_TELEIN
Definition: mapitems.h:129
@ TILE_TELECHECKOUT
Definition: mapitems.h:133
@ TILE_TELEINWEAPON
Definition: mapitems.h:115
@ TILE_TELEOUT
Definition: mapitems.h:130
@ TILE_TELECHECK
Definition: mapitems.h:132
@ TILE_TELEINHOOK
Definition: mapitems.h:116
static MAYBE_UNUSED constexpr float MENU
Definition: editor_ui.h:19
Definition: editor.h:667
bool m_IsLink
Definition: editor.h:671
bool m_IsDir
Definition: editor.h:670
int m_StorageType
Definition: editor.h:672
time_t m_TimeModified
Definition: editor.h:673
char m_aName[IO_MAX_PATH_LENGTH]
Definition: editor.h:669
char m_aFilename[IO_MAX_PATH_LENGTH]
Definition: editor.h:668
Definition: editor.h:990
int m_Diff
Definition: editor.h:1001
CPoint m_AlignedPoint
Definition: editor.h:991
int m_X
Definition: editor.h:996
int m_Y
Definition: editor.h:997
int m_PointIndex
Definition: editor.h:1000
EAxis m_Axis
Definition: editor.h:999
Definition: editor.h:962
@ NUM_POINTS
Definition: editor.h:970
@ POINT_CENTER
Definition: editor.h:969
@ POINT_TR
Definition: editor.h:966
@ POINT_TL
Definition: editor.h:965
@ POINT_BL
Definition: editor.h:967
@ POINT_BR
Definition: editor.h:968
CPoint m_aPoints[NUM_POINTS]
Definition: editor.h:972
Definition: editor.h:890
std::vector< int > m_vLayerIndices
Definition: editor.h:893
std::vector< std::shared_ptr< CLayerTiles > > m_vpLayers
Definition: editor.h:892
CLayerTiles::SCommonPropState m_CommonPropState
Definition: editor.h:894
CEditor * m_pEditor
Definition: editor.h:891
Definition: editor.h:520
bool operator()(const char *pLhs, const char *pRhs) const
Definition: editor.h:521
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