new "Map config operations" menu

Edit and delete mapmodel slots.
This commit is contained in:
ac-stef
2015-05-18 14:59:41 +02:00
parent 618d72cdc4
commit 1d06ed1b64
+77 -4
View File
@@ -10,6 +10,7 @@ menuitem (_ [Test a skymap...]) [ showmenu skymaps ]
menuitem (_ [Ambient sounds...]) [ showmenu [Ambient sounds] ]
menuitem (_ [Arches and slopes...]) [ showmenu Arches ]
menuitem (_ [Map operations...]) [ showmenu [Map operations] ]
menuitem [Map config operations...] [ showmenu [Map config operations] ]
menuitem (_ [Bots...]) [ showmenu [Creating bot waypoints] ]
menuitem (_ [Settings...]) [ showmenu [Editing settings] ]
menuitem (_ Help?) [ echo (yellow) (_ [Please read the AssaultCube README which has a detailed guide on mapediting...]) ]
@@ -144,6 +145,60 @@ menuitem (_ [Paste a previously copied entity]) pasteent
menuitemcheckbox (_ [Show mapmodel clippings: ]) "$showmodelclipping" [ showmodelclipping $arg1 ]
menuitemslider (_ [Select only these entities: ]) 0 15 "$_closestenttypestatus" 1 [All Light Playerstart Pistol Ammobox Grenades Health Armour Akimbo Mapmodel Ladder CTF-flag Sound Clip Helmet PlayerClip] [ _closestentslider $arg1 ]
// Map config operations
newmenu [Map config operations]
menuitem [Edit mapmodel slot...] [ showmenu [Edit mapmodel slots] ]
menuitem [Delete unused mapmodel slot...] [ showmenu [Delete unused mapmodel slot] ]
menuitem "" -1
menuitem [Delete ALL unused mapmodel slots] [loop ii 256 [ push i (- 255 $ii) ; if (&& (strlen (mapmodelslotname $i)) (strcmp "" (mapmodelslotusage $i))) [deletemapmodelslot $i] ; pop i]]
menuitem [Delete ALL unused texture slots] [loop ii 251 [ push i (- 255 $ii) ; if (&& (strlen (edittextureslot $i)) (strcmp "" (textureslotusage $i))) [deletetextureslot $i] ; pop i]]
menuitem [Delete ALL unused mapsound slots] [loop ii 256 [ push i (- 255 $ii) ; if (&& (strlen (editmapsoundslot $i)) (strcmp "" (mapsoundslotusage $i))) [deletemapsoundslot $i] ; pop i]]
menuitem "" -1
menuitem "Update mapmodel menus" "mapmodelchanged 1"
tempalias __lastwatchedmapmodel ""
tempalias __mmslot
// Edit mapmodel slots
newmenu [Edit mapmodel slots]
menuinit __rebuildmapmodelmenus
// Edit mapmodel slot
newmenu [Edit mapmodel slot]
menuinit [
delmenu [Edit mapmodel slot]
newmenu [Edit mapmodel slot]
if (strlen $__mmslot) [
menuheader "" (concatword "edit mapmodel slot #" $__mmslot ":\n" (mapmodelslotname $__mmslot))
menuitemtextinput "Clipping radius" (at (editmapmodelslot $__mmslot) 0) [editmapmodelslot $__mmslot $arg1]
menuitemtextinput "Clipping height " (at (editmapmodelslot $__mmslot) 1) [editmapmodelslot $__mmslot "" $arg1]
menuitemtextinput "z-Offset " (at (editmapmodelslot $__mmslot) 2) [editmapmodelslot $__mmslot "" "" $arg1]
menuitem "" -1
menuitemtextinput "Mapmodel path " (concat result (at (editmapmodelslot $__mmslot) 4)) [editmapmodelslot $__mmslot "" "" "" "" $arg1] "" 250
if (&& (strlen $__lastwatchedmapmodel) (! (strcmp $__lastwatchedmapmodel (editmapmodelslot $__mmslot) 4))) [
menuitem (concat " change to" (escape $__lastwatchedmapmodel)) [editmapmodelslot $__mmslot "" "" "" "" $__lastwatchedmapmodel]
]
if (strlen (mapmodelslotusage $__mmslot)) [
menuitem "" -1 (concat gotoposition (gotoposition))
looplist (mapmodelslotusage $__mmslot) ii [
menuitem (concatword "slot used by map entity #" $ii) (concat gotoentity $ii) (concat gotoentity $ii)
]
menuitem "" -1 (concat gotoposition (gotoposition))
][
menuitem "" -1
menuitem "\f3Delete unused slot" (concat deletemapmodelslot $__mmslot)
]
][
menuitem "no slot selected" -1
]
]
// Delete unused mapmodel slot
newmenu [Delete unused mapmodel slot]
menuinit __rebuildmapmodelmenus
// "closestenttype" slider...
_closestentslider = [ closestenttype (at ["" light playerstart pistol ammobox grenades health armour akimbo mapmodel ladder ctf-flag sound clip helmet plclip] $arg1); _closestenttypestatus = $arg1 ]
@@ -261,7 +316,7 @@ tempalias __mapmodelcategories [
looplist $__mapmodelcategories [key menu] [tempalias (concatword __mm_key_ $key) $menu]
tempalias __mm_unassigned [echo (yellow) sry: mapmodel (addpunct $arg1) has no slot assigned. Please edit your map config file.]
tempalias __mm_showmodel [concat chmenumdl $arg1 $arg2 all 40 3]
tempalias __mm_showmodel [concat alias __lastwatchedmapmodel $arg2 ";" chmenumdl (escape $arg1) (concatword mapmodels/ $arg2) all 40 3]
tempalias __rebuildmapmodelmenus [
if $mapmodelchanged [
@@ -288,12 +343,12 @@ tempalias __rebuildmapmodelmenus [
if (listlen $idxs) [
__mm_done = (concat $__mm_done $idxs)
if (> (listlen $idxs) 1) [
looplist $idxs i [menuitem (concat $desc (concatword "#" $i)) (concat newent mapmodel $i) (__mm_showmodel $$keyword $mpath) $usage] // several slots for the same mapmodel
looplist $idxs i [menuitem (concat $desc (concatword "#" $i)) (concat newent mapmodel $i) (__mm_showmodel $$keyword $path) $usage] // several slots for the same mapmodel
][
menuitem $desc (concat newent mapmodel $idxs) (__mm_showmodel $$keyword $mpath) $usage // usual case: one slot per model
menuitem $desc (concat newent mapmodel $idxs) (__mm_showmodel $$keyword $path) $usage // usual case: one slot per model
]
][
menuitem (concatword "\f4" $desc) (concat newent mapmodel "(mapmodel" $dflts $path ")") (__mm_showmodel $$keyword $mpath) $usage // mapmodel has no slot assigned: assign one
menuitem (concatword "\f4" $desc) (concat newent mapmodel "(mapmodel" $dflts $path ")") (__mm_showmodel $$keyword $path) $usage // mapmodel has no slot assigned: assign one
]
]
delmenu Mapmodels
@@ -301,6 +356,24 @@ tempalias __rebuildmapmodelmenus [
push __mm_sorted ""
looplist $__mapmodelcategories [key menu] [if (>= (findlist $__mm_menus $menu) 0) [concatuniq __mm_sorted $menu]] // create list of non-empty menus in order of list above
looplist $__mm_sorted m [menuitem $m (concat showmenu $m)] // only create non-empty menus
delmenu [Delete unused mapmodel slot]
newmenu [Delete unused mapmodel slot]
loop i 256 [
mpath = (mapmodelslotname $i)
if (strlen $mpath) [
if (strcmp "" (mapmodelslotusage $i)) [
menuitem (concatword "delete slot #" $i ": " (editmapmodelslot $i)) (concat deletemapmodelslot $i) (__mm_showmodel [Delete unused mapmodel slot] $mpath)
]
]
]
delmenu [Edit mapmodel slots]
newmenu [Edit mapmodel slots]
loop i 256 [
mpath = (mapmodelslotname $i)
if (strlen $mpath) [
menuitem (concatword "edit slot #" $i ": " (editmapmodelslot $i)) (concat alias __mmslot $i ";" showmenu (escape "Edit mapmodel slot"))
]
]
mapmodelchanged 0
pop menu __mm_menus __mm_sorted __mm_done __mm_unsorted idxs mpath
]