Skip to content

Commit f3cf771

Browse files
AllyTallyInfoTeddy
authored andcommitted
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.
1 parent d328be2 commit f3cf771

File tree

2 files changed

+32
-2
lines changed

2 files changed

+32
-2
lines changed

desktop_version/lang/en/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -630,6 +630,7 @@
630630
<string english="Now using {area} Tileset" translation="" explanation="level editor, user changed the tileset of the room to {area} (like Ship, Lab, etc)" max="38*3"/>
631631
<string english="Tileset Colour Changed" translation="" explanation="level editor, user changed the tileset colour/variant of the room" max="38*3"/>
632632
<string english="Enemy Type Changed" translation="" explanation="level editor, user changed enemy appearance for the room" max="38*3"/>
633+
<string english="Platform speed is now {speed}" translation="" explanation="level editor, user changed speed of platforms for the room" max="38*3"/>
633634
<string english="Reloaded resources" translation="" explanation="level editor, reloaded graphics assets/resources, music and sound effects" max="38*3"/>
634635
<string english="ERROR: Invalid format" translation="" explanation="user was supposed to enter something like `12,12`, but entered `as@df`" max="38*3"/>
635636
<string english="Loaded map: {filename}.vvvvvv" translation="" explanation="successfully loaded level file" max="38*3"/>

desktop_version/src/Editor.cpp

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2771,17 +2771,46 @@ static void handle_draw_input()
27712771
ed.x_modifier = key.keymap[SDLK_x];
27722772
ed.z_modifier = key.keymap[SDLK_z];
27732773

2774+
const int room = ed.levx + ed.levy * cl.maxwidth;
2775+
const int plat_speed = cl.roomproperties[room].platv;
2776+
27742777
if (key.keymap[SDLK_COMMA])
27752778
{
2776-
ed.current_tool = (EditorTools) POS_MOD(ed.current_tool - 1, NUM_EditorTools);
2779+
if (key.keymap[SDLK_LCTRL] || key.keymap[SDLK_RCTRL])
2780+
{
2781+
cl.roomproperties[room].platv = plat_speed - 1;
2782+
}
2783+
else
2784+
{
2785+
ed.current_tool = (EditorTools) POS_MOD(ed.current_tool - 1, NUM_EditorTools);
2786+
}
27772787
ed.keydelay = 6;
27782788
}
27792789
else if (key.keymap[SDLK_PERIOD])
27802790
{
2781-
ed.current_tool = (EditorTools) POS_MOD(ed.current_tool + 1, NUM_EditorTools);
2791+
if (key.keymap[SDLK_LCTRL] || key.keymap[SDLK_RCTRL])
2792+
{
2793+
cl.roomproperties[room].platv = plat_speed + 1;
2794+
}
2795+
else
2796+
{
2797+
ed.current_tool = (EditorTools) POS_MOD(ed.current_tool + 1, NUM_EditorTools);
2798+
}
27822799
ed.keydelay = 6;
27832800
}
27842801

2802+
if (plat_speed != cl.roomproperties[room].platv)
2803+
{
2804+
char buffer[3 * SCREEN_WIDTH_CHARS + 1];
2805+
vformat_buf(
2806+
buffer, sizeof(buffer),
2807+
loc::gettext("Platform speed is now {speed}"),
2808+
"speed:int",
2809+
cl.roomproperties[room].platv
2810+
);
2811+
ed.show_note(buffer);
2812+
}
2813+
27852814
if (key.keymap[SDLK_SPACE])
27862815
{
27872816
ed.toolbox_open = !ed.toolbox_open;

0 commit comments

Comments
 (0)