From 8ec59fbba49f21be61a4be0a87411aa20f2ec8ee Mon Sep 17 00:00:00 2001 From: Mircea Kitsune Date: Wed, 26 Oct 2011 01:02:54 +0300 Subject: [PATCH] Allow editing the scale of the object --- defaultXonotic.cfg | 1 + qcsrc/menu/xonotic/dialog_sandboxtools.c | 4 ++-- qcsrc/server/mutators/sandbox.qc | 17 ++++++++++++++--- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/defaultXonotic.cfg b/defaultXonotic.cfg index 424d82d9a..8c3db65bd 100644 --- a/defaultXonotic.cfg +++ b/defaultXonotic.cfg @@ -549,6 +549,7 @@ set g_sandbox_editor_distance_edit 350 "distance at which players can edit or re seta menu_sandbox_spawn_model "" // used to store the model in the input field set menu_sandbox_edit_skin 0 set menu_sandbox_edit_frame 0 +set menu_sandbox_edit_scale 1 set menu_sandbox_edit_physics 0 alias menu_showsandboxtools "menu_cmd directmenu SandboxTools" diff --git a/qcsrc/menu/xonotic/dialog_sandboxtools.c b/qcsrc/menu/xonotic/dialog_sandboxtools.c index ae1727b4a..5dd21ac4b 100644 --- a/qcsrc/menu/xonotic/dialog_sandboxtools.c +++ b/qcsrc/menu/xonotic/dialog_sandboxtools.c @@ -21,7 +21,6 @@ void XonoticSandboxToolsDialog_fill(entity me) box.forbiddenCharacters = "\r\n\\\"$"; // don't care, isn't getting saved box.maxLength = -127; // negative means encoded length in bytes box.saveImmediately = 1; - me.TDempty(me, 0.1); me.TD(me, 1, 0.5, makeXonoticCommandButton(_("Spawn"), '0 0 0', "sandbox spawn_object $menu_sandbox_spawn_model", 0)); me.TD(me, 1, 0.5, makeXonoticCommandButton(_("Remove"), '0 0 0', "sandbox remove_object", 0)); me.TDempty(me, 0.1); @@ -34,8 +33,9 @@ void XonoticSandboxToolsDialog_fill(entity me) me.TD(me, 1, 0.5, makeXonoticCommandButton(_("Set frame:"), '0 0 0', "sandbox edit_object frame $menu_sandbox_edit_frame", 0)); me.TD(me, 1, 1.5, e = makeXonoticSlider(0, 99, 1, "menu_sandbox_edit_frame")); me.TR(me); + me.TD(me, 1, 0.5, makeXonoticCommandButton(_("Set scale:"), '0 0 0', "sandbox edit_object scale $menu_sandbox_edit_scale", 0)); + me.TD(me, 1, 1.5, e = makeXonoticSlider(0.5, 2, 0.05, "menu_sandbox_edit_scale")); me.TD(me, 1, 0.5, makeXonoticCommandButton(_("Set physics:"), '0 0 0', "sandbox edit_object physics $menu_sandbox_edit_physics", 0)); - me.TDempty(me, 0.1); 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"))); me.TD(me, 1, 0.5, e = makeXonoticRadioButton(1, "menu_sandbox_edit_physics", "2", _("Physical"))); diff --git a/qcsrc/server/mutators/sandbox.qc b/qcsrc/server/mutators/sandbox.qc index 0c73c463b..76a32f45a 100644 --- a/qcsrc/server/mutators/sandbox.qc +++ b/qcsrc/server/mutators/sandbox.qc @@ -63,6 +63,7 @@ MUTATOR_HOOKFUNCTION(sandbox_PlayerCommand) print_to(self, "^7Object properties for ^2edit_object^7:"); print_to(self, "^3skin ^7- changes the skin of the object"); print_to(self, "^3frame ^7- object animation frame, for self-animated models"); + print_to(self, "^3scale ^7- changes object scale. 0.5 is half size and 2 is double size"); print_to(self, "^3physics ^7- object physics, 0 = static, 1 = movable, 2 = physical"); print_to(self, "^7The ^1drag object ^7key can be used to grab and carry objects. Players can only grab their own objects"); return TRUE; @@ -141,11 +142,17 @@ MUTATOR_HOOKFUNCTION(sandbox_PlayerCommand) e = sandbox_EditObject(); // you can only copy objects you can edit, so this works if(e != world) { - // set clipboard properties if(self.object_clipboard) strunzone(self.object_clipboard); - self.object_clipboard = strzone(strcat(e.model, " ", ftos(e.skin), " ", ftos(e.frame), " ", ftos(e.movetype))); + // set clipboard properties + self.object_clipboard = strcat(e.model, " "); + self.object_clipboard = strcat(self.object_clipboard, ftos(e.skin), " "); + self.object_clipboard = strcat(self.object_clipboard, ftos(e.frame), " "); + self.object_clipboard = strcat(self.object_clipboard, ftos(e.scale), " "); + self.object_clipboard = strcat(self.object_clipboard, ftos(e.movetype), " "); + + self.object_clipboard = strzone(self.object_clipboard); print_to(self, "Object copied to clipboard"); return TRUE; } @@ -170,7 +177,8 @@ MUTATOR_HOOKFUNCTION(sandbox_PlayerCommand) setmodel(e, argv(0)); e.skin = stof(argv(1)); e.frame = stof(argv(2)); - e.movetype = stof(argv(3)); + e.scale = stof(argv(3)); + e.movetype = stof(argv(4)); print_to(self, "Object pasted"); if(autocvar_g_sandbox_info) @@ -197,6 +205,9 @@ MUTATOR_HOOKFUNCTION(sandbox_PlayerCommand) case "frame": e.frame = stof(argv(3)); break; + case "scale": + e.scale = stof(argv(3)); + break; case "physics": switch(argv(3)) { -- 2.39.2