fix clip entity menu and add entity copy/paste menu
newent7 type attr1 attr2 attr3 attr4 attr5 attr6 attr7
Works like newent, but can set all seven attributes directly.
Does not automatically put the camera yaw angle into mapmodel and flag
entities.
fixed selectionwalk so that the first parameter can be ""
DOCREF newent7
This commit is contained in:
+33
-16
@@ -219,19 +219,34 @@ menuitem "\f2\t\t [ OK ]" [ newent light $__clight $__clight1 $__clight2 $__c
|
||||
//// Main > Editing > Entities ////
|
||||
|
||||
newmenu Entities
|
||||
menuitem "Place RVSF spawn point" [ newent playerstart 1 ]
|
||||
menuitem "Place CLA spawn point" [ newent playerstart 0 ]
|
||||
menuitem "Place FFA spawn point" [ newent playerstart 100 ]
|
||||
menuitemcheckbox "Show all spawn points: " "$showplayerstarts" [ showplayerstarts $arg1 ]
|
||||
menuitem "" -1
|
||||
menuitem "Place RVSF CTF Flag" [ newent ctf-flag 1 ]
|
||||
menuitem "Place CLA CTF Flag" [ newent ctf-flag 0 ]
|
||||
menuitem "" -1
|
||||
menuitem "Place ladder entity" "saycommand /newent ladder " [ echo "Ensure that you have placed the ladder mapmodel first (found in the mapmodels menu)\i\3" ]
|
||||
menuitem "Place clip entity\i\3" [ showmenu Clips ]
|
||||
menuitem "" -1
|
||||
menuitem "Show list of TODO entities\i\3" [ showmenu "TODO entities" ]
|
||||
menuitem "Show list of deleted entities\i\3" [ showmenu "Deleted entities" ]
|
||||
menuinit [
|
||||
resetcurmenu
|
||||
if $editing [
|
||||
menuitem "Place RVSF spawn point" [ newent playerstart 1 ]
|
||||
menuitem "Place CLA spawn point" [ newent playerstart 0 ]
|
||||
menuitem "Place FFA spawn point" [ newent playerstart 100 ]
|
||||
menuitemcheckbox "Show all spawn points: " "$showplayerstarts" [ showplayerstarts $arg1 ]
|
||||
menuitem "" -1
|
||||
menuitem "Place RVSF CTF Flag" [ newent ctf-flag 1 ]
|
||||
menuitem "Place CLA CTF Flag" [ newent ctf-flag 0 ]
|
||||
menuitem "" -1
|
||||
menuitem "Place ladder entity" "saycommand /newent ladder " [] "\f4The ladder entity lets players climb.\nPlease also place a ladder mapmodel.\n(found in the mapmodels menu)\i\3"
|
||||
menuitem "Place clip entity\i\3" [ showmenu Clips ]
|
||||
menuitem "" -1
|
||||
push n (format2 "%1 %5 %6 %7 %8 %9 %010 %011" (editentity (getclosestent)))
|
||||
push d (findlist "mapmodel sound" (at $n 0)); d = (if (! $d) [mapmodelslotname (at $n 2)] [if (= $d 1) [at (editmapsoundslot (at $n 1)) 0]])
|
||||
menuitem "Copy closest entity" (format "newmenu [Paste entity]; menuitem \"paste: %1 %2\" \"newent7 %1\"; echo entity copied: %1 %2" $n $d) [] (format "\f4current closest entity:\n%1\n%2" $n $d)
|
||||
menuitem "Paste entity\i\3" [ showmenu [Paste entity] ]
|
||||
pop n d
|
||||
menuitem "" -1
|
||||
menuitem "Show list of TODO entities\i\3" [ showmenu "TODO entities" ]
|
||||
menuitem "Show list of deleted entities\i\3" [ showmenu "Deleted entities" ]
|
||||
][
|
||||
menuitem "menu only available in edit mode" -1
|
||||
]
|
||||
]
|
||||
tempalias __resetpickedents [ delmenu [Paste entity]; newmenu [Paste entity]; menuitem "\f7[Clear the list of copied entities from this menu]" __resetpickedents ; menuitem "" -1 ]
|
||||
__resetpickedents
|
||||
|
||||
//// Main > Editing > Entities > Clips ////
|
||||
|
||||
@@ -248,13 +263,15 @@ menuinit [
|
||||
menuitemslider "Slope:\t" -4 4 "$_clip06" 1 [ _clip06 = $arg1 ]
|
||||
menuitemslider "Shape:\t" 0 3 "$_clip07" "regular sloped-x sloped-y rotated" [ _clip07 = $arg1 ] 1
|
||||
menuitem "" -1
|
||||
menuitem "\f2\t [ Place clip entity ]" [ newent clip $_clip01 $_clip02 $_clip03 $_clip04 _clip05 $_clip06 $_clip07 ]
|
||||
menuitem "\f2\t [ Place player clip entity]" [ newent plclip $_clip01 $_clip02 $_clip03 $_clip04 _clip05 $_clip06 $_clip07 ]
|
||||
menuitem "\f2\t [ Place clip entity ]" [ newent7 clip $_clip01 $_clip02 $_clip03 $_clip04 _clip05 $_clip06 $_clip07 ]
|
||||
menuitem "\f2\t [ Place player clip entity]" [ newent7 plclip $_clip01 $_clip02 $_clip03 $_clip04 _clip05 $_clip06 $_clip07 ]
|
||||
if $editing [
|
||||
push x (editentity (getclosestent))
|
||||
if (|| (strcmp (at $x 0) clip) (strcmp (at $x 0) plclip)) [
|
||||
push n ""
|
||||
loop i 7 [ n = [@n ; _clip0@(+ $i 1) = @(at $x (+ $i 4)) ] ]
|
||||
menuitem "" -1
|
||||
menuitem (concat "Pick clip size from closest entity:" (at $x 4) (at $x 5) (at $x 6) (at $x 7) (at $x 9) (at $x 10)) [ loop i 7 [ (concatword _clip0 (+ $i 1)) = (at $x (+ $i 4)) ] ; refreshcurmenudelayed ]
|
||||
menuitem (concat "Pick clip size from closest entity:" (at $x 4) (at $x 5) (at $x 6) (at $x 7) (at $x 9) (at $x 10)) [ @(pop n) ; refreshcurmenudelayed ]
|
||||
]
|
||||
pop x
|
||||
]
|
||||
|
||||
@@ -57,6 +57,7 @@ loop k 10 [ const (at [green blue yellow red gray white dbrown dred purple orang
|
||||
|
||||
// switch - Takes an integer argument to determine which block of code to execute.
|
||||
// NOTE: This command can only handle up to 23 "cases" (24 arguments).
|
||||
const MAX_ARGS 24
|
||||
switch = [
|
||||
if (&& (<= $numargs $MAX_ARGS) (checkrange $arg1 0 (- $MAX_ARGS 2))) [
|
||||
execute (getalias (format arg%1 (+ $arg1 2)))
|
||||
|
||||
+14
-3
@@ -134,7 +134,6 @@ const NUM_WEAPONS (listlen (listoptions weapons))
|
||||
const NUM_MODES (listlen $MODES)
|
||||
const MAX_CLIENTS 16
|
||||
const MAX_BOT_MATCH_LENGTH 60
|
||||
const MAX_ARGS 24
|
||||
const ENT_NUM_ATTRS 4
|
||||
const getgunindex [ findlist (listoptions weapons) $arg1 ]
|
||||
|
||||
@@ -315,6 +314,18 @@ const pasteent [
|
||||
]
|
||||
]
|
||||
|
||||
const newent7 [ // like newent, but setting all seven attributes directly
|
||||
if $numargs [
|
||||
loop i 8 [ push [a@i] (if (< $i $numargs) [result $arg@(+ $i 1)])]
|
||||
selectionwalk [] [
|
||||
push n (addentity $a0)
|
||||
if (strlen $n) [ editentity $n (at $sw_cursel 0) (at $sw_cursel 1) "" $a1 $a2 $a3 $a4 $a5 $a6 $a7 ]
|
||||
pop n
|
||||
]
|
||||
loop i 8 [ pop [a@i] ]
|
||||
]
|
||||
]
|
||||
|
||||
// countwalls - Counts cubes of a specific type in all selections
|
||||
const countwalls [
|
||||
push __cnt 0
|
||||
@@ -370,7 +381,7 @@ const selectall [
|
||||
const pushselections [
|
||||
if (listlen (selx)) [
|
||||
push selsets ""
|
||||
selectionwalk [ ] [ selsets = (concat $selsets "; addselection" $sw_cursel) ]
|
||||
selectionwalk [] [ selsets = (concat $selsets "; addselection" $sw_cursel) ]
|
||||
push popselections (concat "resetselections" (pop selsets) "; pop popselections")
|
||||
][
|
||||
echo no selction
|
||||
@@ -383,7 +394,7 @@ const enlargevdeltaselections [
|
||||
if (listlen (selx)) [
|
||||
push selsets ""
|
||||
push i (if $numargs $arg1 1)
|
||||
selectionwalk [ ] [ selsets = (concat $selsets $sw_cursel) ]
|
||||
selectionwalk [] [ selsets = (concat $selsets $sw_cursel) ]
|
||||
resetselections
|
||||
looplist (pop selsets) [x y xs ys] [ addselection $x $y (+ $xs $i) (+ $ys $i) ]
|
||||
pop i
|
||||
|
||||
+46
-49
@@ -1209,63 +1209,60 @@ void selectionwalk(char *action, char *beginsel, char *endsel)
|
||||
{
|
||||
EDITSEL("selectionwalk");
|
||||
bool mp = multiplayer(NULL);
|
||||
if(*action)
|
||||
const char *localvars[] = { "sw_cursel", "sw_abs_x", "sw_abs_y", "sw_rel_x", "sw_rel_y", "sw_type", "sw_floor", "sw_ceil", "sw_wtex", "sw_ftex", "sw_ctex", "sw_utex", "sw_vdelta", "sw_tag", "sw_r", "sw_g", "sw_b", "" };
|
||||
for(int i = 0; *localvars[i]; i++) push(localvars[i], "");
|
||||
int maxsels = sels.length();
|
||||
loopv(sels)
|
||||
{
|
||||
const char *localvars[] = { "sw_cursel", "sw_abs_x", "sw_abs_y", "sw_rel_x", "sw_rel_y", "sw_type", "sw_floor", "sw_ceil", "sw_wtex", "sw_ftex", "sw_ctex", "sw_utex", "sw_vdelta", "sw_tag", "sw_r", "sw_g", "sw_b", "" };
|
||||
for(int i = 0; *localvars[i]; i++) push(localvars[i], "");
|
||||
int maxsels = sels.length();
|
||||
loopv(sels)
|
||||
if(i >= maxsels) break; // don't allow the script to add selections
|
||||
block sel = sels[i]; // (copy, not reference)
|
||||
defformatstring(tmp)("%d %d %d %d", sel.x, sel.y, sel.xs, sel.ys);
|
||||
alias("sw_cursel", tmp);
|
||||
if(*beginsel) execute(beginsel);
|
||||
bool haveundo = false, isro = mp && sel.xs * sel.ys > MAXNETBLOCKSQR, didwarn = false;
|
||||
loop(x, sel.xs) loop(y, sel.ys)
|
||||
{
|
||||
if(i >= maxsels) break; // don't allow the script to add selections
|
||||
block sel = sels[i]; // (copy, not reference)
|
||||
defformatstring(tmp)("%d %d %d %d", sel.x, sel.y, sel.xs, sel.ys);
|
||||
alias("sw_cursel", tmp);
|
||||
if(*beginsel) execute(beginsel);
|
||||
bool haveundo = false, isro = mp && sel.xs * sel.ys > MAXNETBLOCKSQR, didwarn = false;
|
||||
loop(x, sel.xs) loop(y, sel.ys)
|
||||
sqr *s = S(sel.x + x, sel.y + y), so = *s;
|
||||
formatstring(tmp)("%d", sel.x + x); alias("sw_abs_x", tmp);
|
||||
formatstring(tmp)("%d", sel.y + y); alias("sw_abs_y", tmp);
|
||||
formatstring(tmp)("%d", x); alias("sw_rel_x", tmp);
|
||||
formatstring(tmp)("%d", y); alias("sw_rel_y", tmp);
|
||||
#define AATTR(x) formatstring(tmp)("%d", s->x); alias("sw_"#x, tmp)
|
||||
AATTR(type); AATTR(floor); AATTR(ceil); AATTR(wtex); AATTR(ftex); AATTR(ctex); AATTR(utex); AATTR(vdelta); AATTR(tag); AATTR(r); AATTR(g); AATTR(b);
|
||||
#undef AATTR
|
||||
if(*action) execute(action);
|
||||
so.type = getlistindex(getalias("sw_type"), cubetypenames, true, int(SPACE));
|
||||
#define GETA(x) so.x = ATOI(getalias("sw_"#x))
|
||||
GETA(floor); GETA(ceil); GETA(wtex); GETA(ftex); GETA(ctex); GETA(utex); GETA(vdelta); GETA(tag); GETA(r); GETA(g); GETA(b);
|
||||
#undef GETA
|
||||
if(memcmp(s, &so, sizeof(sqr)))
|
||||
{
|
||||
sqr *s = S(sel.x + x, sel.y + y), so = *s;
|
||||
formatstring(tmp)("%d", sel.x + x); alias("sw_abs_x", tmp);
|
||||
formatstring(tmp)("%d", sel.y + y); alias("sw_abs_y", tmp);
|
||||
formatstring(tmp)("%d", x); alias("sw_rel_x", tmp);
|
||||
formatstring(tmp)("%d", y); alias("sw_rel_y", tmp);
|
||||
#define AATTR(x) formatstring(tmp)("%d", s->x); alias("sw_"#x, tmp)
|
||||
AATTR(type); AATTR(floor); AATTR(ceil); AATTR(wtex); AATTR(ftex); AATTR(ctex); AATTR(utex); AATTR(vdelta); AATTR(tag); AATTR(r); AATTR(g); AATTR(b);
|
||||
#undef AATTR
|
||||
execute(action);
|
||||
so.type = getlistindex(getalias("sw_type"), cubetypenames, true, int(SPACE));
|
||||
#define GETA(x) so.x = ATOI(getalias("sw_"#x))
|
||||
GETA(floor); GETA(ceil); GETA(wtex); GETA(ftex); GETA(ctex); GETA(utex); GETA(vdelta); GETA(tag); GETA(r); GETA(g); GETA(b);
|
||||
#undef GETA
|
||||
if(memcmp(s, &so, sizeof(sqr)))
|
||||
if(isro)
|
||||
{
|
||||
if(isro)
|
||||
{
|
||||
if(!didwarn) conoutf("\f3selectionwalk: selected area %dx%d too big for multiplayer editing, changes ignored!", sel.xs, sel.ys);
|
||||
didwarn = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!haveundo) makeundo(sel);
|
||||
haveundo = true;
|
||||
*s = so;
|
||||
}
|
||||
if(!didwarn) conoutf("\f3selectionwalk: selected area %dx%d too big for multiplayer editing, changes ignored!", sel.xs, sel.ys);
|
||||
didwarn = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!haveundo) makeundo(sel);
|
||||
haveundo = true;
|
||||
*s = so;
|
||||
}
|
||||
}
|
||||
if(haveundo)
|
||||
{
|
||||
if(mp)
|
||||
{
|
||||
block *b = blockcopy(sel);
|
||||
netblockpaste(*b, sel.x, sel.y, true);
|
||||
freeblockp(b);
|
||||
}
|
||||
remip(sel);
|
||||
}
|
||||
if(*endsel) execute(endsel);
|
||||
}
|
||||
for(int i = 0; *localvars[i]; i++) pop(localvars[i]);
|
||||
if(haveundo)
|
||||
{
|
||||
if(mp)
|
||||
{
|
||||
block *b = blockcopy(sel);
|
||||
netblockpaste(*b, sel.x, sel.y, true);
|
||||
freeblockp(b);
|
||||
}
|
||||
remip(sel);
|
||||
}
|
||||
if(*endsel) execute(endsel);
|
||||
}
|
||||
for(int i = 0; *localvars[i]; i++) pop(localvars[i]);
|
||||
}
|
||||
COMMAND(selectionwalk, "sss");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user