From f3cf771cc86085a65d3ccbd046bb16fcf15f8b62 Mon Sep 17 00:00:00 2001 From: AllyTally Date: Tue, 21 Mar 2023 14:28:55 -0300 Subject: [PATCH] CTRL+, and CTRL+. to modify platv `platv` is a room property that controls platform speed, and it has always worked (other than some weird storage issues due to a bug). However, the editor has no way to edit it currently, so people had to resort to editing the level file by hand, or with a third-party tool. This commit simply adds an easy way to modify platform speed. --- desktop_version/lang/en/strings.xml | 1 + desktop_version/src/Editor.cpp | 33 +++++++++++++++++++++++++++-- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/desktop_version/lang/en/strings.xml b/desktop_version/lang/en/strings.xml index feb41259..6b9a3b3f 100644 --- a/desktop_version/lang/en/strings.xml +++ b/desktop_version/lang/en/strings.xml @@ -630,6 +630,7 @@ + diff --git a/desktop_version/src/Editor.cpp b/desktop_version/src/Editor.cpp index ae31c919..2bb89a4a 100644 --- a/desktop_version/src/Editor.cpp +++ b/desktop_version/src/Editor.cpp @@ -2771,17 +2771,46 @@ static void handle_draw_input() ed.x_modifier = key.keymap[SDLK_x]; ed.z_modifier = key.keymap[SDLK_z]; + const int room = ed.levx + ed.levy * cl.maxwidth; + const int plat_speed = cl.roomproperties[room].platv; + if (key.keymap[SDLK_COMMA]) { - ed.current_tool = (EditorTools) POS_MOD(ed.current_tool - 1, NUM_EditorTools); + if (key.keymap[SDLK_LCTRL] || key.keymap[SDLK_RCTRL]) + { + cl.roomproperties[room].platv = plat_speed - 1; + } + else + { + ed.current_tool = (EditorTools) POS_MOD(ed.current_tool - 1, NUM_EditorTools); + } ed.keydelay = 6; } else if (key.keymap[SDLK_PERIOD]) { - ed.current_tool = (EditorTools) POS_MOD(ed.current_tool + 1, NUM_EditorTools); + if (key.keymap[SDLK_LCTRL] || key.keymap[SDLK_RCTRL]) + { + cl.roomproperties[room].platv = plat_speed + 1; + } + else + { + ed.current_tool = (EditorTools) POS_MOD(ed.current_tool + 1, NUM_EditorTools); + } ed.keydelay = 6; } + if (plat_speed != cl.roomproperties[room].platv) + { + char buffer[3 * SCREEN_WIDTH_CHARS + 1]; + vformat_buf( + buffer, sizeof(buffer), + loc::gettext("Platform speed is now {speed}"), + "speed:int", + cl.roomproperties[room].platv + ); + ed.show_note(buffer); + } + if (key.keymap[SDLK_SPACE]) { ed.toolbox_open = !ed.toolbox_open;