fix permissions for some edit commands

- always allow read-only edittextureslot, editmapmodelslot and
  editmapsoundslot
- allow setvantagepoint when editing offline or spectating offline
- new var editing_sp: 1 during edit mode in singleplayer (offline)
- additional menus for read-only access to map config slots
- new bonus edit scripts: selectmiddle and unclipentclippedmodels

DOCREF edittextureslot editmapmodelslot editmapsoundslot setvantagepoint
DOCREF editing_sp
This commit is contained in:
ac-stef
2017-06-14 16:33:58 +02:00
parent 9bb9cc280b
commit d7277c1aa4
8 changed files with 227 additions and 65 deletions
+129 -45
View File
@@ -51,6 +51,7 @@ tempalias __mapmodelcategories [
looplist $__mapmodelcategories [key menu] [tempalias (concatword __mm_key_ $key) $menu]
tempalias __menuitem_offlineeditonly [ menuitem "menu only available in offline edit mode" -1 ]
tempalias __mm_showmodel [concat alias __lastwatchedmapmodel $arg2 ";" menumdl (escape $arg1) (concatword mapmodels/ $arg2) all 40 3]
tempalias __mm_showmodel2 [concat menumdl (escape $arg1) (concatword mapmodels/ $arg2) all 40 3]
tempalias __mm_tempmenus ""
@@ -144,7 +145,7 @@ tempalias __rebuildmapmodelmenus [
if (strlen $__mm_tempmenus) [menuitem "" -1 ; menuitem $amenu (concat showmenu (escape $amenu))]
delmenu [Delete unused mapmodel slot]
delmenu [Edit mapmodel slots]
if $editing [
if $editing_sp [
newmenu [Delete unused mapmodel slot]
loop i 256 [
mpath = (mapmodelslotname $i)
@@ -176,9 +177,9 @@ tempalias __rebuildmapmodelmenus [
mapmodelchanged 0
] [
newmenu [Delete unused mapmodel slot]
menuitem "menu only available in edit mode" -1
__menuitem_offlineeditonly // "menu only available in offline edit mode"
newmenu [Edit mapmodel slots]
menuitem "menu only available in edit mode" -1
__menuitem_offlineeditonly // "menu only available in offline edit mode"
]
pop __mm_menus __mm_sorted __mm_done idxs mpath amenu distmenus
]
@@ -572,12 +573,12 @@ tempalias __setundoarch [ __undoarch = (concat select (at (selx) 0) (at (sely) 0
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 "\t[ Place arch ]" [ if $editing_sp __setundoarch ; heightfield 2; arch $__archside ]
menuitem "Edit arches\i\3" [ showmenu "Edit arches" ]
menuitem "" -1
menuitemradio "Slope axis: " 0 1 "$__slopeaxis" ["West to East (X)" "North to South (Y)"] [ __slopeaxis = $arg1 ]
menuitemslider "Slope increment: " 0 5 "$__slopeinc" ["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 ]" [ if $editing_sp __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 ]
@@ -701,10 +702,12 @@ menuinit [
menuitem (at $lb 1) -1
menuitem "Transfer backup xmap to new regular xmap" (concat inputcommand (at $lb 0) "[xmap_keep_backup $cmdbuf]" "\"\fs\f0[xmap_keep_backup]\f2 enter new nickname for backup xmap:\fr\"" 1)
menuitem "Delete backup xmap" [ saycommand "/xmap_delete_backup" ]
if $unsavededits [
menuitem (concat "Restore backup xmap \f3(and lose" $unsavededits "currently unsaved edits)") xmap_restore
] [
menuitem "Restore backup xmap" xmap_restore
if $editing_sp [
if $unsavededits [
menuitem (concat "Restore backup xmap \f3(and lose" $unsavededits "currently unsaved edits)") xmap_restore
] [
menuitem "Restore backup xmap" xmap_restore
]
]
menuitem "" -1
]
@@ -728,10 +731,12 @@ menuinit [
menuitem (concatword "\f2xmap " $__curxmap ":") -1
menuitem $desc -1
menuitem "" -1
if (strlen (getxmaplist bak)) [
menuitem (concatword "Restore xmap \fs\f1" $__curxmap "\fr (store current state as new backup xmap \fs\f3and lose backup xmap \f1" (at (getxmaplist bak) 0) "\fr)") (concat xmap_restore $__curxmap)
] [
menuitem (concat "Restore xmap\fs\f1" $__curxmap "\fr(store current state as new backup xmap)") (concat xmap_restore $__curxmap)
if $editing_sp [
if (strlen (getxmaplist bak)) [
menuitem (concatword "Restore xmap \fs\f1" $__curxmap "\fr (store current state as new backup xmap \fs\f3and lose backup xmap \f1" (at (getxmaplist bak) 0) "\fr)") (concat xmap_restore $__curxmap)
] [
menuitem (concat "Restore xmap\fs\f1" $__curxmap "\fr(store current state as new backup xmap)") (concat xmap_restore $__curxmap)
]
]
menuitem "" -1
menuitem "Rename xmap" (concat inputcommand $__curxmap "[xmap_rename" $__curxmap "$cmdbuf]" "\"\fs\f0[xmap_rename]\f2 enter new nickname for xmap" $__curxmap ":\fr\"" 1)
@@ -825,10 +830,14 @@ menuinit [
if (strlen (getvantagepoint)) [
menuitem (format2 "Goto current map vantage point at x=%1, y=%2, z=%3, yaw=%4, pitch=%5" (getvantagepoint)) [ gotovantagepoint ]
menuitem "" -1
menuitem "\f3[ Delete vantage point ]" clearvantagepoint
menuitem "" -1
if $editing_sp [
menuitem "\f3[ Delete vantage point ]" clearvantagepoint
menuitem "" -1
]
]
if(! $connected) [
menuitem "\f0[ Set current position and viewing angle as map vantage point ]" setvantagepoint
]
menuitem "\f0[ Set current position and viewing angle as map vantage point ]" setvantagepoint
]
//// Main > Editing > Map settings > Select map license ////
@@ -840,23 +849,34 @@ menuinit [
newmenu [Map config operations]
tempalias __showorigin 0 ; tempalias __colororigin [ result (concatword " \fs\f" (if (strcmp $arg1 official) 4 2) "<" $arg1 ">\fr") ]
menuitem "Edit mapmodel slot\i\3" [ showmenu [Edit mapmodel slots] ]
menuitem "Delete unused mapmodel slot\i\3" [ showmenu [Delete unused mapmodel slot] ]
menuitem "" -1
menuitem "Edit texture slot\i\3" [ showmenu [Edit texture slots] ]
menuitem "" -1
menuitem "Edit mapsound slot\i\3" [ 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\i\3" [ showmenu [Sort mapmodel slots] ]
menuitem "Sort texture slots\i\3" [ showmenu [Sort texture slots] ]
menuitem "Sort mapsound slots\i\3" [ showmenu [Sort mapsound slots] ]
menuitem "" -1
menuitem "Update mapmodel menus" "mapmodelchanged 1"
menuitemcheckbox "Show media file origin/distribution" "$__showorigin" [ __showorigin = $arg1 ; mapmodelchanged 1 ]
menuinit [
resetcurmenu
if $editing_sp [
menuitem "Edit mapmodel slot\i\3" [ showmenu [Edit mapmodel slots] ]
menuitem "Delete unused mapmodel slot\i\3" [ showmenu [Delete unused mapmodel slot] ]
menuitem "" -1
menuitem "Edit texture slot\i\3" [ showmenu [Edit texture slots] ]
menuitem "" -1
menuitem "Edit mapsound slot\i\3" [ 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\i\3" [ showmenu [Sort mapmodel slots] ]
menuitem "Sort texture slots\i\3" [ showmenu [Sort texture slots] ]
menuitem "Sort mapsound slots\i\3" [ showmenu [Sort mapsound slots] ]
menuitem "" -1
menuitem "Update mapmodel menus" "mapmodelchanged 1"
][
menuitem "List mapmodel slots" [ showmenu [List mapmodel slots] ]
menuitem "List texture slots" [ showmenu [List texture slots] ]
menuitem "List mapsound slots" [ showmenu [List mapsound slots] ]
menuitem "\f4(offline edit mode required to make changes)" -1
menuitem "" -1
]
menuitemcheckbox "Show media file origin/distribution" "$__showorigin" [ __showorigin = $arg1 ; mapmodelchanged 1 ]
]
//// Main > Editing > Map config operations > Edit mapmodel slots ////
@@ -926,7 +946,7 @@ newmenu [Edit texture slots]
menuinit [
resetcurmenu
menurenderoffset -20 0
if $editing [
if $editing_sp [
push ecurmenu (escape (curmenu))
push info ""
push origin ""
@@ -934,13 +954,13 @@ menuinit [
info = (edittextureslot $i)
if $__showorigin [ origin = (__colororigin (gettextureorigin (at $info 1))) ]
if (|| $cnt (strlen $info)) [
if (! (strlen $info)) [ info = " \fs\f3<unassigned>\fr" ]
if (! (strlen $info)) [ info = " \fs\f3<unassigned>\fr" ; origin = "" ]
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
__menuitem_offlineeditonly // "menu only available in offline edit mode"
]
]
@@ -1046,7 +1066,7 @@ menuinit [
newmenu [Edit mapsound slots]
menuinit [
resetcurmenu
if $editing [
if $editing_sp [
push info ""
push origin ""
loop i 256 [
@@ -1062,7 +1082,7 @@ menuinit [
]
pop info origin
] [
menuitem "menu only available in edit mode" -1
__menuitem_offlineeditonly // "menu only available in offline edit mode"
]
]
@@ -1136,6 +1156,63 @@ menuitemslider "Merge " 0 2 "$__sndmerge" ["no slots" "unused identical slots" "
menuitem "" -1
menuitem "\t\t\f0[Start]" [sortmapsoundslots (at [nosort ""] $__sndsort) (at [nomerge "" mergeused] $__sndmerge)]
//// Main > Editing > Map config operations > List mapmodel slots ////
newmenu [List mapmodel slots]
menuinit [
resetcurmenu
menurenderoffset -40 0
push mpath ""
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 [slot #@[i]: @(editmapmodelslot $i)@origin] -1 (__mm_showmodel2 [List mapmodel slots] $mpath)
]
]
pop origin mpath
]
//// Main > Editing > Map config operations > List texture slots ////
newmenu [List texture slots]
menuinit [
resetcurmenu
menurenderoffset -20 0
push info ""
push origin ""
looplisti (textureslotusagelist) [cnt used] [
info = (edittextureslot $i)
if $__showorigin [ origin = (__colororigin (gettextureorigin (at $info 1))) ]
if (strlen $info) [
menuitem [texture slot #@[i]: @info @"("@cnt uses, @used visible@")"@origin] -1 [chmenutexture [List texture slots] @(at $info 1)]
]
]
pop info origin
]
//// Main > Editing > Map config operations > List mapsound slots ////
newmenu [List mapsound slots]
menuinit [
resetcurmenu
push info ""
push origin ""
loop i 256 [
info = (editmapsoundslot $i)
if (strlen $info) [
if $__showorigin [ origin = (__colororigin (getmapsoundorigin (at $info 0))) ]
menuitem (concatword "mapsound slot #" $i ": " $info $origin) -1
]
]
pop info origin
]
//// Main > Editing > Map checks and statistics ////
@@ -1175,11 +1252,16 @@ tempalias __placeprobepointdummies [
//// Main > Editing > Map checks and statistics > Map area checks ////
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\i\3" [ showmenu [Walk probe point dummies] ]
menuitem "Clear probe point dummies" __clearprobepointdummies
menuinit [
resetcurmenu
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)]
if $editing_sp [
menuitem "Place probe point dummies" __placeprobepointdummies
menuitem "Walk probe point dummies\i\3" [ showmenu [Walk probe point dummies] ]
menuitem "Clear probe point dummies" __clearprobepointdummies
]
]
//// Main > Editing > Map checks and statistics > Map area checks > Walk probe point dummies ////
@@ -1243,8 +1325,10 @@ menuinit [
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 [])
if $editing_sp [
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
+3 -2
View File
@@ -13,6 +13,8 @@
// - stage MAPCONFIG is the only stage that will not embed the config file - all later stages embed (format 10 does not require an embedded config, but strongly encourages it)
// - can build a secondary list of licenses and mapmessages (also in saved.cfg) to allow bulk-editing of map licenses and messages outside AC
looplist "convmaplist m t" i [ tempalias $i ]
// pick up map names from the commandline ("run opt/convmap ac_2fort ac_abandoned ac_abyss ac_accomply")
if $execnumargs [
convmaplist = ""
@@ -21,8 +23,6 @@ if $execnumargs [
]
]
looplist "convmaplist m t" i [ tempalias $i ]
looplisti [ CMASTAGE CMAFIRSTERROR CMALASTERROR CMACOMMENT CMANUM ] n [ tempalias $n $i ]
tempalias cmstagenames [ NOP MAPCONFIG TRANSCLIP CLEANSLOTS FIXUNASSIGNEDS FIXBADENTS MANUALERRORS MANUALEDITING FIXPICKUPFHF FINDSTRAYENTS ]
if (checkalias uncliptagclippedmodels) [ cmstagenames = (concat $cmstagenames REDUCECLIPS) ]
@@ -417,6 +417,7 @@ if (! (checkalias cmcur)) [ // execute this only once
const cm_dostage_REDUCECLIPS [ // automatically un-clip mapmodels if possible
uncliptagclippedmodels
unclipentclippedmodels
duplicateclippedslots_cleanup
]
+87 -11
View File
@@ -78,7 +78,7 @@ tempalias getcubedata [
// mm_z slot z-offset
echo "\fs\f2mm_z slot z-offset\fr\tadjust mapmodel sparklie positions to a fixed offset over ground + mapmodel elevation + modelslot elevation"
tempalias mm_z [
if $editing [
if $editing_sp [
push es (editmapmodelslot $arg1)
echo set z-coordinate of the entity sparklies of all mapmodels of slot # (escape $arg1) to floor + elevation + (at $es 2) + (escape $arg2)
if (strlen $arg1) [
@@ -96,7 +96,7 @@ tempalias mm_z [
]
pop es
][
echo edit mode required
echo offline edit mode required
]
]
@@ -104,7 +104,7 @@ tempalias mm_z [
// clip_z
echo "\fs\f2clip_z\fr\t\t\tadjust clipent sparklie positions to the middle of the clip"
tempalias clip_z [
if $editing [
if $editing_sp [
echo set z-coordinate of the entity sparklies of all clip and plclip to the middle of the clips
looplist (concat (enumentities clip) (enumentities plclip)) i [
push ee (editentity $i)
@@ -114,7 +114,7 @@ tempalias clip_z [
pop ee
]
][
echo edit mode required
echo offline edit mode required
]
]
@@ -123,7 +123,7 @@ tempalias clip_z [
// doubleclippedslots
echo "\fs\f2duplicateclippedslots\fr\t\tduplicate all clipped model slots with an unclipped version, then sort the slots"
tempalias duplicateclippedslots [
if $editing [
if $editing_sp [
echo double all clipped model slots with an unclipped version, then sort the slots
loop i 256 [
push info (editmapmodelslot $i)
@@ -135,30 +135,28 @@ tempalias duplicateclippedslots [
sortmapmodelslots
echo "\f4When done, use duplicateclippedslots_cleanup."
][
echo edit mode required
echo offline edit mode required
]
]
// clean up after using doubleclippedslots: sort&merge mapmodel slots, then delete all unused mapmodel slots
// (after running this, reducing the slot number of any mapmodel will remove the clip)
// doubleclippedslots_cleanup
echo "\fs\f2duplicateclippedslots_cleanup\fr\tremove all unnecessary mapmodel slots"
tempalias duplicateclippedslots_cleanup [
if $editing [
if $editing_sp [
sortmapmodelslots mergeused
loop ii 256 [ push i (- 255 $ii) ; if (&& (strlen (mapmodelslotname $i)) (strcmp "" (mapmodelslotusage $i))) [deletemapmodelslot $i] ; pop i]
echo all unnecessary mapmodel slots removed
][
echo edit mode required
echo offline edit mode required
]
]
// un-clip models that are fully in tagclipped areas
// (after running this, reducing the slot number of any mapmodel will remove the clip)
// uncliptagclippedmodels
echo "\fs\f2uncliptagclippedmodels\fr\tun-clip models that are fully in tagclipped areas"
tempalias uncliptagclippedmodels [
if $editing [
if $editing_sp [
push res 0
looplist (enumentities mapmodel) i [
push entinfo (editentity $i)
@@ -194,6 +192,84 @@ tempalias uncliptagclippedmodels [
resetselections
echo un-clipped $res mapmodel entities
pop res
][
echo offline edit mode required
]
]
// un-clip models that are fully clipped by a clip entity
// unclipentclippedmodels
echo "\fs\f2unclipentclippedmodels\fr\tun-clip models that are fully clipped by a clip entity"
tempalias unclipentclippedmodels [
if $editing_sp [
push res 0
looplist (enumentities mapmodel) i [
push entinfo (editentity $i)
push slotinfo (editmapmodelslot (at $entinfo 5))
if (|| (at $slotinfo 0) (at $slotinfo 1)) [
push radius (at $slotinfo 0) // model clip radius
push bot (+f (getcubedata (at $entinfo 1) (at $entinfo 2) floor) (at $entinfo 6) (at $slotinfo 2)) // model clip bottom, float
push h (at $slotinfo 1) // model clip height
looplist (enumentities clip) ci [
push clipinfo (editentity $ci)
if (&& (! (at $clipinfo 10)) (+ (at $clipinfo 5) (at $clipinfo 6))) [
push cibot (+f (getcubedata (at $clipinfo 1) (at $clipinfo 2) floor) (at $clipinfo 4)) // clip bottom, float
push cih (at $clipinfo 7) // clip height, float
push clipped (&& (<=f $cibot $bot) (>= (+f $cibot $cih) (+f $bot $h))) // check height range
*= clipped (&& (<= (- (at $clipinfo 1) (at $clipinfo 5)) (- (at $entinfo 1) $radius)) (>= (+ (at $clipinfo 1) (at $clipinfo 5)) (+ (at $entinfo 1) $radius))) // check x range
*= clipped (&& (<= (- (at $clipinfo 2) (at $clipinfo 6)) (- (at $entinfo 2) $radius)) (>= (+ (at $clipinfo 2) (at $clipinfo 6)) (+ (at $entinfo 2) $radius))) // check y range
if $clipped [
push uinfo (concat 0 0 (at $slotinfo 2) (at $slotinfo 3) (escape (at $slotinfo 4)))
loop j 256 [
if (strcmp (editmapmodelslot $j) $uinfo) [
addtodoentity $i (concatword "changed from mapmodel slot #" (at $entinfo 5) " to slot #" $j)
editentity $i "" "" "" "" $j
clipped = 0
break
]
]
if $clipped [
editentity $i "" "" "" "" (mapmodel 0 0 (at $slotinfo 2) (at $slotinfo 3) (at $slotinfo 4))
addtodoentity $i (concatword "changed from mapmodel slot #" (at $entinfo 5) " to newly created slot #" (at (editentity $i) 5))
]
pop uinfo
+= res 1
h = 0 // exit clipent loop
]
pop clipped cih cibot
]
pop clipinfo
if (! $h) break
]
pop h bot radius
]
pop entinfo slotinfo
]
resetselections
echo un-clipped $res mapmodel entities
pop res
][
echo offline edit mode required
]
]
// find middle cube in selection
// selectmiddle
echo "\fs\f2selectmiddle\fr\tfind middle cube in selection"
tempalias selectmiddle [
if $editing [
push res resetselections
loop i (listlen (selx)) [
push x (at (selx) $i)
push y (at (sely) $i)
push xs (at (selxs) $i)
push ys (at (selys) $i)
res = (concat $res ";" addselection (+ $x (div $xs 2)) (+ $y (div $ys 2)) 1 1)
pop x y xs ys
]
echo reduced (listlen (selx)) selections to the middle cube
res
pop res
][
echo edit mode required
]
+2 -2
View File
@@ -944,12 +944,11 @@ COMMAND(deletemapsoundslot, "is");
void editmapsoundslot(int *n, char *name, char *maxuses) // edit slot parameters != ""
{
EDIT("editmapsoundslot");
string res = "";
if(mapconfigdata.mapsoundlines.inrange(*n))
{
mapsoundline &msl = mapconfigdata.mapsoundlines[*n];
if((*name || *maxuses) && !multiplayer("editmapsoundslot"))
if((*name || *maxuses) && !noteditmode("editmapsoundslot") && !multiplayer("editmapsoundslot"))
{ // change attributes
if(*maxuses) msl.maxuses = strtol(maxuses, NULL, 0);
if(*name) copystring(msl.name, strncmp(name, mapsoundfinalpath, mapsoundfinalpath_n) ? name : name + mapsoundfinalpath_n);
@@ -966,6 +965,7 @@ COMMAND(editmapsoundslot, "iss");
void getmapsoundorigin(char *fname)
{
if(!*fname) return;
defformatstring(s)("packages/audio/ambience/%s", fname);
findfile(path(s), "r");
const char *res = s;
+2
View File
@@ -24,6 +24,7 @@ int lasttype = 0, lasttex = 0;
sqr rtex;
VAR(editing, 1, 0, 0);
VAR(editing_sp, 1, 0, 0);
VAR(unsavededits, 1, 0, 0);
VAR(editmetakeydown, 1, 0, 0);
@@ -55,6 +56,7 @@ void toggleedit(bool force)
}
keyrepeat(editmode);
editing = editmode ? 1 : 0;
editing_sp = editmode && !multiplayer(NULL) ? 1 : 0;
player1->state = editing ? CS_EDITING : (watchingdemo ? CS_SPECTATE : CS_ALIVE);
if(editing && player1->onladder) player1->onladder = false;
if(editing && (player1->weaponsel->type == GUN_SNIPER && ((sniperrifle *)player1->weaponsel)->scoped)) ((sniperrifle *)player1->weaponsel)->onownerdies(); // or ondeselecting()
+1 -2
View File
@@ -197,11 +197,10 @@ COMMAND(deletemapmodelslot, "is");
void editmapmodelslot(int *n, char *rad, char *h, char *zoff, char *scale, char *name) // edit slot parameters != ""
{
string res = "";
EDIT("editmapmodelslot");
if(mapmodels.inrange(*n))
{
mapmodelinfo &mmi = mapmodels[*n];
if((*rad || *h || *zoff || *scale || *name) && !multiplayer("editmapmodelslot"))
if((*rad || *h || *zoff || *scale || *name) && !noteditmode("editmapmodelslot") && !multiplayer("editmapmodelslot"))
{ // change attributes
if(*rad) mmi.rad = strtol(rad, NULL, 0);
if(*h) mmi.h = strtol(h, NULL, 0);
+2 -2
View File
@@ -1078,11 +1078,10 @@ COMMAND(deletetextureslot, "iss");
void edittextureslot(int *n, char *scale, char *name) // edit slot parameters != ""
{
string res = "";
EDIT("edittextureslot");
if(slots.inrange(*n))
{
Slot &s = slots[*n];
if((*scale || *name) && !multiplayer("edittextureslot"))
if((*scale || *name) && !noteditmode("edittextureslot") && !multiplayer("edittextureslot"))
{ // change attributes
float newscale = atof(scale);
_texture(s, *scale ? &newscale : NULL, *name ? name : NULL);
@@ -1097,6 +1096,7 @@ COMMAND(edittextureslot, "iss");
void gettextureorigin(char *fname)
{
if(!*fname) return;
defformatstring(s)("packages/textures/%s", fname);
findfile(path(s), "r");
const char *res = s;
+1 -1
View File
@@ -485,7 +485,7 @@ COMMANDF(clearvantagepoint, "", () { if(!noteditmode("clearvantagepoint") && !mu
void setvantagepoint()
{
EDITMP("setvantagepoint");
if(multiplayer("setvantagepoint") || (!player1->isspectating() && noteditmode("setvantagepoint"))) return;
clearvantagepoint();
short p[5];
storeposition(p);