From 6454a645aed078173b64a8e706efe0b4b7944c4d Mon Sep 17 00:00:00 2001 From: ac-stef Date: Mon, 5 Oct 2015 16:20:19 +0200 Subject: [PATCH] new map checks and statistics menu Visualise the results of "mapareacheck". --- config/menus_edit.cfg | 78 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) diff --git a/config/menus_edit.cfg b/config/menus_edit.cfg index 48919a8a..c5f10f42 100644 --- a/config/menus_edit.cfg +++ b/config/menus_edit.cfg @@ -12,6 +12,7 @@ menuitem "Ambient sounds..." [ showmenu [Ambient sounds] ] menuitem "Arches and slopes..." [ showmenu Arches ] menuitem "Map operations..." [ showmenu [Map operations] ] menuitem "Map config operations..." [ showmenu [Map config operations] ] +menuitem "Map checks and statistics..." [ showmenu [Map checks and statistics] ] menuitem "Bots..." [ showmenu [Creating bot waypoints] ] menuitem "Settings..." [ showmenu [Editing settings] ] menuitem "Deleted entities" [ showmenu "deleted entities" ] @@ -185,6 +186,18 @@ menuitem "Sort mapsound slots..." [ showmenu [Sort mapsound slots] ] menuitem "" -1 menuitem "Update mapmodel menus" "mapmodelchanged 1" +// Map checks +newmenu [Map checks and statistics] +menuinit [ + resetmenu + if $editing [ + menuitem "Map area checks..." [ showmenu [Map area checks] ] + menuitem "Entity statistics" [ showmenu [Entity statistics] ] + ] [ + menuitem "menu only available in edit mode" -1 + ] +] + tempalias __lastwatchedmapmodel "" tempalias __mmslot "" @@ -800,4 +813,69 @@ tempalias _sndmenu_exec [ 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 [ + resetmenu + __placeprobepointdummies + menuitem "\f4(return to previous position)" (concat gotoposition (gotoposition)) (concat gotoposition (gotoposition)) + push i 0 + push ents (enumentities dummy) + looplist (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)) + += i 1 + ] + pop i ents +] + +push __a "resetmenu ; menuitem [\f4(return to previous position)] (concat gotoposition (gotoposition)) (concat gotoposition (gotoposition)) ;" +push __b "looplist $ents i [ menuitem (concatword # $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) +] +pop __a __b + +newmenu [Entity statistics] +menuinit [ + resetmenu + 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