DDNet documentation
Loading...
Searching...
No Matches
quick_actions.h
Go to the documentation of this file.
1// This file can be included several times.
2
3#ifndef REGISTER_QUICK_ACTION
4// This helps IDEs properly syntax highlight the uses of the macro below.
5#define REGISTER_QUICK_ACTION(name, text, callback, disabled, active, button_color, description)
6#endif
7
8#define ALWAYS_FALSE []() -> bool { return false; }
9#define DEFAULT_BTN []() -> int { return -1; }
10
12 ShowHelp,
13 "Show help",
14 [&]() { ShowHelp(); },
18 "[F1] Open the DDNet Wiki page for the map editor in a web browser.")
20 Exit,
21 "Exit",
22 [&]() { Exit(); },
26 "[Escape] Exit from the editor.")
28 BrushPicker,
29 "Brush picker",
30 [&]() { m_ShowPickerToggle = !m_ShowPickerToggle; },
31 [&]() -> bool {
32 return m_Mode != MODE_LAYERS ||
33 Map()->m_vSelectedLayers.size() != 1 ||
34 Map()->SelectedLayer(0) == nullptr ||
35 (Map()->SelectedLayer(0)->m_Type != LAYERTYPE_TILES && Map()->SelectedLayer(0)->m_Type != LAYERTYPE_QUADS);
36 },
37 [&]() -> bool { return m_ShowPickerToggle; },
39 "[Ctrl+Space, Hold Space] Toggle brush picker.")
41 ToggleGrid,
42 "Toggle grid",
43 [&]() { MapView()->MapGrid()->Toggle(); },
45 [&]() -> bool { return MapView()->MapGrid()->IsEnabled(); },
47 "[Ctrl+G] Toggle grid.")
49 GameTilesAir,
50 "Game tiles: Air",
51 [&]() { FillGameTiles(EGameTileOp::AIR); },
52 [&]() -> bool { return !CanFillGameTiles(); },
55 "Construct game tiles from this layer.")
57 GameTilesHookable,
58 "Game tiles: Hookable",
59 [&]() { FillGameTiles(EGameTileOp::HOOKABLE); },
60 [&]() -> bool { return !CanFillGameTiles(); },
63 "Construct game tiles from this layer.")
65 GameTilesDeath,
66 "Game tiles: Death",
67 [&]() { FillGameTiles(EGameTileOp::DEATH); },
68 [&]() -> bool { return !CanFillGameTiles(); },
71 "Construct game tiles from this layer.")
73 GameTilesUnhookable,
74 "Game tiles: Unhookable",
75 [&]() { FillGameTiles(EGameTileOp::UNHOOKABLE); },
76 [&]() -> bool { return !CanFillGameTiles(); },
79 "Construct game tiles from this layer.")
81 GameTilesHookthrough,
82 "Game tiles: Hookthrough",
83 [&]() { FillGameTiles(EGameTileOp::HOOKTHROUGH); },
84 [&]() -> bool { return !CanFillGameTiles(); },
87 "Construct game tiles from this layer.")
89 GameTilesFreeze,
90 "Game tiles: Freeze",
91 [&]() { FillGameTiles(EGameTileOp::FREEZE); },
92 [&]() -> bool { return !CanFillGameTiles(); },
95 "Construct game tiles from this layer.")
97 GameTilesUnfreeze,
98 "Game tiles: Unfreeze",
99 [&]() { FillGameTiles(EGameTileOp::UNFREEZE); },
100 [&]() -> bool { return !CanFillGameTiles(); },
103 "Construct game tiles from this layer.")
105 GameTilesDeepFreeze,
106 "Game tiles: Deep Freeze",
107 [&]() { FillGameTiles(EGameTileOp::DEEP_FREEZE); },
108 [&]() -> bool { return !CanFillGameTiles(); },
111 "Construct game tiles from this layer.")
113 GameTilesDeepUnfreeze,
114 "Game tiles: Deep Unfreeze",
115 [&]() { FillGameTiles(EGameTileOp::DEEP_UNFREEZE); },
116 [&]() -> bool { return !CanFillGameTiles(); },
119 "Construct game tiles from this layer.")
121 GameTilesBlueCheckTele,
122 "Game tiles: Blue Check Tele",
123 [&]() { FillGameTiles(EGameTileOp::BLUE_CHECK_TELE); },
124 [&]() -> bool { return !CanFillGameTiles(); },
127 "Construct game tiles from this layer.")
129 GameTilesRedCheckTele,
130 "Game tiles: Red Check Tele",
131 [&]() { FillGameTiles(EGameTileOp::RED_CHECK_TELE); },
132 [&]() -> bool { return !CanFillGameTiles(); },
135 "Construct game tiles from this layer.")
137 GameTilesLiveFreeze,
138 "Game tiles: Live Freeze",
139 [&]() { FillGameTiles(EGameTileOp::LIVE_FREEZE); },
140 [&]() -> bool { return !CanFillGameTiles(); },
143 "Construct game tiles from this layer.")
145 GameTilesLiveUnfreeze,
146 "Game tiles: Live Unfreeze",
147 [&]() { FillGameTiles(EGameTileOp::LIVE_UNFREEZE); },
148 [&]() -> bool { return !CanFillGameTiles(); },
151 "Construct game tiles from this layer.")
153 AddGroup,
154 "Add group",
155 [&]() { AddGroup(); },
159 "Add a new group.")
161 ResetZoom,
162 "Reset zoom",
163 [&]() { MapView()->ResetZoom(); },
167 "[Numpad*] Zoom to normal and remove editor offset.")
169 ZoomOut,
170 "Zoom out",
171 [&]() { MapView()->Zoom()->ScaleValue(1.331f); },
175 "[Numpad-] Zoom out.")
177 ZoomIn,
178 "Zoom in",
179 [&]() { MapView()->Zoom()->ScaleValue(1.0f / 1.331f); },
183 "[Numpad+] Zoom in.")
185 Refocus,
186 "Refocus",
187 [&]() { MapView()->Focus(); },
191 "[Home] Restore map focus.")
193 GotoPosition,
194 "Goto position",
195 [&]() { GotoPosition(); },
199 "Go to a specified coordinate point on the map.")
201 Proof,
202 "Proof",
203 [&]() { MapView()->ProofMode()->Toggle(); },
205 [&]() -> bool { return MapView()->ProofMode()->IsEnabled(); },
207 "Toggle proof borders. These borders represent the area that a player can see with default zoom.")
209 AddTileLayer, "Add tile layer", [&]() { AddTileLayer(); }, ALWAYS_FALSE, ALWAYS_FALSE, DEFAULT_BTN, "Create a new tile layer.")
211 AddSwitchLayer,
212 "Add switch layer",
213 [&]() { AddSwitchLayer(); },
214 [&]() -> bool { return !Map()->SelectedGroup()->m_GameGroup || Map()->m_pSwitchLayer; },
217 "Create a new switch layer.")
219 AddTuneLayer,
220 "Add tune layer",
221 [&]() { AddTuneLayer(); },
222 [&]() -> bool { return !Map()->SelectedGroup()->m_GameGroup || Map()->m_pTuneLayer; },
225 "Create a new tuning layer.")
227 AddSpeedupLayer,
228 "Add speedup layer",
229 [&]() { AddSpeedupLayer(); },
230 [&]() -> bool { return !Map()->SelectedGroup()->m_GameGroup || Map()->m_pSpeedupLayer; },
233 "Create a new speedup layer.")
235 AddTeleLayer,
236 "Add tele layer",
237 [&]() { AddTeleLayer(); },
238 [&]() -> bool { return !Map()->SelectedGroup()->m_GameGroup || Map()->m_pTeleLayer; },
241 "Create a new tele layer.")
243 AddFrontLayer,
244 "Add front layer",
245 [&]() { AddFrontLayer(); },
246 [&]() -> bool { return !Map()->SelectedGroup()->m_GameGroup || Map()->m_pFrontLayer; },
249 "Create a new item layer.")
251 AddQuadsLayer, "Add quads layer", [&]() { AddQuadsLayer(); }, ALWAYS_FALSE, ALWAYS_FALSE, DEFAULT_BTN, "Create a new quads layer.")
253 AddSoundLayer, "Add sound layer", [&]() { AddSoundLayer(); }, ALWAYS_FALSE, ALWAYS_FALSE, DEFAULT_BTN, "Create a new sound layer.")
255 NewMap,
256 "New map",
257 [&]() {
258 Reset();
259 AddDefaultMap();
260 },
264 "[Ctrl+N] Create a new map.")
266 Save,
267 "Save",
268 [&]() {
269 if(Map()->m_aFilename[0] != '\0' && Map()->m_ValidSaveFilename)
270 {
271 CallbackSaveMap(Map()->m_aFilename, IStorage::TYPE_SAVE, this);
272 }
273 else
274 {
275 m_FileBrowser.ShowFileDialog(IStorage::TYPE_SAVE, CFileBrowser::EFileType::MAP, "Save map", "Save", "maps", "", CallbackSaveMap, this);
276 }
277 },
281 "[Ctrl+S] Save the current map.")
283 SaveAs,
284 "Save as",
285 [&]() {
286 m_FileBrowser.ShowFileDialog(IStorage::TYPE_SAVE, CFileBrowser::EFileType::MAP, "Save map", "Save as", "maps", Map()->m_aAutosaveName, CallbackSaveMap, this);
287 },
291 "[Ctrl+Shift+S] Save the current map under a new name.")
293 SaveCopy,
294 "Save copy",
295 [&]() {
296 m_FileBrowser.ShowFileDialog(IStorage::TYPE_SAVE, CFileBrowser::EFileType::MAP, "Save map", "Save copy", "maps", Map()->m_aAutosaveName, CallbackSaveCopyMap, this);
297 },
301 "[Ctrl+Shift+Alt+S] Save a copy of the current map under a new name.")
303 LoadMap,
304 "Load map",
305 [&]() {
306 m_FileBrowser.ShowFileDialog(IStorage::TYPE_ALL, CFileBrowser::EFileType::MAP, "Load map", "Load", "maps", "", CallbackOpenMap, this);
307 },
311 "[Ctrl+L] Open a map for editing.")
313 LoadIngameMap,
314 "Load ingame map",
315 [&]() {
316 LoadIngameMap();
317 },
318 [&]() -> bool { return Client()->State() != IClient::STATE_ONLINE && Client()->State() != IClient::STATE_DEMOPLAYBACK; },
321 "[Ctrl+Shift+L] Open the current ingame map for editing.")
323 AppendMap,
324 "Append map",
325 [&]() {
326 m_FileBrowser.ShowFileDialog(IStorage::TYPE_ALL, CFileBrowser::EFileType::MAP, "Append map", "Append", "maps", "", CallbackAppendMap, this);
327 },
331 "[Ctrl+A] Open a map and add everything from that map to the current map.")
333 CloseMap,
334 "Close map",
335 [&]() { CloseMap(m_SelectedMap, true); },
339 "[Ctrl+F4] Close the current map.")
341 Envelopes,
342 "Envelopes",
343 [&]() { m_ActiveExtraEditor = m_ActiveExtraEditor == EXTRAEDITOR_ENVELOPES ? EXTRAEDITOR_NONE : EXTRAEDITOR_ENVELOPES; },
346 [&]() -> int { return m_ShowPicker ? -1 : m_ActiveExtraEditor == EXTRAEDITOR_ENVELOPES; },
347 "Toggle the envelope editor.")
349 ServerSettings,
350 "Server settings",
351 [&]() { m_ActiveExtraEditor = m_ActiveExtraEditor == EXTRAEDITOR_SERVER_SETTINGS ? EXTRAEDITOR_NONE : EXTRAEDITOR_SERVER_SETTINGS; },
354 [&]() -> int { return m_ShowPicker ? -1 : m_ActiveExtraEditor == EXTRAEDITOR_SERVER_SETTINGS; },
355 "Toggle the server settings editor.")
357 History,
358 "History",
359 [&]() { m_ActiveExtraEditor = m_ActiveExtraEditor == EXTRAEDITOR_HISTORY ? EXTRAEDITOR_NONE : EXTRAEDITOR_HISTORY; },
362 [&]() -> int { return m_ShowPicker ? -1 : m_ActiveExtraEditor == EXTRAEDITOR_HISTORY; },
363 "Toggle the editor history view.")
365 AddImage,
366 "Add image",
367 [&]() { m_FileBrowser.ShowFileDialog(IStorage::TYPE_ALL, CFileBrowser::EFileType::IMAGE, "Add image", "Add", "mapres", "", AddImage, this); },
371 "Load a new image to use in the map.")
373 LayerPropAddImage,
374 "Layer: add image",
375 [&]() { LayerSelectImage(); },
376 [&]() -> bool { return !IsNonGameTileLayerSelected(); },
379 "Pick mapres image for currently selected layer.")
381 ShowInfoOff,
382 "Show info: Off",
383 [&]() {
384 m_ShowTileInfo = SHOW_TILE_OFF;
385 },
387 [&]() -> bool { return m_ShowTileInfo == SHOW_TILE_OFF; },
389 "Do not show tile information.")
391 ShowInfoDec,
392 "Show info: Dec",
393 [&]() {
394 m_ShowTileInfo = SHOW_TILE_DECIMAL;
395 },
397 [&]() -> bool { return m_ShowTileInfo == SHOW_TILE_DECIMAL; },
399 "[Ctrl+I] Show tile information.")
401 ShowInfoHex,
402 "Show info: Hex",
403 [&]() {
404 m_ShowTileInfo = SHOW_TILE_HEXADECIMAL;
405 },
407 [&]() -> bool { return m_ShowTileInfo == SHOW_TILE_HEXADECIMAL; },
409 "[Ctrl+Shift+I] Show tile information in hexadecimal.")
411 PreviewQuadEnvelopes,
412 "Preview quad envelopes",
413 [&]() {
414 m_ShowEnvelopePreview = !m_ShowEnvelopePreview;
415 m_ActiveEnvelopePreview = EEnvelopePreview::NONE;
416 },
418 [&]() -> bool { return m_ShowEnvelopePreview; },
420 "Toggle previewing the paths of quads with a position envelope when a quad layer is selected.")
422 DeleteLayer,
423 "Delete layer",
424 [&]() { DeleteSelectedLayer(); },
425 [&]() -> bool {
426 std::shared_ptr<CLayer> pCurrentLayer = Map()->SelectedLayer(0);
427 if(!pCurrentLayer)
428 return true;
429 return Map()->m_pGameLayer == pCurrentLayer;
430 },
433 "Delete the layer.")
435 Pipette,
436 "Pipette",
437 [&]() { m_ColorPipetteActive = !m_ColorPipetteActive; },
439 [&]() -> bool { return m_ColorPipetteActive; },
441 "[Ctrl+Shift+C] Color pipette. Pick a color from the screen by clicking on it.")
443 MapDetails,
444 "Map details",
445 [&]() { MapDetails(); },
449 "Adjust the map details of the current map.")
451 AddQuad,
452 "Add quad",
453 [&]() { AddQuadOrSound(); },
454 [&]() -> bool {
455 std::shared_ptr<CLayer> pLayer = Map()->SelectedLayer(0);
456 if(!pLayer)
457 return false;
458 return pLayer->m_Type != LAYERTYPE_QUADS;
459 },
462 "[Ctrl+Q] Add a new quad.")
464 AddSoundSource,
465 "Add sound source",
466 [&]() { AddQuadOrSound(); },
467 [&]() -> bool {
468 std::shared_ptr<CLayer> pLayer = Map()->SelectedLayer(0);
469 if(!pLayer)
470 return false;
471 return pLayer->m_Type != LAYERTYPE_SOUNDS;
472 },
475 "[Ctrl+Q] Add a new sound source.")
477 TestMapLocally,
478 "Test map locally",
479 [&]() { TestMapLocally(); },
483 "Run a local server with the current map and connect you to it.")
484
485#undef ALWAYS_FALSE
486#undef DEFAULT_BTN
@ IMAGE
Definition file_browser.h:22
@ MAP
Definition file_browser.h:21
@ STATE_DEMOPLAYBACK
Definition client.h:60
@ STATE_ONLINE
Definition client.h:59
@ TYPE_ALL
Definition storage.h:27
@ TYPE_SAVE
Definition storage.h:26
#define ALWAYS_FALSE
@ MODE_LAYERS
Definition editor.h:56
#define DEFAULT_BTN
@ DEEP_FREEZE
Definition enums.h:28
@ DEEP_UNFREEZE
Definition enums.h:29
@ FREEZE
Definition enums.h:26
@ AIR
Definition enums.h:21
@ UNHOOKABLE
Definition enums.h:24
@ LIVE_FREEZE
Definition enums.h:32
@ UNFREEZE
Definition enums.h:27
@ HOOKABLE
Definition enums.h:22
@ DEATH
Definition enums.h:23
@ LIVE_UNFREEZE
Definition enums.h:33
@ HOOKTHROUGH
Definition enums.h:25
@ BLUE_CHECK_TELE
Definition enums.h:30
@ RED_CHECK_TELE
Definition enums.h:31
@ LAYERTYPE_TILES
Definition mapitems.h:14
@ LAYERTYPE_QUADS
Definition mapitems.h:15
@ LAYERTYPE_SOUNDS
Definition mapitems.h:22
#define REGISTER_QUICK_ACTION(name, text, callback, disabled, active, button_color, description)
Definition quick_actions.h:5