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.
This commit is contained in:
AllyTally
2023-03-21 14:28:55 -03:00
committed by Misa Elizabeth Kai
parent d328be2a03
commit f3cf771cc8
2 changed files with 32 additions and 2 deletions

View File

@@ -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;