diff --git a/config/menus_edit.cfg b/config/menus_edit.cfg index 23b289ef..c4f5cd50 100644 --- a/config/menus_edit.cfg +++ b/config/menus_edit.cfg @@ -104,10 +104,12 @@ menuitem "Edit arches..." [ showmenu "Edit arches" ] menuitem "" -1 menuitemslider "Slope axis: " 0 1 "$__slopeaxis" 1 ["West to East (X)" "North to South (Y)"] [ __slopeaxis = $arg1 ] menuitemslider "Slope increment: " 0 5 "$__slopeinc" 1 ["downwards 3" "downwards 2" "downwards 1" "upwards 1" "upwards 2" "upwards 3"] [ __slopeinc = $arg1 ] -menuitem "\t[ Place slope ]" [ __setundoarch ; heightfield 0; push i (at "-3 -2 -1 1 2 3" $__slopeinc) ; slope (if $__slopeaxis 0 $i) (if $__slopeaxis $i 0) ; pop i ; 0] +menuitem "\t[ Place slope ]" [ __setundoarch ; heightfield 0; push i (at "3 2 1 -1 -2 -3" $__slopeinc) ; slope (if $__slopeaxis 0 $i) (if $__slopeaxis $i 0) ; pop i ; 0] menuitem "" -1 menuitem "Clear heightfielding" [ solid 0; slope 0 0 ] menuitem "Undo last placed arch or slope" [ __undoarch ; -1 ] +menuitemcheckbox "Automatically enlarge selections after placing arches and slopes" "$enlargearchslopeselections" [ enlargearchslopeselections $arg1 ] +menuitem "Enlarge selections now" enlargevdeltaselections menuitem "" -1 menuitemslider "Stairs axis: " 0 1 "$__stairaxis" 1 ["West to East (X)" "North to South (Y)"] [ __stairaxis = $arg1 ] menuitemslider "Step width: " 0 5 "$__stairwidth" 1 ["downwards 3" "downwards 2" "downwards 1" "upwards 1" "upwards 2" "upwards 3"] [ __stairwidth = $arg1 ] diff --git a/config/scripts.cfg b/config/scripts.cfg index 358af16a..86870c47 100644 --- a/config/scripts.cfg +++ b/config/scripts.cfg @@ -349,6 +349,32 @@ const selectall [ select 2 2 (- (powf 2 (mapsize)) 4) (- (powf 2 (mapsize)) 4) ] +// push and pop selection sets +const pushselections [ + if (listlen (selx)) [ + push selsets "" + selectionwalk [ ] [ selsets = (concat $selsets "; addselection" $sw_cursel) ] + push popselections (concat "resetselections" (pop selsets) "; pop popselections") + ][ + echo no selction + ] +] +tempalias popselections [ echo no selections stored ] + +// enlarge selections after slope or arch placement to change all vdelta values (when enlargearchslopeselections is 0) +const enlargevdeltaselections [ + if (listlen (selx)) [ + push selsets "" + push i (if $numargs $arg1 1) + selectionwalk [ ] [ selsets = (concat $selsets $sw_cursel) ] + resetselections + looplist (pop selsets) [x y xs ys] [ addselection $x $y (+ $xs $i) (+ $ys $i) ] + pop i + ][ + echo no selction + ] +] + // /expandselection 1 // makes the current selection bigger by 1 cube on all sides const expandselection [ if $numargs [ diff --git a/source/src/editing.cpp b/source/src/editing.cpp index 5cecd829..53d4e361 100644 --- a/source/src/editing.cpp +++ b/source/src/editing.cpp @@ -944,6 +944,8 @@ void setvdelta(int *delta) } COMMANDN(vdelta, setvdelta, "i"); +VARP(enlargearchslopeselections, 0, 0, 1); // "1" is classic behaviour + const int MAXARCHVERT = 50; int archverts[MAXARCHVERT][MAXARCHVERT]; bool archvinit = false; @@ -982,7 +984,8 @@ void arch(int *sidedelta) if(sel.ys>MAXARCHVERT) sel.ys = MAXARCHVERT; int *averts = sel.xs > sel.ys ? &archverts[sel.xs-1][0] : &archverts[sel.ys-1][0]; addmsg(SV_EDITARCH, "ri5v", sel.x, sel.y, sel.xs, sel.ys, *sidedelta, MAXARCHVERT, averts); - archxy(*sidedelta, averts, sel); // (changes xs and ys) + archxy(*sidedelta, averts, sel); + if(!enlargearchslopeselections) { sel.xs--; sel.ys--; } } } COMMAND(arch, "i"); @@ -1006,6 +1009,7 @@ void slope(int *xd, int *yd) block &sel = sels[i]; addmsg(SV_EDITXY, "ri7", EDITXY_SLOPE, sel.x, sel.y, sel.xs, sel.ys, *xd, *yd); slopexy(*xd, *yd, sel); // (changes xs and ys) + if(!enlargearchslopeselections) { sel.xs--; sel.ys--; } } } COMMAND(slope, "ii"); @@ -1044,6 +1048,7 @@ void perlin(int *scale, int *seed, int *psize) sel.xs++; sel.ys++; remipmore(sel); + if(!enlargearchslopeselections) { sel.xs--; sel.ys--; } } } COMMAND(perlin, "iii");