DDraceNetwork 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 ToggleGrid,
21 "Toggle grid",
22 [&]() { MapView()->MapGrid()->Toggle(); },
24 [&]() -> bool { return MapView()->MapGrid()->IsEnabled(); },
26 "[Ctrl+G] Toggle grid.")
28 GameTilesAir,
29 "Game tiles: Air",
30 [&]() { FillGameTiles(EGameTileOp::AIR); },
31 [&]() -> bool { return !CanFillGameTiles(); },
34 "Construct game tiles from this layer.")
36 GameTilesHookable,
37 "Game tiles: Hookable",
38 [&]() { FillGameTiles(EGameTileOp::HOOKABLE); },
39 [&]() -> bool { return !CanFillGameTiles(); },
42 "Construct game tiles from this layer.")
44 GameTilesDeath,
45 "Game tiles: Death",
46 [&]() { FillGameTiles(EGameTileOp::DEATH); },
47 [&]() -> bool { return !CanFillGameTiles(); },
50 "Construct game tiles from this layer.")
52 GameTilesUnhookable,
53 "Game tiles: Unhookable",
54 [&]() { FillGameTiles(EGameTileOp::UNHOOKABLE); },
55 [&]() -> bool { return !CanFillGameTiles(); },
58 "Construct game tiles from this layer.")
60 GameTilesHookthrough,
61 "Game tiles: Hookthrough",
62 [&]() { FillGameTiles(EGameTileOp::HOOKTHROUGH); },
63 [&]() -> bool { return !CanFillGameTiles(); },
66 "Construct game tiles from this layer.")
68 GameTilesFreeze,
69 "Game tiles: Freeze",
70 [&]() { FillGameTiles(EGameTileOp::FREEZE); },
71 [&]() -> bool { return !CanFillGameTiles(); },
74 "Construct game tiles from this layer.")
76 GameTilesUnfreeze,
77 "Game tiles: Unfreeze",
78 [&]() { FillGameTiles(EGameTileOp::UNFREEZE); },
79 [&]() -> bool { return !CanFillGameTiles(); },
82 "Construct game tiles from this layer.")
84 GameTilesDeepFreeze,
85 "Game tiles: Deep Freeze",
86 [&]() { FillGameTiles(EGameTileOp::DEEP_FREEZE); },
87 [&]() -> bool { return !CanFillGameTiles(); },
90 "Construct game tiles from this layer.")
92 GameTilesDeepUnfreeze,
93 "Game tiles: Deep Unfreeze",
94 [&]() { FillGameTiles(EGameTileOp::DEEP_UNFREEZE); },
95 [&]() -> bool { return !CanFillGameTiles(); },
98 "Construct game tiles from this layer.")
100 GameTilesBlueCheckTele,
101 "Game tiles: Blue Check Tele",
102 [&]() { FillGameTiles(EGameTileOp::BLUE_CHECK_TELE); },
103 [&]() -> bool { return !CanFillGameTiles(); },
106 "Construct game tiles from this layer.")
108 GameTilesRedCheckTele,
109 "Game tiles: Red Check Tele",
110 [&]() { FillGameTiles(EGameTileOp::RED_CHECK_TELE); },
111 [&]() -> bool { return !CanFillGameTiles(); },
114 "Construct game tiles from this layer.")
116 GameTilesLiveFreeze,
117 "Game tiles: Live Freeze",
118 [&]() { FillGameTiles(EGameTileOp::LIVE_FREEZE); },
119 [&]() -> bool { return !CanFillGameTiles(); },
122 "Construct game tiles from this layer.")
124 GameTilesLiveUnfreeze,
125 "Game tiles: Live Unfreeze",
126 [&]() { FillGameTiles(EGameTileOp::LIVE_UNFREEZE); },
127 [&]() -> bool { return !CanFillGameTiles(); },
130 "Construct game tiles from this layer.")
132 AddGroup,
133 "Add group",
134 [&]() { AddGroup(); },
138 "Add a new group.")
140 ResetZoom,
141 "Reset zoom",
142 [&]() { MapView()->ResetZoom(); },
146 "[Numpad*] Zoom to normal and remove editor offset.")
148 ZoomOut,
149 "Zoom out",
150 [&]() { MapView()->Zoom()->ChangeValue(50.0f); },
154 "[Numpad-] Zoom out.")
156 ZoomIn,
157 "Zoom in",
158 [&]() { MapView()->Zoom()->ChangeValue(-50.0f); },
162 "[Numpad+] Zoom in.")
164 Refocus,
165 "Refocus",
166 [&]() { MapView()->Focus(); },
170 "[Home] Restore map focus.")
172 Proof,
173 "Proof",
174 [&]() { MapView()->ProofMode()->Toggle(); },
176 [&]() -> bool { return MapView()->ProofMode()->IsEnabled(); },
178 "Toggle proof borders. These borders represent the area that a player can see with default zoom.")
180 AddTileLayer, "Add tile layer", [&]() { AddTileLayer(); }, ALWAYS_FALSE, ALWAYS_FALSE, DEFAULT_BTN, "Create a new tile layer.")
182 AddSwitchLayer,
183 "Add switch layer",
184 [&]() { AddSwitchLayer(); },
185 [&]() -> bool { return !Map()->SelectedGroup()->m_GameGroup || Map()->m_pSwitchLayer; },
188 "Create a new switch layer.")
190 AddTuneLayer,
191 "Add tune layer",
192 [&]() { AddTuneLayer(); },
193 [&]() -> bool { return !Map()->SelectedGroup()->m_GameGroup || Map()->m_pTuneLayer; },
196 "Create a new tuning layer.")
198 AddSpeedupLayer,
199 "Add speedup layer",
200 [&]() { AddSpeedupLayer(); },
201 [&]() -> bool { return !Map()->SelectedGroup()->m_GameGroup || Map()->m_pSpeedupLayer; },
204 "Create a new speedup layer.")
206 AddTeleLayer,
207 "Add tele layer",
208 [&]() { AddTeleLayer(); },
209 [&]() -> bool { return !Map()->SelectedGroup()->m_GameGroup || Map()->m_pTeleLayer; },
212 "Create a new tele layer.")
214 AddFrontLayer,
215 "Add front layer",
216 [&]() { AddFrontLayer(); },
217 [&]() -> bool { return !Map()->SelectedGroup()->m_GameGroup || Map()->m_pFrontLayer; },
220 "Create a new item layer.")
222 AddQuadsLayer, "Add quads layer", [&]() { AddQuadsLayer(); }, ALWAYS_FALSE, ALWAYS_FALSE, DEFAULT_BTN, "Create a new quads layer.")
224 AddSoundLayer, "Add sound layer", [&]() { AddSoundLayer(); }, ALWAYS_FALSE, ALWAYS_FALSE, DEFAULT_BTN, "Create a new sound layer.")
226 SaveAs,
227 "Save as",
228 [&]() {
229 char aDefaultName[IO_MAX_PATH_LENGTH];
230 fs_split_file_extension(fs_filename(Map()->m_aFilename), aDefaultName, sizeof(aDefaultName));
231 m_FileBrowser.ShowFileDialog(IStorage::TYPE_SAVE, CFileBrowser::EFileType::MAP, "Save map", "Save as", "maps", aDefaultName, CallbackSaveMap, this);
232 },
236 "[Ctrl+Shift+S] Save the current map under a new name.")
238 LoadCurrentMap,
239 "Load current map",
240 [&]() {
241 if(HasUnsavedData())
242 {
243 if(!m_PopupEventWasActivated)
244 {
245 m_PopupEventType = POPEVENT_LOADCURRENT;
246 m_PopupEventActivated = true;
247 }
248 }
249 else
250 {
251 LoadCurrentMap();
252 }
253 },
254 [&]() -> bool { return Client()->State() != IClient::STATE_ONLINE && Client()->State() != IClient::STATE_DEMOPLAYBACK; },
257 "[Ctrl+Shift+L] Open the current ingame map for editing.")
259 Envelopes,
260 "Envelopes",
261 [&]() { m_ActiveExtraEditor = m_ActiveExtraEditor == EXTRAEDITOR_ENVELOPES ? EXTRAEDITOR_NONE : EXTRAEDITOR_ENVELOPES; },
264 [&]() -> int { return m_ShowPicker ? -1 : m_ActiveExtraEditor == EXTRAEDITOR_ENVELOPES; },
265 "Toggle the envelope editor.")
267 ServerSettings,
268 "Server settings",
269 [&]() { m_ActiveExtraEditor = m_ActiveExtraEditor == EXTRAEDITOR_SERVER_SETTINGS ? EXTRAEDITOR_NONE : EXTRAEDITOR_SERVER_SETTINGS; },
272 [&]() -> int { return m_ShowPicker ? -1 : m_ActiveExtraEditor == EXTRAEDITOR_SERVER_SETTINGS; },
273 "Toggle the server settings editor.")
275 History,
276 "History",
277 [&]() { m_ActiveExtraEditor = m_ActiveExtraEditor == EXTRAEDITOR_HISTORY ? EXTRAEDITOR_NONE : EXTRAEDITOR_HISTORY; },
280 [&]() -> int { return m_ShowPicker ? -1 : m_ActiveExtraEditor == EXTRAEDITOR_HISTORY; },
281 "Toggle the editor history view.")
283 AddImage,
284 "Add image",
285 [&]() { m_FileBrowser.ShowFileDialog(IStorage::TYPE_ALL, CFileBrowser::EFileType::IMAGE, "Add image", "Add", "mapres", "", AddImage, this); },
289 "Load a new image to use in the map.")
291 LayerPropAddImage,
292 "Layer: add image",
293 [&]() { LayerSelectImage(); },
294 [&]() -> bool { return !IsNonGameTileLayerSelected(); },
297 "Pick mapres image for currently selected layer.")
299 ShowInfoOff,
300 "Show info: Off",
301 [&]() {
302 m_ShowTileInfo = SHOW_TILE_OFF;
303 },
305 [&]() -> bool { return m_ShowTileInfo == SHOW_TILE_OFF; },
307 "Do not show tile information.")
309 ShowInfoDec,
310 "Show info: Dec",
311 [&]() {
312 m_ShowTileInfo = SHOW_TILE_DECIMAL;
313 },
315 [&]() -> bool { return m_ShowTileInfo == SHOW_TILE_DECIMAL; },
317 "[Ctrl+I] Show tile information.")
319 ShowInfoHex,
320 "Show info: Hex",
321 [&]() {
322 m_ShowTileInfo = SHOW_TILE_HEXADECIMAL;
323 },
325 [&]() -> bool { return m_ShowTileInfo == SHOW_TILE_HEXADECIMAL; },
327 "[Ctrl+Shift+I] Show tile information in hexadecimal.")
329 PreviewQuadEnvelopes,
330 "Preview quad envelopes",
331 [&]() {
332 m_ShowEnvelopePreview = !m_ShowEnvelopePreview;
333 m_ActiveEnvelopePreview = EEnvelopePreview::NONE;
334 },
336 [&]() -> bool { return m_ShowEnvelopePreview; },
338 "Toggle previewing the paths of quads with a position envelope when a quad layer is selected.")
340 DeleteLayer,
341 "Delete layer",
342 [&]() { DeleteSelectedLayer(); },
343 [&]() -> bool {
344 std::shared_ptr<CLayer> pCurrentLayer = Map()->SelectedLayer(0);
345 if(!pCurrentLayer)
346 return true;
347 return Map()->m_pGameLayer == pCurrentLayer;
348 },
351 "Delete the layer.")
353 Pipette,
354 "Pipette",
355 [&]() { m_ColorPipetteActive = !m_ColorPipetteActive; },
357 [&]() -> bool { return m_ColorPipetteActive; },
359 "[Ctrl+Shift+C] Color pipette. Pick a color from the screen by clicking on it.")
361 MapDetails,
362 "Map details",
363 [&]() { MapDetails(); },
367 "Adjust the map details of the current map.")
369 AddQuad,
370 "Add quad",
371 [&]() { AddQuadOrSound(); },
372 [&]() -> bool {
373 std::shared_ptr<CLayer> pLayer = Map()->SelectedLayer(0);
374 if(!pLayer)
375 return false;
376 return pLayer->m_Type != LAYERTYPE_QUADS;
377 },
380 "[Ctrl+Q] Add a new quad.")
382 AddSoundSource,
383 "Add sound source",
384 [&]() { AddQuadOrSound(); },
385 [&]() -> bool {
386 std::shared_ptr<CLayer> pLayer = Map()->SelectedLayer(0);
387 if(!pLayer)
388 return false;
389 return pLayer->m_Type != LAYERTYPE_SOUNDS;
390 },
393 "[Ctrl+Q] Add a new sound source.")
395 TestMapLocally,
396 "Test map locally",
397 [&]() { TestMapLocally(); },
401 "Run a local server with the current map and connect you to it.")
402
403#undef ALWAYS_FALSE
404#undef DEFAULT_BTN
@ IMAGE
Definition file_browser.h:22
@ MAP
Definition file_browser.h:21
@ STATE_DEMOPLAYBACK
Definition client.h:58
@ STATE_ONLINE
Definition client.h:57
@ TYPE_ALL
Definition storage.h:27
@ TYPE_SAVE
Definition storage.h:26
#define ALWAYS_FALSE
#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
const char * fs_filename(const char *path)
Definition fs.cpp:456
void fs_split_file_extension(const char *filename, char *name, size_t name_size, char *extension, size_t extension_size)
Definition fs.cpp:466
@ 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
constexpr auto IO_MAX_PATH_LENGTH
Definition types.h:56