convmap changes
new tool: list media sources new stage: check vantage points new: add single map from menu new: option to abort maps on stage errors fixed: make sure, player is alive (to be able to enter edit mode) during conversions
This commit is contained in:
+136
-57
@@ -13,7 +13,7 @@
|
||||
// - 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 ]
|
||||
if (! (checkalias cmcur)) [ tempalias convmaplist "" ]
|
||||
|
||||
// pick up map names from the commandline ("run opt/convmap ac_2fort ac_abandoned ac_abyss ac_accomply")
|
||||
if $execnumargs [
|
||||
@@ -24,7 +24,7 @@ if $execnumargs [
|
||||
]
|
||||
|
||||
looplisti [ CMASTAGE CMAFIRSTERROR CMALASTERROR CMACOMMENT CMANUM ] n [ tempalias $n $i ]
|
||||
tempalias cmstagenames [ NOP MAPCONFIG TRANSCLIP CLEANSLOTS FIXUNASSIGNEDS FIXBADENTS MANUALERRORS MANUALEDITING FIXPICKUPFHF FINDSTRAYENTS ]
|
||||
tempalias cmstagenames [ NOP MAPCONFIG TRANSCLIP CLEANSLOTS FIXUNASSIGNEDS FIXBADENTS MANUALERRORS MANUALEDITING FIXPICKUPFHF FINDSTRAYENTS CHECKVANTAGEPOINTS ]
|
||||
if (checkalias uncliptagclippedmodels) [ cmstagenames = (concat $cmstagenames REDUCECLIPS) ]
|
||||
tempalias NUMSTAGES (listlen $cmstagenames)
|
||||
looplisti $cmstagenames n [ tempalias $n $i ]
|
||||
@@ -94,34 +94,51 @@ if (! (checkalias cmcur)) [ // execute this only once
|
||||
tempalias cmdoneediting ""
|
||||
alias cmstage 1
|
||||
alias cmdomanual 0 // 1: pause for manual fixing of correctable errors
|
||||
alias cmconverredit 1 // 1: pause for manual edit on conversion error
|
||||
|
||||
newmenu main
|
||||
menuitem "" -1
|
||||
menuitem "Map conversion -->" [showmenu "Convert maps"]
|
||||
menuitem "Map conversion \i\1" [showmenu "Convert maps"]
|
||||
|
||||
newmenu "Convert maps"
|
||||
menuinit [
|
||||
resetcurmenu
|
||||
cmafterfinishediting = ""
|
||||
//if (&& (strlen $cmediting) (! $unsavededits)) [ cmdoneediting ]
|
||||
if (strlen $cmediting) [
|
||||
menuitem (concatword "Currently editing \fs\f1" $cmediting "\fr in stage " $cmeditstage " (" (at $cmstagenames $cmeditstage) ")") -1
|
||||
if (! $connected) [
|
||||
menuheader "" "\f2Please backup all your maps before using convmap. Thx."
|
||||
cmafterfinishediting = ""
|
||||
//if (&& (strlen $cmediting) (! $unsavededits)) [ cmdoneediting ]
|
||||
if (strlen $cmediting) [
|
||||
menuitem (concatword "Currently editing \fs\f1" $cmediting "\fr in stage " $cmeditstage " (" (at $cmstagenames $cmeditstage) ")") -1
|
||||
menuitem "" -1
|
||||
menuitem "Save changes ->" [ cmafterfinishediting = "showmenu [Convert maps]" ; showmenu "Convmap save" ]
|
||||
] [
|
||||
menuitem "\f0[ Start/Continue map conversion ]" cmwork
|
||||
]
|
||||
menuitem "" -1
|
||||
menuitem "Save changes ->" [ cmafterfinishediting = "showmenu [Convert maps]" ; showmenu "Convmap save" ]
|
||||
] [
|
||||
menuitem "\f0[ Start/Continue map conversion ]" cmwork
|
||||
]
|
||||
menuitem "" -1
|
||||
if (strlen $cmcur) [
|
||||
menuitem (concatword "Batch processing currently limited to map \fs\f1" $cmcur "\fr only") -1
|
||||
menuitem "[Remove limitation and continue editing the whole batch]" [ cmcur = "" ; refreshcurmenudelayed ]
|
||||
if (strlen $cmcur) [
|
||||
menuitem (concatword "Batch processing currently limited to map \fs\f1" $cmcur "\fr only") -1
|
||||
menuitem "[Remove limitation and continue editing the whole batch]" [ cmcur = "" ; refreshcurmenudelayed ]
|
||||
menuitem "" -1
|
||||
]
|
||||
menuitemslider "Conversion stage:\t" 0 -1 $cmstage $cmstagenames [ cmstage = $arg1 ]
|
||||
menuitemradio "On map load errors:\t\t" 0 1 $cmdomanual [ "abort map" "edit manually" ][ cmdomanual = $arg1 ]
|
||||
menuitemradio "On conversion errors:\t\t" 0 1 $cmconverredit [ "abort map" "edit manually" ][ cmconverredit = $arg1 ]
|
||||
menuitem "" -1
|
||||
menuitem "Show list of maps \i\1" [showmenu "List maps to convert"]
|
||||
menuitem "Add map to list \i\1" [showmenu "Add map to convmap list"]
|
||||
menuitem "Tools menu \i\1" [showmenu "Convert maps tools"]
|
||||
][
|
||||
menuheader "" ""
|
||||
menuitem "\f3convmap can only be used offline" -1
|
||||
]
|
||||
menuitemslider "Conversion stage:\t" 0 -1 $cmstage $cmstagenames [ cmstage = $arg1 ]
|
||||
menuitemslider "On map errors:\t\t" 0 1 $cmdomanual [ "abort map" "edit manually" ][ cmdomanual = $arg1 ]
|
||||
menuitem "" -1
|
||||
menuitem "[Show list of maps]" [showmenu "List maps to convert"]
|
||||
menuitem "Tools menu -->" [showmenu "Convert maps tools"]
|
||||
]
|
||||
|
||||
newmenu [Add map to convmap list]
|
||||
menudirlist "packages/maps" cgz [run opt/convmap $arg1 ; closecurmenu]
|
||||
|
||||
const __cmconfirm [
|
||||
echo "\fs\f0Done:\fr\t" $arg1
|
||||
refreshcurmenudelayed
|
||||
]
|
||||
|
||||
const cmsetnonabortstage [
|
||||
@@ -136,27 +153,29 @@ if (! (checkalias cmcur)) [ // execute this only once
|
||||
newmenu "Convert maps tools"
|
||||
menuinit [
|
||||
resetcurmenu
|
||||
menuitem "Show list of maps" [showmenu "List maps to convert"]
|
||||
menuitem "Retry all aborted maps (change negative stages to zero)" [ looplist (enumalias __convmap__) [mx m] [ if (< (cmget $mx $CMASTAGE) 0) [ cmset $mx $CMASTAGE 0 ] ] ]
|
||||
menuitem "Retry all maps (change all stages to zero)" [ looplist (enumalias __convmap__) [mx m] [ cmset $mx $CMASTAGE 0 ] ]
|
||||
menuheader "" "\f2Please backup all your maps before using convmap. Thx."
|
||||
menuitem "Show list of maps \i\1" [showmenu "List maps to convert"]
|
||||
menuitem "Retry all aborted maps (change negative stages to zero)" [ looplist (enumalias __convmap__) [mx m] [ if (< (cmget $mx $CMASTAGE) 0) [ cmset $mx $CMASTAGE 0 ] ] ; __cmconfirm ]
|
||||
menuitem "Retry all maps (change all stages to zero)" [ looplist (enumalias __convmap__) [mx m] [ cmset $mx $CMASTAGE 0 ] ; __cmconfirm ]
|
||||
looplisti $cmstagenames n [
|
||||
if (> $i 2) [
|
||||
menuitem (concat "Set all non-aborted maps to continue with stage" $n) (concat "cmsetnonabortstage" (- $i 1))
|
||||
menuitem (concat "Set all non-aborted maps to continue with stage" $n) (concat "cmsetnonabortstage" (- $i 1) "; __cmconfirm")
|
||||
]
|
||||
]
|
||||
menuitem "\f3Delete list of maps" [ looplist (enumalias __convmap__) [mx m] [ delalias $mx ] ]
|
||||
menuitem "Delete aborted maps from list" [ looplist (enumalias __convmap__) [mx m] [ if (< (cmget $mx $CMASTAGE) 0) [ delalias $mx ] ] ]
|
||||
menuitem "Delete non-aborted maps from list" [ looplist (enumalias __convmap__) [mx m] [ if (> (cmget $mx $CMASTAGE) 0) [ delalias $mx ] ] ]
|
||||
menuitem "\f3Delete list of maps" [ looplist (enumalias __convmap__) [mx m] [ delalias $mx ] ; __cmconfirm ]
|
||||
menuitem "Delete aborted maps from list" [ looplist (enumalias __convmap__) [mx m] [ if (< (cmget $mx $CMASTAGE) 0) [ delalias $mx ] ] ; __cmconfirm ]
|
||||
menuitem "Delete non-aborted maps from list" [ looplist (enumalias __convmap__) [mx m] [ if (> (cmget $mx $CMASTAGE) 0) [ delalias $mx ] ] ; __cmconfirm ]
|
||||
menuitem "" -1
|
||||
menuitem "Show list of licenses and mapmessages" [showmenu "List licenses and mapmessages"]
|
||||
menuitem "Generate list of licenses and mapmessages (does not delete existing list)" "cmgenlicenses"
|
||||
menuitem "Apply list of licenses and mapmessages" "cmapplylicenses"
|
||||
menuitem "\f3Delete list of licenses and mapmessages" [ looplist (enumalias __convmaplicenses__) [mx m] [ delalias $mx ] ]
|
||||
menuitem "Delete unchanged licenses and mapmessages from list" "cmchangedlicensesonly"
|
||||
menuitem "Show list of licenses and mapmessages \i\1" [showmenu "List licenses and mapmessages"]
|
||||
menuitem "Generate list of licenses and mapmessages (does not delete existing list)" [cmgenlicenses ; __cmconfirm ]
|
||||
menuitem "Apply list of licenses and mapmessages" [cmapplylicenses ; __cmconfirm ]
|
||||
menuitem "\f3Delete list of licenses and mapmessages" [ looplist (enumalias __convmaplicenses__) [mx m] [ delalias $mx ] ; __cmconfirm ]
|
||||
menuitem "Delete unchanged licenses and mapmessages from list" [cmchangedlicensesonly ; __cmconfirm]
|
||||
menuitem "" -1
|
||||
menuitem "Reset notexture on all maps in stage 2 or higher" [ looplist (enumalias __convmap__) [mx m] [ if (> (cmget $mx $CMASTAGE) 1) [ loadmap $m ; loadnotexture ; savemap ] ] ]
|
||||
menuitem "Extract config files of maps in stage 2 or higher with errors remaining" [ looplist (enumalias __convmap__) [mx m] [ if (&& (> (cmget $mx $CMASTAGE) 1) (concat loadmap $m)) [ extractconfigfile ; savemap ] ] ]
|
||||
menuitem "Extract config files of maps in stage 2 or higher" [ looplist (enumalias __convmap__) [mx m] [ if (> (cmget $mx $CMASTAGE) 1) [ loadmap $m ; extractconfigfile ; savemap ] ] ]
|
||||
menuitem "Reset notexture on all maps in stage 2 or higher" [ looplist (enumalias __convmap__) [mx m] [ if (> (cmget $mx $CMASTAGE) 1) [ loadmap $m ; loadnotexture ; savemap ] ] ; __cmconfirm ]
|
||||
menuitem "Extract config files of maps in stage 2 or higher with errors remaining" [ looplist (enumalias __convmap__) [mx m] [ if (&& (> (cmget $mx $CMASTAGE) 1) (concat loadmap $m)) [ extractconfigfile ; savemap ] ] ; __cmconfirm ]
|
||||
menuitem "Extract config files of maps in stage 2 or higher" [ looplist (enumalias __convmap__) [mx m] [ if (> (cmget $mx $CMASTAGE) 1) [ loadmap $m ; extractconfigfile ; savemap ] ] ; __cmconfirm ]
|
||||
menuitem "Check used media sources of all maps (write list to comment)" [ cm_mediasourcetocomment ; __cmconfirm ]
|
||||
]
|
||||
|
||||
newmenu "List licenses and mapmessages"
|
||||
@@ -206,6 +225,41 @@ if (! (checkalias cmcur)) [ // execute this only once
|
||||
]
|
||||
]
|
||||
|
||||
const cm_mediasourcetocomment [
|
||||
looplist (enumalias __convmaporigin__) [mx m] [ delalias $mx ]
|
||||
looplist (enumalias __convmap__) [mx m] [
|
||||
loadmap $m
|
||||
push path ""
|
||||
push origin ""
|
||||
loop i 256 [
|
||||
path = (mapmodelslotname $i)
|
||||
if (strlen $path) [
|
||||
origin = (getmapmodelattributes $path distribution)
|
||||
if (! (strlen $origin)) [ origin = "custom_unsorted" ]
|
||||
[__convmaporigin__@(escapenoquotes $origin)] = $origin
|
||||
]
|
||||
]
|
||||
looplisti (textureslotusagelist) [cnt used] [
|
||||
path = (at (edittextureslot $i) 1)
|
||||
if (strlen $path) [
|
||||
origin = (gettextureorigin $path)
|
||||
[__convmaporigin__@(escapenoquotes $origin)] = $origin
|
||||
]
|
||||
]
|
||||
loop i 256 [
|
||||
path = (at (editmapsoundslot $i) 0)
|
||||
if (strlen $path) [
|
||||
origin = (getmapsoundorigin $path)
|
||||
[__convmaporigin__@(escapenoquotes $origin)] = $origin
|
||||
]
|
||||
]
|
||||
origin = "\f1media sources: official\f2"
|
||||
delalias __convmaporigin__official
|
||||
looplist (enumalias __convmaporigin__) [mx m] [ origin = (concat $origin $$mx) ; delalias $mx ]
|
||||
cmset $mx $CMACOMMENT (pop origin path)
|
||||
]
|
||||
]
|
||||
|
||||
const cmpickmap [ tempalias cmpick $arg1 ; showmenu "Map conversion state" ]
|
||||
|
||||
newmenu "Map conversion state"
|
||||
@@ -220,11 +274,11 @@ if (! (checkalias cmcur)) [ // execute this only once
|
||||
]
|
||||
menuitem (concat "Errors during first map load:\t\t" (cmget $mx $CMAFIRSTERROR)) (concat cmprinterror (cmget $mx $CMAFIRSTERROR))
|
||||
menuitem (concat "Errors during most recent map load:\t" (cmget $mx $CMALASTERROR)) (concat cmprinterror (cmget $mx $CMALASTERROR))
|
||||
menuitemtextinput "Comment\t" (concat cmget $mx $CMACOMMENT) (concat cmset $mx $CMACOMMENT "$arg1")
|
||||
menuitemtextinput "Comment\t" [escapenoquotes (cmget @mx @CMACOMMENT)] [cmset @mx @CMACOMMENT (at (addpunct $arg1) 0)]
|
||||
menuitem "" -1
|
||||
menuitem "\f3[Delete map from batch processing list]" (concat delalias $mx)
|
||||
menuitem "\f3[Delete map from batch processing list]" (concat delalias $mx "; closemenu [Map conversion state]")
|
||||
menuitem "[Limit batch processing to this single map]" (concat "cmcur =" $cmpick)
|
||||
menuitem "[Load map]" (concat coop $cmpick)
|
||||
menuitemmapload "[Load map]" (concat coop $cmpick)
|
||||
pop mx
|
||||
]
|
||||
|
||||
@@ -235,7 +289,7 @@ if (! (checkalias cmcur)) [ // execute this only once
|
||||
push mi ""
|
||||
push nt (+ $CMANUM 1)
|
||||
looplisti $$mx v [
|
||||
mi = (concatword $mi $v "\t")
|
||||
mi = (concatword "\fs" $mi $v "\fr\t")
|
||||
-= nt 1
|
||||
]
|
||||
loop i $nt [ mi = (concatword $mi "\t") ]
|
||||
@@ -257,7 +311,7 @@ if (! (checkalias cmcur)) [ // execute this only once
|
||||
]
|
||||
|
||||
const cmfinishediting [
|
||||
if (&& (&& (strlen $cmediting) (strcmp $cmediting (curmap))) $unsavededits) [
|
||||
if (&& (strlen $cmediting) (strcmp $cmediting (curmap))) [
|
||||
showmenu "Convmap save"
|
||||
result 1
|
||||
][
|
||||
@@ -267,6 +321,15 @@ if (! (checkalias cmcur)) [ // execute this only once
|
||||
|
||||
const cmwork [
|
||||
if $editing edittoggle // end edit mode
|
||||
if (! (player1 alive)) [
|
||||
spectate
|
||||
sleep 100 cmwork // try again
|
||||
][
|
||||
cmwork_contd // alive: go to work
|
||||
]
|
||||
]
|
||||
|
||||
const cmwork_contd [
|
||||
echo "\f0Continue map conversion up to stage \f1" $cmstage
|
||||
|
||||
// process unsaved edits
|
||||
@@ -275,6 +338,7 @@ if (! (checkalias cmcur)) [ // execute this only once
|
||||
tempalias cmafterfinishediting ""
|
||||
push n ""
|
||||
push abort 0
|
||||
push stagefail 0
|
||||
// loop through all maps and all requested stages
|
||||
loop _curstage $cmstage [
|
||||
push curstage (+ $_curstage 1)
|
||||
@@ -296,24 +360,32 @@ if (! (checkalias cmcur)) [ // execute this only once
|
||||
] [
|
||||
// enter edit mode
|
||||
if (! $editing) edittoggle
|
||||
stagefail = 0
|
||||
|
||||
(concatword cm_dostage_ (at $cmstagenames $curstage)) $mx $mn $curstage $n
|
||||
|
||||
if (&& $stagefail (! $cmconverredit)) [
|
||||
echo "\f3aborting map" $mn due to problems in conversion stage $curstage
|
||||
cmset $mx $CMASTAGE (- 0 $curstage)
|
||||
cmset $mx $CMACOMMENT "aborted"
|
||||
]
|
||||
|
||||
cmprinterror $n "map load error: "
|
||||
if (&& (&b $cmerr_fixlater $n) $cmdomanual) [ abort = 1 ]
|
||||
if (&& $stagefail $cmconverredit) [ abort = 1 ]
|
||||
if $abort [
|
||||
echo "\f3Pausing for manual error correction. Continue batch run with \"/cmwork\" or use the menu."
|
||||
cmediting = (curmap)
|
||||
cmdoneediting = (concat cmset $mx $CMASTAGE $curstage " ; cmdoneediting = [] ; cmediting = [] ")
|
||||
cmeditstage = $curstage
|
||||
abort = 1
|
||||
] [
|
||||
cmset $mx $CMASTAGE $curstage
|
||||
if $editing edittoggle // end edit mode
|
||||
if (&& $unsavededits (strcmp (curmap) $mn)) [
|
||||
// finish stage and save changes
|
||||
savemap
|
||||
if (! $stagefail) [ // no errors: save result
|
||||
cmset $mx $CMASTAGE $curstage
|
||||
if (&& $unsavededits (strcmp (curmap) $mn)) [
|
||||
// finish stage and save changes
|
||||
savemap
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
@@ -323,7 +395,7 @@ if (! (checkalias cmcur)) [ // execute this only once
|
||||
]
|
||||
if (! $abort) [ echo "\f0Finished map conversion up to stage \f1" $cmstage ]
|
||||
if (&& $abort (strlen (enumtodoentities))) [ sleep 1000 "if (! $editing) edittoggle ; showmenu [TODO entities]" ]
|
||||
pop n abort
|
||||
pop n abort stagefail
|
||||
]
|
||||
]
|
||||
|
||||
@@ -371,7 +443,7 @@ if (! (checkalias cmcur)) [ // execute this only once
|
||||
]
|
||||
|
||||
const cm_dostage_FIXUNASSIGNEDS [ // pause on maps with unassigned map models or -sounds
|
||||
if (entstats) [ abort = 1 ]
|
||||
if (entstats) [ stagefail = 1 ]
|
||||
]
|
||||
|
||||
const cm_dostage_FIXBADENTS [ // pause on maps with entities with illegal attributes
|
||||
@@ -380,7 +452,7 @@ if (! (checkalias cmcur)) [ // execute this only once
|
||||
if (&& (&& (!= $a 0) (!= $a 1)) (!= $a 100)) [
|
||||
echo (concatword "playerstart entity #" $i " has an illegal attr2 value (" $a ") - allowed are 0, 1 and 100")
|
||||
addtodoentity $i (concatword "illegal attr2 value (" $a ") - allowed are 0, 1 and 100")
|
||||
abort = 1
|
||||
stagefail = 1
|
||||
]
|
||||
pop a
|
||||
]
|
||||
@@ -389,7 +461,7 @@ if (! (checkalias cmcur)) [ // execute this only once
|
||||
if (&& (!= $a 0) (!= $a 1)) [
|
||||
echo (concatword "ctf-flag entity #" $i " has an illegal attr2 value (" $a ") - allowed are 0 and 1")
|
||||
addtodoentity $i (concatword "illegal attr2 value (" $a ") - allowed are 0 and 1")
|
||||
abort = 1
|
||||
stagefail = 1
|
||||
]
|
||||
pop a
|
||||
]
|
||||
@@ -401,24 +473,24 @@ if (! (checkalias cmcur)) [ // execute this only once
|
||||
]
|
||||
if (pop t) [
|
||||
addtodoentity $i "unused entity attribute has non-zero value"
|
||||
abort = 1
|
||||
stagefail = 1
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
|
||||
const cm_dostage_MANUALERRORS [ // pause on all maps with any errors left
|
||||
if $arg4 [ abort = 1 ]
|
||||
if $arg4 [ stagefail = 1 ]
|
||||
]
|
||||
|
||||
const cm_dostage_MANUALEDITING [ // pause on all maps
|
||||
abort = 1
|
||||
stagefail = 1
|
||||
]
|
||||
|
||||
const cm_dostage_REDUCECLIPS [ // automatically un-clip mapmodels if possible
|
||||
uncliptagclippedmodels
|
||||
unclipentclippedmodels
|
||||
duplicateclippedslots_cleanup
|
||||
if (|| (uncliptagclippedmodels) (unclipentclippedmodels)) [
|
||||
if $dryrun [stagefail = 1] [duplicateclippedslots_cleanup]
|
||||
]
|
||||
]
|
||||
|
||||
const cm_dostage_FIXPICKUPFHF [ // pause on maps with entities with pickups elevated by unnecessary heightfields
|
||||
@@ -436,7 +508,7 @@ if (! (checkalias cmcur)) [ // execute this only once
|
||||
]
|
||||
if (&& $v (! (&b $v 3))) [ // only mark elevations by whole cube sizes
|
||||
addtodoentity $i "pickup entity elevated old-style, use attr1 instead"
|
||||
abort = 1
|
||||
stagefail = 1
|
||||
]
|
||||
pop v entinfo
|
||||
]
|
||||
@@ -451,12 +523,19 @@ if (! (checkalias cmcur)) [ // execute this only once
|
||||
selectionwalk [ += t $sw_type ]
|
||||
if (&& (! (pop t)) (strlen (selx))) [
|
||||
addtodoentity $i "entity placed in solid cubes"
|
||||
abort = 1
|
||||
stagefail = 1
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
|
||||
const cm_dostage_CHECKVANTAGEPOINTS [ // check for vantage points, abort if there's no valid one
|
||||
if (! gotovantagepoint) [
|
||||
echo "\t\t\f9No vantage point set."
|
||||
stagefail = 1
|
||||
]
|
||||
]
|
||||
|
||||
const cmfixmapmodelpaths [
|
||||
push cnt 0
|
||||
push ispre12 0
|
||||
|
||||
@@ -152,6 +152,8 @@ tempalias duplicateclippedslots_cleanup [
|
||||
]
|
||||
]
|
||||
|
||||
tempalias dryrun 0
|
||||
|
||||
// un-clip models that are fully in tagclipped areas
|
||||
// uncliptagclippedmodels
|
||||
echo "\fs\f2uncliptagclippedmodels\fr\tun-clip models that are fully in tagclipped areas"
|
||||
@@ -169,20 +171,24 @@ tempalias uncliptagclippedmodels [
|
||||
selectionwalk [ if (&& (! (&b 0x40 $sw_tag)) $sw_type) [ += unclipped 1 ] ]
|
||||
if (&& (! (at $slotinfo 0)) (< $unclipped 4)) [ unclipped = 0 ] // radius 0 is fine, if there is at least 1 tagclip
|
||||
if (! $unclipped) [
|
||||
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
|
||||
unclipped = -1
|
||||
break
|
||||
if $dryrun [
|
||||
addtodoentity $i (concat $slotinfo can be unclipped by uncliptagclippedmodels)
|
||||
][
|
||||
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
|
||||
unclipped = -1
|
||||
break
|
||||
]
|
||||
]
|
||||
if (! $unclipped) [
|
||||
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
|
||||
]
|
||||
if (! $unclipped) [
|
||||
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
|
||||
]
|
||||
pop unclipped radius
|
||||
@@ -219,20 +225,24 @@ tempalias unclipentclippedmodels [
|
||||
*= 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 $dryrun [
|
||||
addtodoentity $i (concat $slotinfo can be unclipped by unclipentclippedmodels)
|
||||
][
|
||||
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
|
||||
]
|
||||
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
|
||||
]
|
||||
|
||||
@@ -1544,7 +1544,7 @@ void enumalias(char *prefix)
|
||||
size_t np = strlen(prefix);
|
||||
enumerate(*idents, ident, id, if(id.type == ID_ALIAS && id.persist && !id.isconst && !id.istemp && !strncmp(id.name, prefix, np)) sids.add(&id); );
|
||||
sids.sort(sortident);
|
||||
loopv(sids) cvecprintf(res, "%s %s\n", sids[i]->name, sids[i]->name + np);
|
||||
loopv(sids) cvecprintf(res, "%s %s\n", escapestring(sids[i]->name, false), escapestring(sids[i]->name + np, false));
|
||||
resultcharvector(res, -1);
|
||||
}
|
||||
COMMAND(enumalias, "s");
|
||||
|
||||
@@ -113,7 +113,7 @@ void mapmodel(int *rad, int *h, int *zoff, char *scale, char *name, char *flags)
|
||||
{
|
||||
if(*scale && *name) // ignore "mapmodel" commands with insufficient parameters
|
||||
{
|
||||
if(!_ignoreillegalpaths && !strchr(name, '/') && !strchr(name, '\\')) { flagmapconfigerror(LWW_CONFIGERR * 2); scripterr(); } // throw errors for unconverted mapmodels (unspecific, because not all get detected)
|
||||
if(!_ignoreillegalpaths && !strchr(name, '/') && !strchr(name, '\\')) { flagmapconfigerror(LWW_CONFIGERR * 2); } // throw errors for unconverted mapmodels (unspecific, because not all get detected)
|
||||
intret(mapmodels.length());
|
||||
mapmodelinfo &mmi = mapmodels.add();
|
||||
mmi.rad = *rad;
|
||||
|
||||
Reference in New Issue
Block a user