Files
assaultcube-/config/menus_edit.cfg
T
ac-stef c5065cddaa add batch map conversion tools and more editing scripts
convmap is a toolset to convert hundreds of maps mostly automatically
to map format 10. Old media paths from akimbo and from before AC 1.2 are
automatically converted to AC 1.2 and akimbo2 paths.

The additional editing scripts mostly help with further optimisation of
existing maps (mainly to reduce the number of clipped entities).

If convmap is loaded after mapeditscripts, one additional conversion
stage is unlocked.
2016-11-07 16:57:18 +01:00

1192 lines
54 KiB
INI

persistidents 0
newmenu editing
menuitem "Mapmodels..." [ showmenu Mapmodels ]
menuitem "Lighting..." [ showmenu Lighting ]
menuitem "Entities..." [ showmenu Entities ]
menuitem "Pickups..." [ showmenu Pickups ]
menuitem "Textures..." [ showmenu textures ]
menuitem "Skymaps..." [ showmenu skymaps ]
menuitem "Ambient sounds..." [ showmenu [Ambient sounds] ]
menuitem "Arches, slopes and stairs..." [ showmenu Arches ]
menuitem "Map operations..." [ showmenu [Map operations] ]
menuitem "Map settings..." [ showmenu [Map settings] ]
menuitem "Map config operations..." [ showmenu [Map config operations] ]
menuitem "Map checks and statistics..." [ showmenu [Map checks and statistics] ]
menuitem "Bots..." [ showmenu [Creating bot waypoints] ]
menuitem "Settings..." [ showmenu [Editing settings] ]
menuitem "Keys..." [ showmenu [Editing keys] ]
menuitem "Deleted entities" [ showmenu "deleted entities" ]
menuitem "Help?" [ echo "\f2Please read the AssaultCube README which has a detailed guide on mapediting..." ]
tempalias tmp_cradius 12
//Lighting menu.
newmenu Lighting
menuitem "Add white lights " [ showmenu [White light] ]
menuitem "Add coloured lights " [ showmenu [Coloured light] ]
menuitem "" -1
menuitemcheckbox "Enable fullbright: " "$fullbright" [ fullbright $arg1 ]
menuitem "" -1
menuitem "Random coloured light: " -1
menuitemtextinput "Radius: " [ result $tmp_cradius ] [ if (&& (! (> $arg1 32)) (! (< $arg1 1))) [ tmp_cradius = $arg1 ] [ echo "\f3Error: \f2" $arg1 "\f5is not a valid radius for a light entity." ] ]
menuitem "Place random light..." [ gencl $tmp_cradius ]
menuitem "Update random light..." gencl
wlight = 1; wlight1 = 1
newmenu [White light]
menuitemslider "Light radius: " 1 32 "$wlight" 1 [] [ wlight = $arg1 ]
menuitemslider "Brightness: " 1 255 "$wlight1" 5 [] [ wlight1 = $arg1 ]
menuitem "" -1
menuitem "\f2\t [ OK ]\t\t" [ newent light $wlight $wlight1 ]
clight = 1; clight1 = 1; clight2 = 1; clight3 = 1
newmenu [Coloured light]
menuitemslider "Light radius: " 1 32 "$clight" 1 [] [ clight = $arg1 ]
menuitem "" -1
menuitemslider "Red light: " 1 255 "$clight1" 5 [] [ clight1 = $arg1 ]
menuitemslider "Green light: " 1 255 "$clight2" 5 [] [ clight2 = $arg1 ]
menuitemslider "Blue light: " 1 255 "$clight3" 5 [] [ clight3 = $arg1 ]
menuitem "" -1
menuitem "\f2\t\t [ OK ]" [ newent light $clight $clight1 $clight2 $clight3 ]
//Entities menu
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)..." ]
menuitem "Place clip entity..." [ showmenu Clips ] [ echo Clips can be used to block off areas that players shouldn't be able to access... ]
menuitem "" -1
menuitem "Show list of TODO entities" [ showmenu "TODO entities" ]
menuitem "Show list of deleted entities" [ showmenu "deleted entities" ]
tempalias _clip00 clip; tempalias _clip00status 0; tempalias _clip01 0; tempalias _clip02 1; tempalias _clip03 1; tempalias _clip04 1 // Give aliases an initial value.
newmenu Clips
menuitemslider "Clip type: " 0 1 "$_clip00status" 1 [ Clip "Player Clip" ] [ _clip00 = (at [clip plclip] $arg1); _clip00status = $arg1 ]
menuitemslider "Elevation from ground: " 0 50 "$_clip01" 1 [] [ _clip01 = $arg1 ]
menuitemslider "Length of clip\t(X): " 0 50 "$_clip02" 1 [] [ _clip02 = $arg1 ]
menuitemslider "Width of clip\t(Y): " 0 50 "$_clip03" 1 [] [ _clip03 = $arg1 ]
menuitemslider "Height of clip\t(Z): " 0 50 "$_clip04" 1 [] [ _clip04 = $arg1 ]
menuitem "" -1
menuitem "\f2\t\t [ OK ]" [ newent $_clip00 $_clip01 $_clip02 $_clip03 $_clip04 ]
//Pickups menu
newmenu Pickups
menuitem "Health" [ newent health ]
menuitem "Pistol Magazine" [ newent pistol ]
menuitem "Box of Ammo" [ newent ammobox ]
menuitem "Kevlar Vest" [ newent armour ]
menuitem "Helmet" [ newent helmet ]
menuitem "Akimbo" [ newent akimbo ]
menuitem "Grenades" [ newent grenades ]
//Arch and slope menu
looplist [__slopeaxis 0 __slopeinc 4 __stairaxis 0 __stairwidth 1 __undoarch "" __archside 1] [n v] [tempalias $n $v]
tempalias __setundoarch [ __undoarch = (concat select (at (selx) 0) (at (sely) 0) (at (selxs) 0) (at (selys) 0) "; if (= (undolevel)" (+ (undolevel) 2) ") [ undolevel" (undolevel) "]") ]
newmenu Arches
menuinit [ chmenutexture (curmenu) map_editor/axes.png " " ]
menuitemslider "Arch sideways curve delta: " 0 5 "$__archside" 1 [] [ __archside = $arg1 ]
menuitem "\t[ Place arch ]" [ __setundoarch ; heightfield 2; arch $__archside ]
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 "" -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 ]
menuitem "\t[ Place stairs ]" [ push i (at "-3 -2 -1 1 2 3" $__stairwidth) ; stairs (if $__stairaxis 0 $i) (if $__stairaxis $i 0) ; pop i ; 0]
tempalias __pickarch 2
tempalias __listarch [ push ii "" ; loop i $arg1 [ if $i [ ii = (concat $ii (archvertex $arg1 $i)) ] ] ; result (pop ii) ]
newmenu "Edit arches"
menuinit [
resetcurmenu
loop i 50 [
if (> $i 1) [
menuitem (concatword "arch width " $i ": " (__listarch $i)) (concat __pickarch = $i "; showmenu [Edit arch]")
]
]
]
newmenu "Edit arch"
menuinit [
resetcurmenu
menuheader "" (concat "edit arch width" $__pickarch "(symmetrical)")
push ii ""
loop i (div $__pickarch 2) [
ii = (+ $i 1)
menuitemslider (concat vertex $ii "\t") 0 31 (archvertex $__pickarch $ii) 1 [] (concat archvertex $__pickarch $ii "$arg1 ; archvertex" $__pickarch (- $__pickarch $ii) "$arg1")
]
pop ii
menuitem "" -1
menuitem (concat Measure selection for width $__pickarch arch) (concat av (- $__pickarch 1) "(av_measure)")
menuitem "Edit full arch (non-symmetrical)..." [ showmenu "Edit full arch" ]
menuitem "Restore arch of different size (ymmv)..." [ showmenu "Pick custom arch" ]
menuitem "Delete saved custom arch..." [ showmenu "Delete custom arch" ]
menuitem "" -1
tempalias __archname custom
looplist (enumalias (concatword _arch_ $__pickarch _)) [fn sn] [
if (= (+ (listlen $$fn) 1) $__pickarch) [
__archname = $sn
menuitem (concat Restore $sn " " $$fn) (concat av (- $__pickarch 1) (escape $$fn))
]
]
menuitemtextinput "Save arch as " "result $__archname" (concat __archname "= $arg1 ; (concatword _arch_"$__pickarch "_ $arg1) = (__listarch" $__pickarch ")" ) "" 250
]
newmenu "Edit full arch"
menuinit [
resetcurmenu
menuheader "" (concat "edit arch width" $__pickarch "(non-symmetrical)")
loop i $__pickarch [
if $i [ menuitemslider (concat vertex $i "\t") 0 31 (archvertex $__pickarch $i) 1 [] (concat archvertex $__pickarch $i "$arg1") ]
]
]
newmenu "Pick custom arch"
menuinit [
resetcurmenu
menuheader "" (concat "pick custom arch for width" $__pickarch)
looplist (enumalias _arch_) [fn sn] [ menuitem (concat Use "\fs\f2" $sn $$fn "\fr " as width $__pickarch arch) (concat av (- $__pickarch 1) (escape $$fn)) ]
]
newmenu "Delete custom arch"
menuinit [
resetcurmenu
looplist (enumalias _arch_) [fn sn] [ menuitem (concat Delete custom arch "\fs\f2" $sn "\fr" $$fn) (concat delalias (escape $fn)) ]
]
newmenu skymaps
menuinit [
resetcurmenu
if (&& $editing (! (getautomapconfig))) [
menuitem [Enable automapconfig to make changes permanent] [automapconfig ; closemenu (curmenu)] (concat loadsky (escape $loadsky))
menuitem "" -1 (concat loadsky (escape $loadsky))
]
menuitem (concat "Current skymap:" $loadsky) (concat loadsky (escape $loadsky))
menuitem "" -1 (concat loadsky (escape $loadsky))
push offskies ""
push userskies ""
push skyname ""
looplist (gettexturelist skymaps/ "" _ft.jpg) [c1 c2 c3 c4] [
skyname = (escape (concatword $c3 "/" $c4))
if (strcmp official (gettextureorigin (concatword $c1 "/" $c2))) [
offskies = (concat $offskies $skyname)
] [
userskies = (concat $userskies $skyname)
]
]
menuitem "Official skymaps:" -1 (concat loadsky (escape $loadsky))
looplist $offskies skyname [
menuitem (concat " " $skyname) (concat loadsky $skyname) (concat loadsky $skyname)
]
if (strlen $userskies) [
menuitem "" -1 (concat loadsky (escape $loadsky))
menuitem "Custom/downloaded skymaps:" -1 (concat loadsky (escape $loadsky))
looplist $userskies skyname [
menuitem (concat " " $skyname) (concat loadsky (escape $skyname)) (concat loadsky (escape $skyname))
]
]
pop offskies userskies skyname
]
_closestenttypestatus = 0
//Map operations
newmenu [Map operations]
menuitem "Newmap (128x128 cubes - recommended)" [ newmap 7 ]
menuitem "Newmap (256x256 cubes)" [ newmap 8 ]
menuitem "Increase mapsize (2x)" [ mapenlarge; echo The map size has been increased by 2. However, the new space is solid. To utilize it, you will need to turn it into non-solid space, by selecting it and pressing G. ]
menuitem "Print entity stats" entstats
menuitem "Select the next closest entity" nextclosestent
menuitem "Copy the current closest entity" copyent
menuitem "Paste a previously copied entity" pasteent
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 ]
tempalias __enableautomapconfig [ if (&& $editing (! (getautomapconfig))) automapconfig ]
newmenu [Map settings]
menuinit [
resetcurmenu
if $editing [
menuheader "" (concat " Settings for map" (curmap))
menuitemtextinput (concatword "Water level (" (getvarrange min waterlevel) ".." (getvarrange max waterlevel) ", default " (getvarrange default waterlevel) "):\t") $waterlevel [waterlevel $arg1]
looplisti "red 20 green 25 blue 20 alpha 178" [n v] [
menuitemtextinput (concatword "Water colour (" $n ", default " $v "):\t") (at (getwatercolour) $i) (concat setwatercolour $n "$arg1")
]
menuitem "Water colour sliders..." [ showmenu [Water colour] ]
menuitem "" -1
menuitemtextinput (concatword "Shadow yaw (0..360, default " (getvarrange default shadowyaw) "):\t") $shadowyaw [__enableautomapconfig ; shadowyaw $arg1]
menuitem "" -1
menuitemtextinput (concatword "Fog distance (" (getvarrange min fog) ".." (getvarrange max fog) ", default " (getvarrange default fog) "):\t") $fog [__enableautomapconfig ; fog $arg1]
menuitemtextinput (concatword "Fog colour (0xrrggbb, default 0x" (h0 6 (getvarrange default fogcolour)) "):\t") (concatword "0x" (h0 6 $fogcolour)) [__enableautomapconfig ; fogcolour $arg1]
menuitem "Fog colour sliders..." [ showmenu [Fog colour] ]
menuitem "" -1
menuitemtextinput (concatword "Ambient light (0..255 or 0xrrggbb, default 0):\t") (if (< $ambient 256) $ambient (concatword "0x" (h0 6 $ambient))) [ambient $arg1]
menuitem "" -1
menuitemcheckbox "Map override: Disable water reflection" "$mapoverride_nowaterreflect" [ mapoverride_nowaterreflect $arg1 ]
menuitemcheckbox "Map override: Limit water waveheight" "$mapoverride_limitwaveheight" [ mapoverride_limitwaveheight $arg1 ]
menuitemcheckbox "Map override: Disable stencil shadows" "$mapoverride_nostencilshadows" [ mapoverride_nostencilshadows $arg1 ]
menuitem "" -1
push n (getnotexture)
if (! (strlen $n)) [n = <default>]
menuitem (concatword "Notexture:\t\t\t\t" (pop n)) [showmenu "Set notexture"]
menuitem (concatword "Skymap:\t\t\t\t\t" $loadsky) [showmenu skymaps]
menuitem "" -1
if (strlen $mapmsg) [
menuitem (concat "Map message:" $mapmsg) editmapmsg
] [
menuitem "Edit map message..." editmapmsg
]
if (strlen $mapinfo_license) [
menuitem (concatword "Map license tag: \"" $mapinfo_license "\"") [ showmenu "Select map license" ]
if (strlen $mapinfo_comment) [
menuitem (concat "Map license comment:" $mapinfo_comment) [ editsvar mapinfo_comment ]
] [
menuitem "Edit map license comment..." [ editsvar mapinfo_comment ]
]
] [
menuitem "Select map license..." [ showmenu "Select map license" ]
]
] [
menuitem "menu only available in edit mode" -1
]
menuitem "" -1
menuitem "Show map info..." [ showmenu "Show map info" ]
]
newmenu [Water colour]
looplisti [red green blue alpha] n [
menuitemslider (concatword "Water colour (" $n "): ") 0 255 (concat "(at (getwatercolour)" $i ")") 5 [] (concat setwatercolour $i "$arg1")
]
newmenu [Fog colour]
looplist [red 0xff0000 0x10000 green 0xff00 0x100 blue 0xff 1] [n m f] [
menuitemslider (concatword "Fog colour (" $n "): ") 0 255 (concat "(div (&b $fogcolour " $m ")" $f ")") 5 [] (concat "__enableautomapconfig ; fogcolour (|b (&b $fogcolour" (^b 0xffffff $m) ") (* $arg1" $f "))")
]
tempalias __showorigin 0
tempalias __colororigin [ result (concatword " \fs\f" (if (strcmp $arg1 official) 4 2) "<" $arg1 ">\fr") ]
// 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 "Edit texture slot..." [ showmenu [Edit texture slots] ]
menuitem "" -1
menuitem "Edit mapsound slot..." [ showmenu [Edit mapsound slots] ]
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 "Sort mapmodel slots..." [ showmenu [Sort mapmodel slots] ]
menuitem "Sort texture slots..." [ showmenu [Sort texture slots] ]
menuitem "Sort mapsound slots..." [ showmenu [Sort mapsound slots] ]
menuitem "" -1
menuitem "Update mapmodel menus" "mapmodelchanged 1"
menuitemcheckbox "Show media file origin/distribution" "$__showorigin" [ __showorigin = $arg1 ; mapmodelchanged 1 ]
// Map checks
newmenu [Map checks and statistics]
menuinit [
resetcurmenu
if $editing [
menuitem "Map area checks..." [ showmenu [Map area checks] ]
menuitem "Entity statistics" [ showmenu [Entity statistics] ]
menuitem "Check mapmodels with unconfigured custom textures" [ showmenu [Walk mapmodel entities with unconfigured custom textures] ]
menuitem "Show most visible textures" [ showmenu [Most visible textures] ]
menuitem "Cycle through spawn points" [ gotonextplayerstart ]
] [
menuitem "menu only available in edit mode" -1
]
]
tempalias __lastwatchedmapmodel ""
tempalias __mmslot ""
// Edit mapmodel slots
newmenu [Edit mapmodel slots]
menuinit __rebuildmapmodelmenus
// Edit mapmodel slot
newmenu [Edit mapmodel slot]
menuinit [
resetcurmenu
if (strlen $__mmslot) [
push info (editmapmodelslot $__mmslot)
menuheader "" (concatword "edit mapmodel slot #" $__mmslot ":\n" (mapmodelslotname $__mmslot))
if (strlen $info) [
menuitemtextinput "Clipping radius" (at $info 0) [editmapmodelslot $__mmslot $arg1]
menuitemtextinput "Clipping height " (at $info 1) [editmapmodelslot $__mmslot "" $arg1]
menuitemtextinput "z-Offset " (at $info 2) [editmapmodelslot $__mmslot "" "" $arg1]
menuitemtextinput "Scale [0.25 - 4.0] " (at $info 3) [editmapmodelslot $__mmslot "" "" "" $arg1]
push __distribution (getmapmodelattributes (mapmodelslotname $__mmslot) distribution)
if (! (strlen $__distribution)) [ __distribution = "custom/unsorted" ]
menuitem (concat "Distribution:" (pop __distribution)) -1
looplist [defaults "Defaults:" usage "Usage:" license "License:" version "Version:" requires "Requires:"] [attr hd] [ // also possible: desc "Desc:" author "Author:"
attr = (getmapmodelattributes (mapmodelslotname $__mmslot) $attr)
if (strlen $attr) [
menuitem (concat $hd $attr) -1
]
]
menuitem "" -1
menuitemtextinput "Mapmodel path " (concat result (at $info 4)) [editmapmodelslot $__mmslot "" "" "" "" $arg1] "" 250
if (&& (strlen $__lastwatchedmapmodel) (! (strcmp $__lastwatchedmapmodel (at $info 4)))) [
menuitem (concat " change to" (escape $__lastwatchedmapmodel)) [editmapmodelslot $__mmslot "" "" "" "" $__lastwatchedmapmodel]
]
menuitem "" -1
menuitem "Duplicate slot" (concat mapmodel $info)
] [
menuitem "\f3Unassigned slot" -1
]
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)
]
if (strcmp " " (mapmodelslotusage $__mmslot)) [
menuitem "(this model is required by another model)" -1
]
menuitem "" -1 (concat gotoposition (gotoposition))
][
menuitem "" -1
menuitem "\f3Delete unused slot" (concat deletemapmodelslot $__mmslot)
]
pop info
][
menuitem "no slot selected" -1
]
]
// Delete unused mapmodel slot
newmenu [Delete unused mapmodel slot]
menuinit __rebuildmapmodelmenus
tempalias __lastwatchedtexture ""
tempalias __texslot ""
// Edit texture slots
newmenu [Edit texture slots]
menuinit [
resetcurmenu
menurenderoffset -20 0
if $editing [
push ecurmenu (escape (curmenu))
push info ""
push origin ""
looplisti (textureslotusagelist) [cnt used] [
info = (edittextureslot $i)
if $__showorigin [ origin = (__colororigin (gettextureorigin (at $info 1))) ]
if (|| $cnt (strlen $info)) [
if (! (strlen $info)) [ info = " \fs\f3<unassigned>\fr" ]
menuitem (concatword "edit texture slot #" $i ": " $info " (" $cnt " uses, " $used " visible)" $origin) (concat __texslot = $i "; showmenu [Edit texture slot]") (concat chmenutexture $ecurmenu (at $info 1))
]
]
pop info ecurmenu origin
] [
menuitem "menu only available in edit mode" -1
]
]
tempalias __defaultskymapdummy kurt/klite1.jpg
// Edit texture slot
newmenu [Edit texture slot]
menuinit [
resetcurmenu
if (strlen $__texslot) [
push info (edittextureslot $__texslot) // "<scale> <path>"
chmenutexture (curmenu) (at $info 1)
menurenderoffset -20 0
menuheader "" (concatword "edit texture slot #" $__texslot ":\n" (at $info 1))
menuitemtextinput "Scaling factor [0..4] " (at $info 0) [edittextureslot $__texslot $arg1]
menuitem "\f4factor 0 means default (1.0)" -1
menuitem "" -1
menuitem (concat "Distribution:" (gettextureorigin (at $info 1))) -1
menuitem "" -1
menuitemtextinput "Texture path " (concat result (at $info 1)) [edittextureslot $__texslot "" $arg1] "" 250
if (&& (strlen $__lastwatchedtexture) (! (strcmp $__lastwatchedtexture (at $info 1)))) [
menuitem (concat " change to" (escape $__lastwatchedtexture)) [edittextureslot $__texslot "" $__lastwatchedtexture]
]
if (&& (! $__texslot) (! (strcmp $__defaultskymapdummy (at $info 1)))) [
menuitem (concat " change to skymap default" (escape $__defaultskymapdummy)) [edittextureslot $__texslot 0 $__defaultskymapdummy]
]
menuitem "" -1
menuitem "use as next (upper-)wall texture" [edittexturestack wall $__texslot]
menuitem "use as next floor texture" [edittexturestack floor $__texslot]
menuitem "use as next ceiling texture" [edittexturestack ceiling $__texslot]
push __usage (textureslotusage $__texslot)
if (&& $__texslot (listlen $__usage)) [
menuitem "" -1 (concat gotoposition (gotoposition))
looplist $__usage ii [
menuitem (concatword "slot used by map entity #" $ii) (concat gotoentity $ii) (concat gotoentity $ii)
]
menuitem "" -1 (concat gotoposition (gotoposition))
]
if (strlen (pop __usage)) [
if (> (listlen (textureslotbyname (at $info 1))) 1) [
menuitem "" -1
menuitem "Merge multiple slots using same texture" [showmenu "Texture slot merge"]
]
pop slots
] [
menuitem "" -1
menuitem "\f3Delete unused slot" (concat deletetextureslot $__texslot)
]
if (! (strcmp $__lastwatchedtexture (at $info 1))) [
menuitem "" -1
menuitem (concat "Pick texture name" (at $info 1)) (concat __lastwatchedtexture = (escape (at $info 1)))
]
if (! $__texslot) [
menuitem "" -1
menuitem (concat "Slot #0 is hardcoded as skymap, please use" $__defaultskymapdummy) -1
] [
if (< $__texslot 5) [
menuitem "" -1
menuitem (concatword "Slot #" $__texslot " is the default " (at ["" "cube 1 water" "wall" "floor" "ceiling"] $__texslot) " texture") -1
]
]
pop info
][
menuitem "no slot selected" -1
]
]
tempalias __tex_joined ""
tempalias __tex_togo ""
newmenu "Texture slot merge"
menuinit [
resetcurmenu
if (strlen $__texslot) [
push info (edittextureslot $__texslot) // "<scale> <path>"
chmenutexture (curmenu) (at $info 1)
menurenderoffset -20 0
menuheader "" (concatword "merge texture slots using\n" (at $info 1))
menuitem (concat "Slots using texture" (at $info 1)) -1
push slots (textureslotbyname (at $info 1))
push usemap (textureslotusagelist)
menuitem "" -1
push last (- (listlen $slots) 1)
__tex_togo = (at $slots 0)
__tex_joined = (at $slots $last)
looplist $slots ii [
menuitem (concatword " #" $ii ": " (edittextureslot $ii) " (" (at $usemap (* $ii 2)) " uses, " (at $usemap (+ (* $ii 2) 1)) " visible)") (concat alias __texslot $ii "; showmenu [Edit texture slot]")
]
menuitem "" -1
menuitem "Merge" -1
menuitemslider " slot #" 0 $last 0 1 $slots (concat "__tex_togo = (at" (escape $slots) "$arg1)")
menuitem "into" -1
menuitemslider " slot #" 0 $last $last 1 $slots (concat "__tex_joined = (at" (escape $slots) "$arg1)")
menuitem " \f0[OK]" [if (!= $__tex_joined $__tex_togo) [deletetextureslot $__tex_togo purge $__tex_joined]]
pop info slots usemap last
][
menuitem "no slot selected" -1
]
]
// Texture browsing menus
newmenu textures
menuitem "Browse official textures" [ showmenu "Official textures" ]
menuitem "Browse custom/downloaded textures" [ showmenu "Custom textures" ]
menuitem "Edit texture slots of current map" [ showmenu "Edit texture slots" ]
menuitem "Set notexture" [ showmenu "Set notexture" ]
newmenu "Official textures"
menuinit __rebuildtexturemenus
newmenu "Custom textures"
menuinit __rebuildtexturemenus
newmenu "Pick texture"
menuinit [
resetcurmenu
if (strlen $__lastwatchedtexture) [
chmenutexture (curmenu) $__lastwatchedtexture
push usedslots (textureslotbyname $__lastwatchedtexture)
menuitem (concat "Texture:" $__lastwatchedtexture) -1
menuitem (concat "Distribution:" (gettextureorigin $__lastwatchedtexture)) -1
menuitem "" -1
if (strlen $usedslots) [
menuitem "Texture is already used in:" -1
looplist $usedslots i [
menuitem (concatword " slot #" $i " (scale " (at (edittextureslot $i) 0) ")") (concat "__texslot =" $i "; showmenu [Edit texture slot]")
]
menuitem "" -1
usedslots = "once more"
]
if (! (strlen (edittextureslot 255))) [
menuitem (concat "Add to map config" $usedslots) (concat texture 0 $__lastwatchedtexture)
menuitem "Add to map config and use as next wall texture" (concat "edittexturestack wall (texture 0" $__lastwatchedtexture ")")
menuitem "Add to map config and use as next floor texture" (concat "edittexturestack floor (texture 0" $__lastwatchedtexture ")")
menuitem "Add to map config and use as next ceiling texture" (concat "edittexturestack ceiling (texture 0" $__lastwatchedtexture ")")
] [
menuitem "\f4(no free texture slots available)" -1
]
pop usedslots
][
menuitem "no texture selected" -1
]
]
newmenu "Set notexture"
menuinit [
resetcurmenu
menurenderoffset -20 0
push m (escape (curmenu))
push t (concat chmenutexture $m "[]")
if (strlen (getnotexture)) [
menuitem (concat Current notexture: (getnotexture)) (concat loadnotexture (getnotexture)) (concat chmenutexture $m (getnotexture))
]
menuitem "Reset notexture" loadnotexture $t // no preview possible
menuitem "" -1 $t
menuitem "\f1Pick a notexture to highlight the areas" -1 $t
looplist (gettexturelist "map_editor/marker" "" ".png") [tpath tname td] [
fullname = (concatword $tpath "/" $tname)
menuitem (concat Set notexture to $tname) (concat loadnotexture (escape $fullname)) (concat chmenutexture $m (escape $fullname))
]
menuitem "" -1 $t
menuitem "\f1Pick a notexture for actual use" -1 $t
menuitem "\f4(as default texture, if custom texture downloads fail)" -1 $t
looplist (concat makke/rock.jpg makke/concrete.jpg (at (edittextureslot 2) 1) (at (edittextureslot 3) 1) (at (edittextureslot 4) 1) $__lastwatchedtexture) fn [
menuitem (concat Set notexture to $fn) (concat loadnotexture (escape $fn)) (concat chmenutexture $m (escape $fn))
]
pop m t
]
// Browse mapsounds
newmenu [Ambient sounds]
menuitem "Browse official mapsounds" [ showmenu "Official mapsounds" ]
menuitem "Browse custom/downloaded mapsounds" [ showmenu "Custom mapsounds" ]
menuitem "Edit mapsound slots of current map" [ showmenu "Edit mapsound slots" ]
newmenu "Official mapsounds"
menuinit __rebuildmapsoundmenus
newmenu "Custom mapsounds"
menuinit __rebuildmapsoundmenus
tempalias __lastwatchedmapsound ""
tempalias __sndslot ""
newmenu "Pick mapsound"
menuinit [
resetcurmenu
if (strlen $__lastwatchedmapsound) [
push usedslots (mapsoundslotbyname $__lastwatchedmapsound)
menuitem (concat "Mapsound:" $__lastwatchedmapsound) -1
menuitem (concat "Distribution:" (getmapsoundorigin $__lastwatchedmapsound)) -1
menuitem "" -1
if (strlen $usedslots) [
menuitem "Mapsound is already used in" -1
looplist $usedslots i [
menuitem (concatword " slot #" $i " (maxuses: " (at (editmapsoundslot $i) 1) ")") (concat "__sndslot =" $i "; showmenu [Edit mapsound slot]")
]
menuitem "" -1
usedslots = "once more"
]
if (! (strlen (editmapsoundslot 255))) [
menuitem (concat "\f0Add to map config" $usedslots) (concat mapsound $__lastwatchedmapsound -1)
] [
menuitem "\f4(no free mapsound slots available)" -1
]
pop usedslots
][
menuitem "no mapsound selected" -1
]
]
// Edit mapsound slots
newmenu [Edit mapsound slots]
menuinit [
resetcurmenu
if $editing [
push info ""
push origin ""
loop i 256 [
info = (editmapsoundslot $i)
if (strlen $info) [
if $__showorigin [ origin = (__colororigin (getmapsoundorigin (at $info 0))) ]
menuitem (concatword "edit mapsound slot #" $i ": " $info $origin) (concat alias __sndslot $i ";" showmenu (escape "Edit mapsound slot"))
] [
if (strlen (mapsoundslotusage $i)) [
menuitem (concatword "unassigned mapsound slot #" $i) (concat alias __sndslot $i ";" showmenu (escape "Edit mapsound slot"))
]
]
]
pop info origin
] [
menuitem "menu only available in edit mode" -1
]
]
tempalias __snd_rad "1"
tempalias __snd_size "0"
tempalias __snd_vol "255"
newmenu [Edit mapsound slot]
menuinit [
resetcurmenu
if (strlen $__sndslot) [
push info (editmapsoundslot $__sndslot) // "<path> <maxuses>"
menuheader "" (concatword "edit mapsound slot #" $__sndslot ":\n" (at $info 0))
if (strlen $info) [
menuitemtextinput "Max simultaneous uses " (at $info 1) [editmapsoundslot $__sndslot "" $arg1]
menuitem " (\f4-1: unlimited)" -1
menuitem "" -1
menuitem (concat "Distribution:" (getmapsoundorigin (at $info 0))) -1
menuitem "" -1
menuitemtextinput "Mapsound path " (concat result (at $info 0)) [editmapsoundslot $__sndslot $arg1] "" 250
if (&& (strlen $__lastwatchedmapsound) (! (strcmp $__lastwatchedmapsound (at $info 0)))) [
menuitem (concat " change to" (escape $__lastwatchedmapsound)) [editmapsoundslot $__sndslot $__lastwatchedmapsound]
]
menuitem "" -1
menuitem "\f2Create map entity:" -1
menuitemslider [Sound radius: ] 1 25 "$__snd_rad" 1 [] [ __snd_rad = $arg1 ]
menuitemslider [Sound size: ] 0 25 "$__snd_size" 1 [] [ __snd_size = $arg1 ]
menuitemslider [Sound volume: ] 1 255 "$__snd_vol" 5 [] [ __snd_vol = $arg1 ]
menuitem "\f0 Place new entity now" (concat newent sound $__sndslot $__snd_rad $__snd_size $__snd_vol)
] [
menuitem "\f3Unassigned slot" -1
]
if (strlen (mapsoundslotusage $__sndslot)) [
menuitem "" -1 (concat gotoposition (gotoposition))
looplist (mapsoundslotusage $__sndslot) 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 deletemapsoundslot $__sndslot)
]
pop info
][
menuitem "no slot selected" -1
]
]
// "closestenttype" slider...
_closestentslider = [ closestenttype (at ["" light playerstart pistol ammobox grenades health armour akimbo mapmodel ladder ctf-flag sound clip helmet plclip] $arg1); _closestenttypestatus = $arg1 ]
newmenu [Editing settings]
menuitemslider "Grid/Selection style: " 0 1 "$oldselstyle" 1 [triangles "squares (default)"] [ oldselstyle $arg1 ]
menuitemcheckbox "Show mapmodel clippings: " "$showmodelclipping" [ showmodelclipping $arg1 ]
menuitemcheckbox "Show ladder entities: " "$showladderentities" [ showladderentities $arg1 ]
menuitemcheckbox "Show all playerstarts (spawn points): " "$showplayerstarts" [ showplayerstarts $arg1 ]
menuitemslider "Fly speeds multiplier: " 1 5 "$flyspeed" 1 [] [ flyspeed $arg1 ]
menuitem "" -1
menuitem "Load batch map conversion tools" load_convmap
menuitem "Load extra map editing scripts" load_mapeditscripts
// opt/autosave.cfg may add some entries
newmenu [Editing keys]
menuitem "Select an action and press ENTER to bind a new key:" -1
menuitem "" -1
menuitem "\f2Mousewheel editing:" -1
menuitemeditkeyinput [Move entity: ] editkey_scroll_moveent
menuitemeditkeyinput [Change vdelta: ] editkey_scroll_vdelta
menuitemeditkeyinput [Change wall/upper wall texture: ] editkey_scroll_walluppertex
menuitemeditkeyinput [Change floor/ceiling texture: ] editkey_scroll_floorceiltex
menuitem "\f4(Keys '1' thru '7' edit entity attributes)" -1
menuitem "" -1
menuitem "\f2Edit all selected cubes:" -1
menuitemeditkeyinput [Make cubes 'solid': ] editkey_cubes_solid
menuitemeditkeyinput [Make cubes 'space': ] editkey_cubes_space
menuitemeditkeyinput [Make cubes 'floor heightfield': ] editkey_cubes_hf_floor
menuitemeditkeyinput [Make cubes 'ceiling heightfield': ] editkey_cubes_hf_ceiling
menuitemeditkeyinput [Make cubes 'corner': ] corner
menuitem "" -1
menuitemeditkeyinput [Move floor down: ] editkey_move_floor_down
menuitemeditkeyinput [Move floor up: ] editkey_move_floor_up
menuitemeditkeyinput [Move ceiling down: ] editkey_move_ceiling_down
menuitemeditkeyinput [Move ceiling up: ] editkey_move_ceiling_up
menuitemeditkeyinput [Decrease vdelta: ] editkey_vdelta_down
menuitemeditkeyinput [Increase vdelta: ] editkey_vdelta_up
menuitemeditkeyinput [Equalize floor: ] editkey_equalize_floor
menuitemeditkeyinput [Equalize ceiling: ] editkey_equalize_ceiling
menuitem "" -1
menuitemeditkeyinput [Texture on floor forward: ] editkey_floortex_up
menuitemeditkeyinput [Texture on floor previous: ] editkey_floortex_dn
menuitemeditkeyinput [Texture on wall forward: ] editkey_walltex_up
menuitemeditkeyinput [Texture on wall previous: ] editkey_walltex_dn
menuitemeditkeyinput [Texture on ceiling forward: ] editkey_ceiltex_up
menuitemeditkeyinput [Texture on floor previous: ] editkey_ceiltex_dn
menuitemeditkeyinput [Texture on upper wall forward: ] editkey_uppertex_dn
menuitemeditkeyinput [Texture on upper wall previous: ] editkey_uppertex_up
menuitem "" -1
menuitem "\f2Misc editing keys:" -1
menuitemkeyinput [Enter edit mode: ] edittoggle
menuitemeditkeyinput [Exit edit mode: ] edittoggle
menuitemeditkeyinput [Show editing menu: ] editkey_show_menu
menuitemeditkeyinput [Show lighting menu: ] editkey_show_menu_light
menuitem "" -1
menuitemeditkeyinput [1st meta key: ] editmeta
menuitemeditkeyinput [2nd meta key: ] editkey_editmeta2
menuitem "" -1
menuitemeditkeyinput [Occlusion culling on/off: ] toggleocull
menuitemeditkeyinput [Mip display on/off : ] showmip
menuitemeditkeyinput [Fullbright on/off: ] editkey_fullbright
menuitemeditkeyinput [Show cube details on/off: ] showfocuscubedetails
menuitem "" -1
menuitemeditkeyinput [Copy selected cubes: ] copy
menuitemeditkeyinput [Paste cubes: ] paste
menuitemeditkeyinput [Undo geometry changes: ] undo
menuitemeditkeyinput [Redo: ] redo
menuitem "" -1
menuitemeditkeyinput [Pin/unpin closest entity: ] toggleclosestentpin
menuitemeditkeyinput [Delete entity: ] editkey_delete_entity
menuitemeditkeyinput [Copy entity: ] copyent
menuitemeditkeyinput [Paste entity: ] pasteent
menuitemeditkeyinput [Edit entity: ] editent
menuitemeditkeyinput [Cycle through TODO entities: ] editkey_scroll_todoents
menuitemeditkeyinput [Cycle through spawns: ] editkey_scroll_spawns
menuitem "" -1
menuitem "\f2Tag clips:" -1
menuitemeditkeyinput [Show tag clip volume: ] showtagclipfocus
menuitemeditkeyinput [Remove tag clip: ] editkey_tagclip_none
menuitemeditkeyinput [Create tag 'playerclip': ] editkey_tagclip_plclip
menuitemeditkeyinput [Create tag 'clip': ] editkey_tagclip_clip
// deleted entities
newmenu "deleted entities"
menuinit [
resetcurmenu
if (unlistdeletedentity) [
looplisti (getdeletedentities) [type x y z a1 a2 a3 a4 a5 a6 a7] [
push desc (concat $type (concatword "[" $x "|" $y "|" $z "]") (concatword "(" $a1 ", " $a2 ", " $a3 ", " $a4 ", " $a5 ", " $a6 ", " $a7 ")"))
if (strcmp $type mapmodel) [desc = (concat $desc (mapmodelslotname $a2))]
if (&& $editing (strcmp $type sound)) [desc = (concat $desc (at (editmapsoundslot $a1) 0))]
if $editing [
menuitem (pop desc) (concat gotoposition $x $y $z $a1 0 ";" undelent $i)
][
menuitem (pop desc) -1
]
]
menuitem "\f3clear this list" "unlistdeletedentity all"
] [
menuitem "no deleted entities" -1
]
]
// todo entities
newmenu "TODO entities"
menuinit [
resetcurmenu
push h 1
looplisti (enumtodoentities) [n desc] [
if $editing [
menuitem (concatword "Entity #" $n ": \fs\f4" (editentity $n) "\fr " $desc) (concat gotoentity $n "; echo" (escape $desc))
][
menuitem (concatword "Entity #" $n ": " $desc) -1
]
h = 0
]
if (pop h) [
menuitem "no TODO entities" -1
][
menuitem "" -1
menuitem "\f3Clear list of TODO entities" cleartodoentities
]
]
// sort config slots
looplist [__mmsort __mmmerge __texsort __texmerge __sndsort __sndmerge] i [tempalias $i 1]
newmenu [Sort mapmodel slots]
menuitemcheckbox "Sort slots alphabetically" "$__mmsort" [ __mmsort = $arg1 ]
menuitemslider "Merge " 0 2 "$__mmmerge" 1 ["no slots" "unused identical slots" "all identical slots"] [ __mmmerge = $arg1 ]
menuitem "" -1
menuitem "\t\t\f0[Start]" [sortmapmodelslots (at [nosort ""] $__mmsort) (at [nomerge "" mergeused] $__mmmerge)]
newmenu [Sort texture slots]
menuitemcheckbox "Sort slots alphabetically" "$__texsort" [ __texsort = $arg1 ]
menuitemslider "Merge " 0 2 "$__texmerge" 1 ["no slots" "unused identical slots" "all identical slots"] [ __texmerge = $arg1 ]
menuitem "" -1
menuitem "\t\t\f0[Start]" [sorttextureslots (at [nosort ""] $__texsort) (at [nomerge "" mergeused] $__texmerge)]
newmenu [Sort mapsound slots]
menuitemcheckbox "Sort slots alphabetically" "$__sndsort" [ __sndsort = $arg1 ]
menuitemslider "Merge " 0 2 "$__sndmerge" 1 ["no slots" "unused identical slots" "all identical slots"] [ __sndmerge = $arg1 ]
menuitem "" -1
menuitem "\t\t\f0[Start]" [sortmapsoundslots (at [nosort ""] $__sndsort) (at [nomerge "" mergeused] $__sndmerge)]
//Mapmodels
newmenu Mapmodels
menuinit __rebuildmapmodelmenus
tempalias __mapmodelcategories [
platforms "Platforms"
ladders "Ladders+Stairs"
stairs "Ladders+Stairs"
fencing "Fencing"
plants "Plants"
lamps "Lights+Lamps"
street "Street"
pipes "Pipes"
office "Office"
computers "Computers"
home "Home"
industrial "Industrial"
military "Military"
signs "Signs"
litter "Other/Litter"
misc "Other/Misc"
unsoo "Unsorted/Official"
unsoa "Unsorted/Akimbo"
unsom "Unsorted/Map-Config"
unsorted "Unsorted/Custom"
]
looplist $__mapmodelcategories [key menu] [tempalias (concatword __mm_key_ $key) $menu]
tempalias __mm_showmodel [concat alias __lastwatchedmapmodel $arg2 ";" chmenumdl (escape $arg1) (concatword mapmodels/ $arg2) all 40 3]
tempalias __mm_showmodel2 [concat chmenumdl (escape $arg1) (concatword mapmodels/ $arg2) all 40 3]
tempalias __mm_tempmenus ""
tempalias __rebuildmapmodelmenus [
if $mapmodelchanged [
push __mm_menus "" // menus with content
push __mm_done "" // done map config slots
push idxs ""
push mpath ""
looplist $__mapmodelcategories [key menu] [delmenu $menu]
looplist (listallmapmodelattributes explodekeywords sortby: keywords sortby: desc usage defaults distribution) [path keyword desc usage dflts dist] [
mpath = (concatword "mapmodels/" $path)
dflts = (concat $dflts "0 0 0 0")
dflts = (concat (at $dflts 0) (at $dflts 1) (at $dflts 2) (at $dflts 3)) // fix missing/incomplete default slot parameters
idxs = (mapmodelslotbyname $mpath)
if (|| (! (strlen $keyword)) (< (findlist $__mapmodelcategories $keyword) 0)) [
keyword = unsorted
if (strcmp $dist "official") [ keyword = unsoo ] // unless someone writes the missing config files ;)
if (strcmp $dist "autodownload") [ keyword = unsoa ] // a.k.a "akimbo"
if (strcmp $dist "akimbo") [ keyword = unsoa ]
if (listlen $idxs) [ keyword = unsom ] // has slot in current map config
]
keyword = (concatword __mm_key_ $keyword)
newmenu $$keyword
menurenderoffset -40 0
concatuniq __mm_menus $$keyword
if (strlen $desc) [] [desc = $mpath]
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 $path) $usage] // several slots for the same mapmodel
][
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 $path) $usage // mapmodel has no slot assigned: assign one
]
]
// add menus sorted by author and distribution
push amenu ""
push distmenus ""
looplist $__mm_tempmenus menu [delmenu $menu]
__mm_tempmenus = ""
looplist (listallmapmodelattributes sortby: author desc usage defaults distribution) [path author desc usage dflts dist] [
mpath = (concatword "mapmodels/" $path)
dflts = (concat $dflts "0 0 0 0")
dflts = (concat (at $dflts 0) (at $dflts 1) (at $dflts 2) (at $dflts 3)) // fix missing/incomplete default slot parameters
if (strlen $author) [] [author = "*unknown*"]
idxs = (mapmodelslotbyname $mpath)
amenu = (concat "Map models by" $author)
newmenu $amenu // menu sorted by author
concatuniq __mm_tempmenus $amenu
menurenderoffset -40 0
if (listlen $idxs) [
if (> (listlen $idxs) 1) [
looplist $idxs i [menuitem (concat $path (concatword "#" $i)) (concat newent mapmodel $i) (__mm_showmodel $amenu $path) $desc] // several slots for the same mapmodel
][
menuitem $path (concat newent mapmodel $idxs) (__mm_showmodel $amenu $path) $desc // usual case: one slot per model
]
][
menuitem (concatword "\f4" $path) (concat newent mapmodel "(mapmodel" $dflts $path ")") (__mm_showmodel $amenu $path) $desc // mapmodel has no slot assigned: assign one
]
if (strlen $dist) [] [dist = "*unknown*"]
amenu = (concat "Map models of origin:" $dist)
newmenu $amenu // menu sorted by distribution
concatuniq distmenus $amenu
menurenderoffset -40 0
if (listlen $idxs) [
if (> (listlen $idxs) 1) [
looplist $idxs i [menuitem (concat $path (concatword "#" $i)) (concat newent mapmodel $i) (__mm_showmodel $amenu $path) $desc] // several slots for the same mapmodel
][
menuitem $path (concat newent mapmodel $idxs) (__mm_showmodel $amenu $path) $desc // usual case: one slot per model
]
][
menuitem (concatword "\f4" $path) (concat newent mapmodel "(mapmodel" $dflts $path ")") (__mm_showmodel $amenu $path) $desc // mapmodel has no slot assigned: assign one
]
]
amenu = "Browse all map models"
delmenu $amenu
newmenu $amenu
looplist $__mm_tempmenus m [menuitem $m (concat showmenu (escape $m))]
menuitem "" -1
looplist $distmenus m [menuitem $m (concat showmenu (escape $m))]
__mm_tempmenus = (concat $__mm_tempmenus $distmenus)
delmenu Mapmodels
newmenu Mapmodels
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
if (strlen $__mm_tempmenus) [menuitem "" -1 ; menuitem $amenu (concat showmenu (escape $amenu))]
delmenu [Delete unused mapmodel slot]
delmenu [Edit mapmodel slots]
if $editing [
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)
]
]
]
newmenu [Edit mapmodel slots]
menurenderoffset -40 0
push origin ""
loop i 256 [
mpath = (mapmodelslotname $i)
if (strlen $mpath) [
if $__showorigin [
origin = (getmapmodelattributes $mpath distribution)
if (! (strlen $origin)) [ origin = "custom/unsorted" ]
origin = (__colororigin $origin)
]
menuitem (concatword "edit slot #" $i ": " (editmapmodelslot $i) $origin) (concat alias __mmslot $i ";" showmenu (escape "Edit mapmodel slot")) (__mm_showmodel2 [Edit mapmodel slots] $mpath)
] [
if (strlen (mapmodelslotusage $i)) [
menuitem (concatword "unassigned slot #" $i) (concat alias __mmslot $i ";" showmenu (escape "Edit mapmodel slot")) [chmenumdl [Edit mapmodel slots] ""]
]
]
]
pop origin
mapmodelchanged 0
] [
newmenu [Delete unused mapmodel slot]
menuitem "menu only available in edit mode" -1
newmenu [Edit mapmodel slots]
menuitem "menu only available in edit mode" -1
]
pop menu __mm_menus __mm_sorted __mm_done __mm_unsorted idxs mpath amenu distmenus
]
]
tempalias __rebuildtexturemenus [
if $rereadtexturelists [
delmenu "Official textures"
delmenu "Custom textures"
push fullname ""
looplist (gettexturelist "" "kurt skymaps map_editor" "") [tpath tname] [
fullname = (concatword $tpath "/" $tname)
if (strcmp official (gettextureorigin $fullname)) [
newmenu "Official textures"
] [
newmenu "Custom textures"
]
menuitem $fullname (concat _texmenu_exec (escape $fullname)) (concat _texmenu_hover (escape $fullname) (escape (curmenu)))
menurenderoffset -20 0
]
]
]
tempalias _texmenu_exec [
__lastwatchedtexture = $arg1
if $editing [ showmenu "Pick texture" ]
]
tempalias _texmenu_hover [
__lastwatchedtexture = $arg1
chmenutexture $arg2 $arg1
]
tempalias __mapsoundtitles [
cavedrip.ogg "Cave drip"
distant_cars.ogg "Cars driving in the distance"
hum01.ogg "Humm 1"
hum02.ogg "Humm 2"
night_crickets.ogg "Crickets at night"
water.ogg "Water 1"
wind.ogg "Wind"
t_aircond.ogg "Air conditioner"
t_compressor.ogg "Compressor"
t_crow.ogg "Crow"
t_dogs01.ogg "Dogs 1"
t_helicopter.ogg "Helicopter"
t_hum01.ogg "Humm 3"
t_hum02.ogg "Humm 4"
t_hum03.ogg "Humm 5"
t_hum04.ogg "Humm 6"
t_night_dog.ogg "Dogs 2"
t_night01.ogg "Night 1"
t_night02.ogg "Night 2"
t_radio_comms.ogg "Radio comms"
t_radio_static.ogg "Radio static"
t_satcoms.ogg "Sat-coms"
t_sludge.ogg "Sludge"
t_static01.ogg "Static 1"
t_static02.ogg "Static 2"
t_vent01.ogg "Vent 1"
t_vent02.ogg "Vent 2"
t_water_owl.ogg "Water owl"
t_water01.ogg "Water 2"
t_waterdrip.ogg "Water drip"
t_wind.ogg "Wind 2"
t_waterpipe01.ogg "Waterpipes 1"
t_waterpipe02.ogg "Waterpipes 2"
warningalarm01.ogg "Warning alarm"
t_gastank.ogg "Gastank"
t_keyboard.ogg "Keyboard"
t_factory01.ogg "Factory"
t_vents.ogg "Vent 3"
t_waterfront.ogg "Waterfront"
t_generator.ogg "Generator"
t_electricbuzz.ogg "Electric buzz"
t_alarm01.ogg "Alarm"
flies.ogg "Flies"
deserthawk.ogg "Desert hawk"
owl.ogg "Owl"
citynoisebirds.ogg "City birds"
]
tempalias __rebuildmapsoundmenus [
if $rereadsoundlists [
delmenu "Official mapsounds"
delmenu "Custom mapsounds"
looplist (getmapsoundlist) [sname] [
if (strcmp official (getmapsoundorigin $sname)) [
newmenu "Official mapsounds"
] [
newmenu "Custom mapsounds"
]
push idx (findlist $__mapsoundtitles $sname)
if (< $idx 0) [
menuitem $sname (concat _sndmenu_exec $sname)
] [
menuitem (concatword (at $__mapsoundtitles (+ $idx 1)) " (" $sname ")") (concat _sndmenu_exec $sname)
]
menurenderoffset -20 0
]
]
]
tempalias _sndmenu_exec [
__lastwatchedmapsound = $arg1
if $editing [ showmenu "Pick mapsound" ]
]
tempalias __showslopes [
push i 0
looplist (mapareacheck vdelta) n [
if $n [ echo $n cubes with slopes $i .. (+ $i 2) ]
i = (+ $i 2)
]
pop i
]
tempalias __clearprobepointdummies [ clearents dummy ]
tempalias __placeprobepointdummies [
__clearprobepointdummies
looplist (mapareacheck pp) [x y z area vol avgh] [
if (> $vol 32767) [ vol = 32767 ]
editentity (addentity dummy) $x $y (+ $z 5) $area "" "" "" $vol "" $avgh
]
]
newmenu [Map area checks]
menuitem "Heightfield slope stats" __showslopes
menuitem "Goto steepest heightfield position" [ push p (mapareacheck steepest) ; gotoposition (at $p 0) (at $p 1) (at (pop p) 2)]
menuitem "Place probe point dummies" __placeprobepointdummies
menuitem "Walk probe point dummies..." [ showmenu [Walk probe point dummies] ]
menuitem "Clear probe point dummies" __clearprobepointdummies
newmenu [Walk probe point dummies]
menuinit [
resetcurmenu
__placeprobepointdummies
menuitem "\f4(return to previous position)" (concat gotoposition (gotoposition)) (concat gotoposition (gotoposition))
push ents (enumentities dummy)
looplisti (mapareacheck pp) [x y z area vol avgh] [
menuitem (concatword "#" $i " area: " $area " volume: " $vol " avg height: " $avgh " (" $x "|" $y ")") (concat gotoentity (at $ents $i)) (concat gotoentity (at $ents $i))
]
pop ents
]
push __a "resetcurmenu ; menuitem [\f4(return to previous position)] (concat gotoposition (gotoposition)) (concat gotoposition (gotoposition)) ;"
push __b "looplist $ents i [ menuitem (concatword # $i [ ] (editentity $i)) (concat gotoentity $i) (concat gotoentity $i) ] ; pop ents"
looplist (listoptions ents) e [
newmenu (concat Walk $e entities)
menuinit (concat $__a "push ents (enumentities" $e ") ;" $__b)
]
newmenu [Walk mapmodel entities with unconfigured custom textures]
menuinit (concat $__a "looplist (enumentities mapmodel) i [if (! (strlen (edittextureslot (at (editentity $i) 7)))) [menuitem (concatword # $i [ ] (editentity $i)) (concat gotoentity $i) (concat gotoentity $i)]]")
pop __a __b
newmenu [Most visible textures]
menuinit [
resetcurmenu
menurenderoffset -20 0
if $editing [
push ec (escape (curmenu))
push mvis (textureslotusagelist onlymostvisible)
push info ""
looplist $mvis [d i] [
info = (edittextureslot $i)
menuitem (concatword "most visible " $d " texture: " (if $i (escape $info) [result <skymap>]) " (slot #" $i ")") (concat __texslot = $i "; showmenu [Edit texture slot]") (concat chmenutexture $ec (at $info 1))
]
menuitem "" -1 (concat chmenutexture $ec [])
menuitem "Sort the most visible textures to the default slot positions" (concat sorttextureslots nomerge nosort 1 (at $mvis 1) (at $mvis 3) (at $mvis 5) (at $mvis 7)) (concat chmenutexture $ec [])
pop mvis ec info
] [
menuitem "menu only available in edit mode" -1
]
]
newmenu [Entity statistics]
menuinit [
resetcurmenu
push s 1
looplist (listoptions ents) e [
push n (listlen (enumentities $e))
if $n [
menuitem (concatword $n " entities of type " $e) (concat showmenu "[Walk" $e "entities]")
s = 0
]
pop n
]
if (pop s) [
menuitem "No entities" -1
]
]
persistidents 1