]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Allow editing the scale of the object
authorMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Tue, 25 Oct 2011 22:02:54 +0000 (01:02 +0300)
committerMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Tue, 25 Oct 2011 22:02:54 +0000 (01:02 +0300)
defaultXonotic.cfg
qcsrc/menu/xonotic/dialog_sandboxtools.c
qcsrc/server/mutators/sandbox.qc

index 424d82d9a1015266da9a78a79bc32a648450178a..8c3db65bd3b89c8a4654b514715d5c46d3e06778 100644 (file)
@@ -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"
index ae1727b4a2b6662b517d195f6d027225688e8c47..5dd21ac4b4c09382e7cdfa218ed9a17097ff512c 100644 (file)
@@ -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")));
index 0c73c463b1c61c540a839adb14e68df8055755c5..76a32f45a8b44eadf6a1aed263001fab46299bb8 100644 (file)
@@ -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))
                                                        {