automatic mapmodel menus

auto-generate mapmodel menus depending on the actually available models
in the current map config.

Also fixes memory leak in "newmenu".

DOCREF mapmodelname mapmodelbyname mapmodelchanged
This commit is contained in:
ac-stef
2015-04-12 18:09:36 +02:00
parent f511889731
commit 57a0d286c1
3 changed files with 309 additions and 280 deletions
+272 -260
View File
@@ -163,266 +163,6 @@ menuitemslider (_ [Blue pigment: ]) 1 255 "$bluew" 5 [] [ bluew = $arg1 ]
menuitem [] -1
menuitem (concatword (c 2) [ ] "[ OK ]") [ watercolour $redw $greenw $bluew ]
//Mapmodels
newmenu Mapmodels
menuitem (_ Platforms) [ showmenu Platforms ]
menuitem (_ [Ladders/Stairs]) [ showmenu Ladders/Stairs ]
menuitem (_ Fencing) [ showmenu Fencing ]
menuitem (_ Plants) [ showmenu Plants ]
menuitem (_ Lights) [ showmenu Lights ]
menuitem (_ Street) [ showmenu Street ]
menuitem (_ Pipes) [showmenu Pipes]
menuitem (_ Office) [ showmenu Office ]
menuitem (_ Computers) [ showmenu Computers ]
menuitem (_ Home) [ showmenu Home ]
menuitem (_ Industrial) [ showmenu Industrial ]
menuitem (_ Military) [ showmenu Military ]
menuitem (_ Signs) [ showmenu Signs ]
menuitem (_ Other) [ showmenu Other ]
newmenu Platforms
menuitem (_ [Bridge (8x8)]) [ saycommand "/newent mapmodel 1 " ]
menuitem (_ [Platform (8x8)]) [ saycommand "/newent mapmodel 57 " ]
menuitem (_ [Wire platform (8x8)]) [ saycommand "/newent mapmodel 73 " ]
menuitem (_ [Ledge (4x1)]) [ saycommand "/newent mapmodel 155 " ]
menuitem (_ [Ledge (8x1)]) [ saycommand "/newent mapmodel 156 " ]
menuitem (_ [Ledge (16x1)]) [ saycommand "/newent mapmodel 157 " ]
menuitem (_ [Ledge Corner]) [ saycommand "/newent mapmodel 158 " ]
newmenu Ladders/Stairs
menuitem (_ [Single ladder rung (1)]) [ saycommand "/newent mapmodel 58 " ]
menuitem (_ [Ladder(7)]) [ newent mapmodel 2 ]
menuitem (_ [Ladder(8)]) [ newent mapmodel 3 ]
menuitem (_ [Ladder(10)]) [ newent mapmodel 4 ]
menuitem (_ [Ladder(11)]) [ newent mapmodel 5 ]
menuitem (_ [Ladder(15)]) [ newent mapmodel 6 ]
menuitem [] -1
menuitem (_ [Hangable Ladder (2)]) [ saycommand "/newent mapmodel 136 " ]
menuitem (_ [Hangable Ladder (6)]) [ saycommand "/newent mapmodel 137 " ]
menuitem (_ [Hangable Ladder (Top, Over)]) [ saycommand "/newent mapmodel 138 " ]
menuitem (_ [Hangable Ladder (Top, Side)]) [ saycommand "/newent mapmodel 139 " ]
menuitem (_ [Hangable Ladder (Bottom)]) [ saycommand "/newent mapmodel 140 " ]
menuitem [] -1
menuitem (_ [Wire stairs (Top)]) [ saycommand "/newent mapmodel 79 " ]
menuitem (_ [Wire stairs (Bottom)]) [ saycommand "/newent mapmodel 80 " ]
newmenu Home
// Some of these models are doubled-up in the office menu.
menuitem (_ [Picture frame]) [ saycommand "/newent mapmodel 29 " ]
menuitem (_ Milk) [ newent mapmodel 69 ]
menuitem (_ [CRT TV]) [ newent mapmodel 86 ]
menuitem (_ [CRT TV in stand]) [ saycommand "/newent mapmodel 70 " ]
menuitem (_ [Plasma TV]) [ newent mapmodel 72 ]
menuitem (_ [Power meter]) [ newent mapmodel 74 ]
menuitem (_ Rack) [ newent mapmodel 75 ]
menuitem (_ [Utility table]) [ newent mapmodel 87 ]
menuitem (_ [Ceiling fan]) [ saycommand "/newent mapmodel 113 " ]
menuitem (_ Window) [ newent mapmodel 126 ]
menuitem (_ Shelf) [ newent mapmodel 128 ]
menuitem (_ [Wall switch]) [ saycommand "/newent mapmodel 150 " ]
menuitem (_ [Wall power outlet]) [ saycommand "/newent mapmodel 151 " ]
newmenu Military
menuitem (_ Bullet) [ newent mapmodel 61 ]
menuitem (_ [Shotgun shell]) [ newent mapmodel 78 ]
menuitem (_ Target) [ newent mapmodel 100 ]
menuitem (_ [Radar console]) [ newent mapmodel 76 ]
menuitem (_ [Razor wire]) [ newent mapmodel 116 ]
menuitem (_ [Guard tower]) [ newent mapmodel 129 ] [ echo (c 3) (_ [This mapmodel will need to be properly clipped!]) ]
menuitem (_ [Weapon rack]) [ newent mapmodel 183 ]
newmenu Computers
menuitem (_ Laptop) [ newent mapmodel 28 ]
menuitem (_ PC) [ newent mapmodel 101 ]
menuitem (_ [Computer interfaces]) [ newent mapmodel 65 ]
menuitem (_ [Communications rack]) [ newent mapmodel 63 ]
menuitem (_ [Communications rack 2]) [ newent mapmodel 64 ]
menuitem (_ [Server rack]) [ newent mapmodel 119 ]
menuitem (_ [Server cluster 1]) [ saycommand "/newent mapmodel 120 " ]
menuitem (_ [Server cluster 2]) [ saycommand "/newent mapmodel 121 " ]
menuitem (_ [Server cluster 3]) [ saycommand "/newent mapmodel 122 " ]
menuitem (_ [Server cluster 4]) [ saycommand "/newent mapmodel 123 " ]
menuitem (_ [Server cluster 5]) [ saycommand "/newent mapmodel 124 " ]
menuitem (_ [Server cluster 6]) [ saycommand "/newent mapmodel 125 " ]
newmenu Street
menuitem (_ [Park Bench]) [ newent mapmodel 9 ]
menuitem (_ Dumpster) [ newent mapmodel 10 ]
menuitem (_ Trashbag) [ newent mapmodel 84 ]
menuitem (_ Trashcan) [ newent mapmodel 85 ]
menuitem (_ Roadblock/Barrier) [ newent mapmodel 11 ]
menuitem (_ [Roadblock/Barrier 2]) [ newent mapmodel 12 ]
menuitem (_ [Barrier 3]) [ newent mapmodel 168 ]
menuitem (_ Cone) [ newent mapmodel 173 ]
menuitem (_ [Fallen cone]) [ newent mapmodel 174 ]
menuitem (_ [Wheel: Vertical]) [ newent mapmodel 88 ]
menuitem (_ [Tyre: Horizontal]) [ newent mapmodel 83 ]
menuitem (_ [Gray milk crate]) [ newent mapmodel 112 ]
menuitem (_ [Red milk crate]) [ newent mapmodel 134 ]
menuitem (_ [Blue milk crate]) [ newent mapmodel 135 ]
menuitem (_ [Car battery]) [ newent mapmodel 152 ]
menuitem (_ Antenna) [ newent mapmodel 153 ]
menuitem (_ [Hotel sign]) [ saycommand "/newent mapmodel 169 " ]
menuitem (_ [Fire alarm]) [ saycommand "/newent mapmodel 184 " ]
menuitem (_ [Electric box (1)]) [ newent mapmodel 186 ]
menuitem (_ [Electric box (2)]) [ newent mapmodel 187 ]
const tree_warning (concatword (c 3) (_ [Trees are expensive mapmodels. Please only use a maximum of 1 or 2 in a map.]))
newmenu Plants
menuitem (_ [Grass 1]) [ newent mapmodel 17 ]
menuitem (_ [Grass 1 (Dry)]) [ newent mapmodel 18 ]
menuitem (_ [Grass 1 (Snow)]) [ newent mapmodel 19 ]
menuitem (_ [Grass 2]) [ newent mapmodel 20 ]
menuitem (_ [Grass 2 (Dry)]) [ newent mapmodel 21 ]
menuitem (_ [Grass 2 (Snow)]) [ newent mapmodel 22 ]
menuitem (_ [Plant 1]) [ newent mapmodel 23 ]
menuitem (_ [Plant 1 (Dry)]) [ newent mapmodel 24 ]
menuitem (_ [Plant 1 (Snow)]) [ newent mapmodel 25 ]
menuitem (_ [Tree trunk]) [ newent mapmodel 130 ]
menuitem (_ [Tree 1]) [ newent mapmodel 114 ] [ echo $tree_warning ]
menuitem (_ [Tree 2]) [ newent mapmodel 117 ] [ echo $tree_warning ]
menuitem (_ [Pine tree]) [ newent mapmodel 118 ] [ echo $tree_warning ]
menuitem (_ [Palm tree]) [ newent mapmodel 115 ] [ echo $tree_warning ]
menuitem (_ Bush) [newent mapmodel 170]
menuitem (_ [Small tree]) [newent mapmodel 171]
menuitem (_ Grasses) [newent mapmodel 172]
newmenu Office
menuitem (_ [Office chair]) [ newent mapmodel 27 ]
menuitem (_ Locker) [ newent mapmodel 30 ]
menuitem (_ [Air Conditioner (Outer)]) [ newent mapmodel 60 ]
menuitem (_ [Air Conditioner (Inner)]) [ newent mapmodel 107 ]
menuitem (_ [Office desk]) [ newent mapmodel 71 ]
menuitem (_ [Ceiling fan]) [ saycommand "/newent mapmodel 113 " ]
menuitem (_ [Wall switch]) [ saycommand "/newent mapmodel 150 " ]
menuitem (_ [Wall power outlet]) [ saycommand "/newent mapmodel 151 " ]
menuitem (_ Pinboard) [ saycommand "/newent mapmodel 154 " ]
menuitem (_ [Fire extinguisher]) [ newent mapmodel 175 ]
menuitem (_ [Fire extinguisher box]) [ newent mapmodel 182 ]
menuitem (_ [Dropped ceiling, frame]) [ saycommand "/newent mapmodel 177 " ]
menuitem (_ [Dropped ceiling, tiles]) [ saycommand "/newent mapmodel 178 " ]
menuitem (_ [Dropped ceiling, single]) [ saycommand "/newent mapmodel 179 " ]
menuitem (_ [Dropped ceiling, light 1]) [ saycommand "/newent mapmodel 180 " ]
menuitem (_ [Dropped ceiling, light 2]) [ saycommand "/newent mapmodel 181 " ]
menuitem (_ [World map]) [ saycommand "/newent mapmodel 185 " ]
newmenu Pipes
menuitem (_ [Large concrete pipe]) [ newent mapmodel 108 ]
menuitem (_ [Medium metal pipe]) [ newent mapmodel 109 ]
menuitem (_ [Small metal pipe]) [ newent mapmodel 110 ]
menuitem (_ Drainpipe) [ newent mapmodel 59 ]
menuitem (_ [Closed pipe, horz]) [ saycommand "/newent mapmodel 144" ]
menuitem (_ [Closed pipe, l-down]) [ saycommand "/newent mapmodel 145" ]
menuitem (_ [Closed pipe, l-left]) [ saycommand "/newent mapmodel 146" ]
menuitem (_ [Closed pipe, l-right]) [ saycommand "/newent mapmodel 147" ]
menuitem (_ [Closed pipe, l-up]) [ saycommand "/newent mapmodel 148" ]
menuitem (_ [Closed pipe, vert]) [ saycommand "/newent mapmodel 149" ]
newmenu Lights
menuitem (_ Strahler) [ saycommand /newent mapmodel 31 ]
menuitem (_ [Fluorescent lamp]) [ saycommand "/newent mapmodel 32 " ]
menuitem (_ LightBulb) [ saycommand "/newent mapmodel 33 " ]
menuitem (_ [Hanging lamp]) [ saycommand "/newent mapmodel 132 " ]
menuitem (_ [Alarm lamp]) [ saycommand "/newent mapmodel 141 " ]
menuitem (_ [Plate lamp]) [ saycommand "/newent mapmodel 142 " ]
menuitem (_ [Street light]) [ newent mapmodel 7 ]
menuitem (_ [Street light (2)]) [ newent mapmodel 143 ]
newmenu Industrial
menuitem (_ Barrel) [ newent mapmodel 34 ]
menuitem (_ [Knocked-over barrel]) [ newent mapmodel 35 ]
menuitem (_ [Electric meter]) [ newent mapmodel 36 ]
menuitem (_ Pallette) [ newent mapmodel 37 ]
menuitem (_ Gastank) [ newent mapmodel 38 ]
menuitem (_ [Grate (horizontal)]) [ newent mapmodel 39 ]
menuitem (_ [Grate (vertical)]) [ newent mapmodel 40 ]
menuitem (_ Wrench) [ newent mapmodel 41 ]
menuitem (_ Bolt) [ newent mapmodel 42 ]
menuitem (_ Hook) [ newent mapmodel 52 ]
menuitem (_ Cinderblock) [ newent mapmodel 62 ]
menuitem (_ [Radioactive drum]) [ newent mapmodel 81 ]
menuitem (_ [Knocked-over radioactive drum]) [ newent mapmodel 82 ]
menuitem (_ [Swiveling security camera]) [ saycommand "/newent mapmodel 77 " ]
menuitem (_ [Camera mount (Vertical)]) [ saycommand "/newent mapmodel 104 " ]
menuitem (_ [Camera mount (Wall)]) [ saycommand "/newent mapmodel 105 " ]
menuitem (_ [Vent flap]) [ newent mapmodel 133 ]
menuitem (_ [Pickaxe, horz]) [ newent mapmodel 164 ]
menuitem (_ [Pickaxe, vert]) [ newent mapmodel 165 ]
menuitem (_ [Shovel, vert]) [ newent mapmodel 188 ]
menuitem (_ [Shovel, free-standing]) [ newent mapmodel 189 ]
menuitem (_ [Shovel, horz]) [ newent mapmodel 190 ]
newmenu Fencing
menuitem (_ [Wire fence]) [ newent mapmodel 13 ]
menuitem (_ [Wire fencepost]) [ newent mapmodel 14 ]
menuitem (_ [Open wire fence-gate]) [ newent mapmodel 15 ]
menuitem (_ [Closed wire fence-gate]) [ newent mapmodel 16 ]
menuitem (_ [Barbwire fence-top]) [ newent mapmodel 127 ]
menuitem [] -1
menuitem (_ [Corrugated fence]) [ newent mapmodel 102 ]
menuitem (_ [Corrugated fence 2]) [ newent mapmodel 103 ]
menuitem (_ [Corrugated fence post]) [ newent mapmodel 66 ]
menuitem [] -1
menuitem (_ [Guard rail]) [ newent mapmodel 67 ]
menuitem (_ [Guard rail 2]) [ newent mapmodel 68 ]
menuitem (_ [Guard rail pole]) [ newent mapmodel 106 ]
newmenu Signs
menuitem (_ Flammable) [ saycommand "/newent mapmodel 43 " ]
menuitem (_ [Speed Limit 5]) [ saycommand "/newent mapmodel 44 " ]
menuitem (_ Maintenance) [ saycommand "/newent mapmodel 45 " ]
menuitem (_ Caution) [ saycommand "/newent mapmodel 46 " ]
menuitem (_ Biohazard) [ saycommand "/newent mapmodel 47 " ]
menuitem (_ Toxic) [ saycommand "/newent mapmodel 92 " ]
menuitem (_ [Biohazard (2)]) [ saycommand "/newent mapmodel 89 " ]
menuitem (_ Chemicals) [ saycommand "/newent mapmodel 90 " ]
menuitem (_ [Confined space]) [ saycommand "/newent mapmodel 91 " ]
menuitem (_ [Do not enter!]) [ saycommand "/newent mapmodel 93 " ]
menuitem (_ Explosives) [ saycommand "/newent mapmodel 94 " ]
menuitem (_ [First aid]) [ saycommand "/newent mapmodel 95 " ]
menuitem (_ [No entry]) [ saycommand "/newent mapmodel 96 " ]
menuitem (_ [No smoking]) [ saycommand "/newent mapmodel 97 " ]
menuitem (_ Radioactive) [ saycommand "/newent mapmodel 98 " ]
menuitem (_ [Restricted area]) [ saycommand "/newent mapmodel 99 " ]
menuitem (_ Arab) [ saycommand "/newent mapmodel 111 " ]
menuitem (_ [Wanted Poster]) [ saycommand "/newent mapmodel 55 " ]
newmenu Other
menuitem (_ Cigarette) [ newent mapmodel 48 ]
menuitem (_ Can) [ newent mapmodel 49 ]
menuitem (_ [Fallen Can]) [ newent mapmodel 50 ]
menuitem (_ [Broken Wood]) [ newent mapmodel 51 ]
menuitem (_ Coffee) [ newent mapmodel 53 ]
menuitem (_ Flyer) [ newent mapmodel 54 ]
menuitem (_ [Tree Flyer]) [ newent mapmodel 26 ]
menuitem (_ [Potato box]) [ newent mapmodel 56 ]
menuitem (_ [Cardboard box]) [ newent mapmodel 131 ]
menuitem (_ [Chinese take-out]) [ newent mapmodel 159 ]
menuitem (_ [Plastic bottle]) [ newent mapmodel 160 ]
menuitem (_ [Squashed plastic bottle]) [ newent mapmodel 161 ]
menuitem (_ [Plastic bag, white]) [ newent mapmodel 162 ]
menuitem (_ [Plastic bag, yellow]) [ newent mapmodel 163 ]
menuitem (_ [Newspaper (1)]) [ newent mapmodel 166 ]
menuitem (_ [Newspaper (2)]) [ newent mapmodel 167 ]
menuitem (_ Paintcan) [ newent mapmodel 176 ]
newmenu [Ambient sounds]
menuinit [ ambientsoundmenu = [] ]
@@ -491,4 +231,276 @@ menuitemcheckbox (_ [Enable auto save map: ]) "$autosavemap" [ autosavemap = $ar
menuitemslider (_ [Time between auto saves (in minutes): ]) 2 60 "(div $timeBetAutoSaves 60000)" 1 [] [ timeBetAutoSaves = (* $arg1 60000) ]
menuitemtextinput (_ [Make a map backup (.BAK) every: ]) "$numAutoSaveBackups" [ numAutoSaveBackups = $arg1 ] [ if (! $showedBAKinfo) [ echo This setting effects the number of autosavemaps between making a map backup file. "(.BAK)"; showedBAKinfo = 1 ] ] 4
//Mapmodels
newmenu Mapmodels
menuinit __rebuildmapmodelmenus
tempalias __mapmodelmenulist [
Platforms "" ""
"Bridge (8x8)" _1 makke/platform_bridge
"Platform (8x8)" _1 makke/platform
"Wire platform (8x8)" _1 toca/platformmet
"Ledge (4x1)" _1 toca/ledge/1_4cbs
"Ledge (8x1)" _1 toca/ledge/2_8cbs
"Ledge (16x1)" _1 toca/ledge/3_16cbs
"Ledge Corner" _1 toca/ledge/4_corner
Ladders/Stairs "" ""
"Single ladder rung (1)" _1 makke/ladder_1x
"Ladder(7)" _0 makke/ladder_7x
"Ladder(8)" _0 makke/ladder_8x
"Ladder(10)" _0 makke/ladder_10x
"Ladder(11)" _0 makke/ladder_11x
"Ladder(15)" _0 makke/ladder_15x
"" _0 --
"Hangable Ladder (2)" _1 misterfloppy/hanging_ladder/ladder_2
"Hangable Ladder (6)" _1 misterfloppy/hanging_ladder/ladder_6
"Hangable Ladder (Top, Over)" _1 misterfloppy/hanging_ladder/ladder_top
"Hangable Ladder (Top, Side)" _1 misterfloppy/hanging_ladder/ladder_up
"Hangable Ladder (Bottom)" _1 misterfloppy/hanging_ladder/ladder_low
"" _0 --
"Wire stairs (Top)" _1 toca/stairs1
"Wire stairs (Bottom)" _1 toca/stairs2
Fencing "" ""
"Wire fence" _0 makke/fence_chainlink
"Wire fencepost" _0 makke/fence_chainlink_post
"Open wire fence-gate" _0 makke/fence_chainlink_no_gate
"Closed wire fence-gate" _0 makke/fence_chainlink_closed_gate
"Barbwire fence-top" _0 toca/barbwire
"" _0 --
"Corrugated fence" _0 toca/corrugated/fence1
"Corrugated fence 2" _0 toca/corrugated/fence2
"Corrugated fence post" _0 toca/corrugated/beam
"" _0 --
"Guard rail" _0 toca/guardrail
"Guard rail 2" _0 toca/guardrail2
"Guard rail pole" _0 toca/guardrail2/gr2pole
Plants "" ""
"Grass 1" _0 makke/grass_short
"Grass 1 (Dry)" _0 makke/grass_short_dry
"Grass 1 (Snow)" _0 makke/grass_short_snow
"Grass 2" _0 makke/grass_long
"Grass 2 (Dry)" _0 makke/grass_long_dry
"Grass 2 (Snow)" _0 makke/grass_long_snow
"Plant 1" _0 makke/plant_leafy
"Plant 1 (Dry)" _0 makke/plant_leafy_dry
"Plant 1 (Snow)" _0 makke/plant_leafy_snow
"Tree trunk" _0 toca/treetrunk1
"Tree 1" _2 toca/tree1
"Tree 2" _2 toca/tree2
"Pine tree" _2 toca/pine
"Palm tree" _2 toca/palmtree1
"Bush" _0 toca/plants/bush
"Small tree" _0 toca/plants/smaltree
"Grasses" _0 toca/plants/grass
Lights "" ""
"Strahler" _1 makke/wall_spotlight
"Fluorescent lamp" _1 makke/fluorescent_lamp
"LightBulb" _1 makke/lightbulb
"Hanging lamp" _1 jcdpc/hanginglamp
"Alarm lamp" _1 misterfloppy/alarmlamp
"Plate lamp" _1 misterfloppy/platelamp
"Street light" _0 makke/street_light
"Street light (2)" _0 misterfloppy/streetlamp
Street "" ""
"Park Bench" _0 makke/bench_seat
"Dumpster" _0 makke/dumpster
"Trashbag" _0 toca/trashbag
"Trashcan" _0 toca/trashcan
"Roadblock/Barrier" _0 makke/roadblock
"Roadblock/Barrier 2" _0 makke/roadblock_graffiti
"Barrier 3" _0 toca/cautionsign
"Cone" _0 cleaner/traffic_cones/up
"Fallen cone" _0 cleaner/traffic_cones/down
"Wheel: Vertical" _0 toca/wheel
"Tyre: Horizontal" _0 toca/tyre
"Gray milk crate" _0 toca/milkcrate
"Red milk crate" _0 ratboy/toca_milkcrate_red
"Blue milk crate" _0 ratboy/toca_milkcrate_blue
"Car battery" _0 toca/carbattery
"Antenna" _0 toca/antenna
"Hotel sign" _1 cleaner/hotel_sign
"Fire alarm" _1 cleaner/alarm_bell
"Electric box (1)" _0 cleaner/elecbox/elecbox1
"Electric box (2)" _0 cleaner/elecbox/elecbox2
Pipes "" ""
"Large concrete pipe" _0 toca/pipes/concretepipe
"Medium metal pipe" _0 toca/pipes/metalpipe
"Small metal pipe" _0 toca/pipes/metalpipe2
"Drainpipe" _0 makke/drainpipe
"Closed pipe, horz" _1 toca/pipes/industrialpipes/horz
"Closed pipe, l-down" _1 toca/pipes/industrialpipes/ldwn
"Closed pipe, l-left" _1 toca/pipes/industrialpipes/lleft
"Closed pipe, l-right" _1 toca/pipes/industrialpipes/lright
"Closed pipe, l-up" _1 toca/pipes/industrialpipes/lup
"Closed pipe, vert" _1 toca/pipes/industrialpipes/vert
Office "" ""
"Office chair" _0 makke/office_chair
"Locker" _0 makke/locker
"Air Conditioner (Outer)" _0 toca/airconditioner
"Air Conditioner (Inner)" _0 toca/airconditioner/interior
"Office desk" _0 toca/officedesk
"Ceiling fan" _1 toca/ceilingfan
"Wall switch" _1 toca/electric/switch
"Wall power outlet" _1 toca/electric/outlet
"Pinboard" _1 toca/pinboard
"Fire extinguisher" _0 cleaner/extinguisher
"Fire extinguisher box" _0 cleaner/extinguisher_box
"Dropped ceiling, frame" _1 toca/droppedceiling/frame
"Dropped ceiling, tiles" _1 toca/droppedceiling/tiles
"Dropped ceiling, single" _1 toca/droppedceiling/single
"Dropped ceiling, light 1" _1 toca/droppedceiling/light1
"Dropped ceiling, light 2" _1 toca/droppedceiling/light2
"World map" _1 cleaner/worldmap
Computers "" ""
"Laptop" _0 jcdpc/laptop
"PC" _0 toca/computer/pc
"Computer interfaces" _0 toca/computer/monkeymou
"Communications rack" _0 toca/commrack
"Communications rack 2" _0 toca/commrack2
"Server rack" _0 toca/servercluster/rack
"Server cluster 1" _1 toca/servercluster/U3_1
"Server cluster 2" _1 toca/servercluster/U3_2
"Server cluster 3" _1 toca/servercluster/U3_3
"Server cluster 4" _1 toca/servercluster/U6_1
"Server cluster 5" _1 toca/servercluster/U6_2
"Server cluster 6" _1 toca/servercluster/U6_3
Home "" ""
"Picture frame" _1 makke/picture
"Milk" _0 toca/milkcarton
"CRT TV" _0 toca/tv
"CRT TV in stand" _1 toca/monitor
"Plasma TV" _0 toca/plasmatv
"Power meter" _0 toca/powermeter
"Rack" _0 toca/rack
"Utility table" _0 toca/utilitytable
"Ceiling fan" _1 toca/ceilingfan
"Window" _0 toca/window1
"Shelf" _0 toca/shelf
"Wall switch" _1 toca/electric/switch
"Wall power outlet" _1 toca/electric/outlet
Industrial "" ""
"Barrel" _0 makke/barrel
"Knocked-over barrel" _0 makke/barrel_fallen
"Electric meter" _0 makke/electric_meter
"Pallette" _0 makke/pallet
"Gastank" _0 makke/fuel_tank
"Grate (horizontal)" _0 cleaner/grates/grate_hor
"Grate (vertical)" _0 cleaner/grates/grate_vert
"Wrench" _0 makke/wrench
"Bolt" _0 makke/bolt_nut
"Hook" _0 makke/hook
"Cinderblock" _0 toca/cinderblock
"Radioactive drum" _0 toca/radioactivedrum
"Knocked-over radioactive drum" _0 toca/radioactivedrum2
"Swiveling security camera" _1 toca/securitycam/secucam
"Camera mount (Vertical)" _1 toca/securitycam/vertmount
"Camera mount (Wall)" _1 toca/securitycam/wallmount
"Vent flap" _0 jcdpc/ventflap
"Pickaxe, horz" _0 toca/pickaxe/horz
"Pickaxe, vert" _0 toca/pickaxe/vert
"Shovel, vert" _0 cleaner/shovels/shovel1
"Shovel, free-standing" _0 cleaner/shovels/shovel2
"Shovel, horz" _0 cleaner/shovels/shovel3
Military "" ""
"Bullet" _0 toca/bullet
"Shotgun shell" _0 toca/sgshell
"Target" _0 toca/signs/target
"Radar console" _0 toca/radarconsole
"Razor wire" _0 toca/razorwire
"Guard tower" _0 toca/guardtower
"Weapon rack" _0 cleaner/laundry
Signs "" ""
"Flammable" _1 makke/signs/flammable
"Speed Limit 5" _1 makke/signs/speed
"Maintenance" _1 makke/signs/caution_maintainence
"Caution" _1 makke/signs/caution_voltage
"Biohazard" _1 makke/signs/biohazard
"Toxic" _1 toca/signs/toxic
"Biohazard (2)" _1 toca/signs/biohazard
"Chemicals" _1 toca/signs/chemical
"Confined space" _1 toca/signs/confined
"Do not enter!" _1 toca/signs/donotenter
"Explosives" _1 toca/signs/explosives
"First aid" _1 toca/signs/firstaid
"No entry" _1 toca/signs/noentry
"No smoking" _1 toca/signs/nosmoking
"Radioactive" _1 toca/signs/radioactive
"Restricted area" _1 toca/signs/restricted
"Arab" _1 makke/signs/arab
"Wanted Poster" _1 makke/signs/wanted
Other "" ""
"Cigarette" _0 makke/cigarette
"Can" _0 makke/coke_can
"Fallen Can" _0 makke/coke_can_fallen
"Broken Wood" _0 makke/broken_wood
"Coffee" _0 makke/coffee_mug
"Flyer" _0 makke/flyer_propaganda
"Tree Flyer" _0 makke/flyer_environmental
"Potato box" _0 makke/aardapple_enginebox
"Cardboard box" _0 toca/cardboardbox
"Chinese take-out" _0 toca/takeoutbox
"Plastic bottle" _0 toca/plasticbottles/1
"Squashed plastic bottle" _0 toca/plasticbottles/2
"Plastic bag, white" _0 toca/plasticbags/1
"Plastic bag, yellow" _0 toca/plasticbags/2
"Newspaper (1)" _0 toca/newspaper/1
"Newspaper (2)" _0 toca/newspaper/2
"Paintcan" _0 toca/paintcan
]
tempalias __treewarning [echo "\f3Trees are expensive mapmodels. Please don't use more than one or two in a map."]
tempalias __mm_unassigned [echo (yellow) sry: mapmodel (addpunct $arg1) has no slot assigned. Please edit your map config file.]
tempalias __mm_showmodel [concat chmenumdl $arg1 $arg2 all 40 3]
tempalias __rebuildmapmodelmenus [
if $mapmodelchanged [
push __mm_menus []
looplist $__mapmodelmenulist [title cmd path] [if (&& (! (strlen $path)) (< (findlist $__mm_menus $title) 0)) [__mm_menus = (concat $__mm_menus $title)]]
delmenu Mapmodels
newmenu Mapmodels
looplist $__mm_menus m [menuitem $m (concat showmenu $m) ; delmenu $m]
push _0 [concat newent mapmodel $arg1]
push _1 [concat saycommand (addpunct (concat /newent mapmodel $arg1))]
push _2 [concat __treewarning [;] newent mapmodel $arg1]
push __mm_done ""
push menu ""
push idxs ""
looplist $__mapmodelmenulist [title cmd path] [
if (! (strlen $path)) [
menu = $title
newmenu $menu
][
if (strlen $title) [
path = (concatword "mapmodels/" $path)
idxs = (mapmodelbyname $path)
if (listlen $idxs) [
__mm_done = (concat $__mm_done $idxs)
if (> (listlen $idxs) 1) [
looplist $idxs i [menuitem (concat $title (concatword "#" $i)) (cmd $i) (__mm_showmodel $menu $path)] // several slots for the same mapmodel
][
menuitem $title (cmd $idxs) (__mm_showmodel $menu $path) // usual case: one slot per model
]
][
menuitem (concatword "\f4" $title) (concat __mm_unassigned $path) (__mm_showmodel $menu $path) // mapmodel has no slot assigned
]
][
menuitem [] -1 (concat chmenumdl $menu) // blank line
]
]
]
push __mm_unsorted 0
delmenu Unsorted
newmenu Unsorted
loop i 256 [
if (&& (< (findlist $__mm_done $i) 0) (strlen (mapmodelname $i))) [
menuitem (format "%1 #%2" (mapmodelname $i) $i) (_1 $i) (__mm_showmodel Unsorted (mapmodelname $i))
__mm_unsorted = 1
]
]
if $__mm_unsorted [newmenu Mapmodels ; menuitem Unsorted "showmenu Unsorted"]
pop menu __mm_menus _0 _1 _2 __mm_done __mm_unsorted idxs
mapmodelchanged 0
]
]
persistidents 1
+25 -20
View File
@@ -813,25 +813,29 @@ struct mitemcheckbox : mitem
void *addmenu(const char *name, const char *title, bool allowinput, void (__cdecl *refreshfunc)(void *, bool), bool (__cdecl *keyfunc)(void *, int, bool, int), bool hotkeys, bool forwardkeys)
{
name = newstring(name);
gmenu &menu = menus[name];
menu.name = name;
menu.title = title;
menu.header = menu.footer = NULL;
menu.menusel = 0;
menu.mdl = NULL;
menu.allowinput = allowinput;
menu.inited = false;
menu.hotkeys = hotkeys;
menu.refreshfunc = refreshfunc;
menu.keyfunc = keyfunc;
menu.initaction = NULL;
menu.usefont = NULL;
menu.allowblink = false;
menu.dirlist = NULL;
menu.forwardkeys = forwardkeys;
lastmenu = &menu;
return &menu;
gmenu *m = menus.access(name);
if(!m)
{
name = newstring(name);
m = &menus[name];
m->name = name;
m->initaction = NULL;
m->header = m->footer = NULL;
}
m->title = title;
m->menusel = 0;
m->mdl = NULL;
m->allowinput = allowinput;
m->inited = false;
m->hotkeys = hotkeys;
m->refreshfunc = refreshfunc;
m->keyfunc = keyfunc;
m->usefont = NULL;
m->allowblink = false;
m->dirlist = NULL;
m->forwardkeys = forwardkeys;
lastmenu = m;
return m;
}
void newmenu(char *name, int *hotkeys, int *forwardkeys)
@@ -1199,9 +1203,10 @@ void rendermenumdl()
glScalef(1, -1, 1);
bool isplayermodel = !strncmp(m.mdl, "playermodels", strlen("playermodels"));
bool isweapon = !strncmp(m.mdl, "weapons", strlen("weapons"));
vec pos;
if(isplayermodel) pos = vec(2.0f, 1.2f, -0.4f);
if(!isweapon) pos = vec(2.0f, 1.2f, -0.4f);
else pos = vec(2.0f, 0, 1.7f);
float yaw = 1.0f;
+12
View File
@@ -86,6 +86,8 @@ void mdlcachelimit(int *limit)
COMMAND(mdlcachelimit, "i");
VAR(mapmodelchanged, 0, 0, 1);
vector<mapmodelinfo> mapmodels;
void mapmodel(int *rad, int *h, int *zoff, char *snap, char *name)
@@ -96,11 +98,13 @@ void mapmodel(int *rad, int *h, int *zoff, char *snap, char *name)
mmi.zoff = *zoff;
mmi.m = NULL;
formatstring(mmi.name)("mapmodels/%s", name);
mapmodelchanged = 1;
}
void mapmodelreset()
{
if(execcontext==IEXC_MAPCFG) mapmodels.shrink(0);
mapmodelchanged = 1;
}
mapmodelinfo &getmminfo(int i) { return mapmodels.inrange(i) ? mapmodels[i] : *(mapmodelinfo *)0; }
@@ -108,6 +112,14 @@ mapmodelinfo &getmminfo(int i) { return mapmodels.inrange(i) ? mapmodels[i] : *(
COMMAND(mapmodel, "iiiss");
COMMAND(mapmodelreset, "");
COMMANDF(mapmodelname, "i", (int *idx) { result(mapmodels.inrange(*idx) ? mapmodels[*idx].name : ""); });
COMMANDF(mapmodelbyname, "s", (char *name)
{
string res = "";
loopv(mapmodels) if(!strcmp(name, mapmodels[i].name)) concatformatstring(res, "%s%d", *res ? " " : "", i);
result(res);
});
hashtable<const char *, model *> mdllookup;
hashtable<const char *, char> mdlnotfound;