From 3b7d3b8d4d62b04d3477003941b8d2890755f899 Mon Sep 17 00:00:00 2001 From: Mircea Kitsune Date: Thu, 27 Oct 2011 23:01:25 +0300 Subject: [PATCH] Allow the menu to specify material as a text string --- defaultXonotic.cfg | 2 +- qcsrc/menu/xonotic/dialog_sandboxtools.c | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/defaultXonotic.cfg b/defaultXonotic.cfg index 331b421b2..0f6827eab 100644 --- a/defaultXonotic.cfg +++ b/defaultXonotic.cfg @@ -562,7 +562,7 @@ seta menu_sandbox_edit_frame 0 seta menu_sandbox_edit_scale 1 seta menu_sandbox_edit_physics 1 seta menu_sandbox_edit_force 1 -seta menu_sandbox_edit_material 0 +seta menu_sandbox_edit_material "" alias menu_showsandboxtools "menu_cmd directmenu SandboxTools" bind f7 menu_showsandboxtools diff --git a/qcsrc/menu/xonotic/dialog_sandboxtools.c b/qcsrc/menu/xonotic/dialog_sandboxtools.c index a8f0e6a29..320eaa800 100644 --- a/qcsrc/menu/xonotic/dialog_sandboxtools.c +++ b/qcsrc/menu/xonotic/dialog_sandboxtools.c @@ -58,13 +58,20 @@ void XonoticSandboxToolsDialog_fill(entity me) me.TD(me, 1, 2, e = makeXonoticTextLabel(0, _("Physical object properties for *:"))); me.TR(me); me.TD(me, 1, 0.5, makeXonoticCommandButton(_("Set material:"), '0 0 0', "sandbox edit_object material $menu_sandbox_edit_material", 0)); - me.TD(me, 1, 1.5, e = makeXonoticTextSlider("menu_sandbox_edit_material")); + + /*me.TD(me, 1, 1.5, e = makeXonoticTextSlider("menu_sandbox_edit_material")); e.addValue(e, _("none"), "0"); e.addValue(e, _("metal"), "1"); e.addValue(e, _("stone"), "2"); e.addValue(e, _("wood"), "3"); e.addValue(e, _("flesh"), "4"); - e.configureXonoticTextSliderValues(e); + e.configureXonoticTextSliderValues(e);*/ + + me.TD(me, 1, 1.5, box = makeXonoticInputBox(1, "menu_sandbox_edit_material")); + box.forbiddenCharacters = "\r\n\\\"$"; // don't care, isn't getting saved + box.maxLength = -127; // negative means encoded length in bytes + box.saveImmediately = 1; + me.TD(me, 1, 0.5, makeXonoticCommandButton(_("Set physics:"), '0 0 0', "sandbox edit_object physics $menu_sandbox_edit_physics", 0)); me.TD(me, 1, 0.5, e = makeXonoticRadioButton(1, "menu_sandbox_edit_physics", "0", _("Static"))); me.TD(me, 1, 0.5, e = makeXonoticRadioButton(1, "menu_sandbox_edit_physics", "1", _("Movable"))); -- 2.39.2