convert_pre_v1.2_mapconfig.sh 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298
  1. #!/bin/bash
  2. # A simple script using SED to make map configs
  3. # compatible with the new layout.
  4. # KSH causes conflicts, allow BASH only:
  5. if [ -z "$(echo "$BASH")" ]; then
  6. echo "FAILURE: Please run this script with BASH, not SH/KSH/ZSH, etc"
  7. exit
  8. fi
  9. # HELP file:
  10. if [ "$1" = "-h" ] || [ "$1" = "--help" ] || [ "$1" = "" ]; then
  11. echo "Usage: "$0" MAP_CONFIG_FILE(S)"
  12. echo "This script will make a backup of specified map CFG files (into their existing"
  13. echo "directory), then using SED it will modify the original map CFG file to be"
  14. echo "compatible with the new packaging layout for AssaultCube."
  15. echo ""
  16. echo "It is suggested not to use this script twice on a file, as it may duplicate the"
  17. echo "changes which could cause many errors."
  18. echo ""
  19. echo "This script can accept multiple map CFG files at once, as well as wild cards, as"
  20. echo "well as files in different directories. For example:"
  21. echo " sh "$0" ../packages/maps/yourmap.cfg ../../mapfolder/*.cfg"
  22. echo ""
  23. echo "Options (must be placed before the CFG filenames):"
  24. echo "-h, --help This help message."
  25. echo "-r, --revert Revert specified config file(s) to the current \".BAK\" file."
  26. echo "-s, --strip Strips the specified config file(s) of comments, invalid commands,"
  27. echo " leading/trailing spaces/tabs and blank lines."
  28. echo " -os Same as --strip, but no compatibility conversion takes place."
  29. echo " -sp Same as --strip, but preserves any comments made before the"
  30. echo " mapmodelreset command."
  31. echo " -osp Same as --strip, but preserves any comments made before the"
  32. echo " mapmodelreset command AND no compatibility conversion takes place."
  33. exit
  34. # REVERT command:
  35. elif [ "$1" = "-r" ] || [ "$1" = "--revert" ]; then
  36. for file in "$@"; do
  37. if [ "$file" = "-r" ] || [ "$file" = "--revert" ]; then
  38. continue
  39. elif [[ -w "$file" && "$file" = *.cfg && -r "$file".BAK ]]; then
  40. mv -fv "$file".BAK "$file"
  41. else
  42. echo -e "\a\E[31m\033[1mERROR:\E[0m "$file" was unwriteable (or not a \".CFG\"), or "$file".BAK file was unreadable."
  43. exit
  44. fi
  45. done
  46. exit
  47. fi
  48. # Alias to define if anything failed (but the script continued).
  49. CONTFAILED="0"
  50. for file in "$@"; do
  51. if [[ -r "$file" && -w "$file" && "$file" = *.cfg ]] || [ "$file" = "-s" ] || [ "$file" = "--strip" ] || [ "$file" = "-os" ] || [ "$file" = "-sp" ] || [ "$file" = "-osp" ]; then
  52. if [ "$file" = "-s" ] || [ "$file" = "--strip" ] || [ "$file" = "-os" ] || [ "$file" = "-sp" ] || [ "$file" = "-osp" ]; then
  53. continue
  54. else
  55. # Backup files first:
  56. cp "$file" "$file".BAK
  57. if [ -r "$file".BAK ]; then
  58. echo "A successful backup of "$file" has been made to "$file".BAK"
  59. # Convert to UNIX new-line format, just in case.
  60. sed -i 's/^M$//' $file
  61. # This if-statement "strips" the files...
  62. if [ "$1" = "-s" ] || [ "$1" = "--strip" ] || [ "$1" = "-os" ] || [ "$1" = "-sp" ] || [ "$1" = "-osp" ]; then
  63. echo "Now stripping "$file" of comments, invalid commands, leading/trailing spaces/tabs and blank lines..."
  64. # 1) Remove comments.
  65. # 2) Remove unrequired "./" referencing of files.
  66. # 3) Remove leading/trailing spaces/tabs.
  67. # 4) Show ONLY lines starting with: loadnotexture loadsky mapmodelreset mapmodel texturereset texture fog fogcolour mapsoundreset mapsound watercolour shadowyaw
  68. # 5) Remove blank lines.
  69. # 6) IF ENABLED: Preserve comments made before the "mapmodelreset" command.
  70. sed -i 's/\/\/..*//g' $file
  71. sed -i 's/ ".\// "/g' $file
  72. sed -i 's/^[ \t]*//;s/[ \t]*$//' $file
  73. sed -ni '/^loadnotexture\|^loadsky\|^mapmodelreset\|^mapmodel\|^texturereset\|^texture\|^fog\|^fogcolour\|^mapsoundreset\|^mapsound\|^watercolour\|^shadowyaw/p' $file
  74. sed -i '/^$/d' $file
  75. if [ "$1" = "-sp" ] || [ "$1" = "-osp" ]; then
  76. # Create a working file...
  77. cp $file $file.tmp
  78. # Grab data before the "mapmodelreset" command (excluding that line) from the original file...
  79. sed '/^mapmodelreset/q' $file.BAK | sed '$d' > $file
  80. # Remove leading/trailing spaces/tabs from it...
  81. sed -i 's/^[ \t]*//;s/[ \t]*$//' $file
  82. # Keep only comments/new-lines from it...
  83. sed -ni '/^\/\/\|^$/p' $file
  84. # Paste/remove working file into normal file...
  85. cat $file.tmp >> $file && rm -f $file.tmp
  86. fi
  87. fi
  88. if [ "$1" = "-os" ] || [ "$1" = "-osp" ]; then
  89. echo -e "As requested, "$file" has been stripped and no compatibility conversion was made.\n"
  90. continue
  91. fi
  92. else
  93. echo -e "\a\E[31m\033[1mERROR:\E[0m Backup of "$file" failed. Please check files can be written in the \"`dirname $file`\" directory."
  94. echo -e "Please note, because backing up of "$file" failed, it was NOT converted and/or stripped.\n"
  95. CONTFAILED="1"
  96. continue
  97. fi
  98. fi
  99. # Check if this file has been converted before. If so, ask the user to be careful.
  100. CHECKIFDONE=`sed -n '/\/\/ This config file was converted by/p' $file | sed 's/was converted by..*//g'`
  101. if [ "$CHECKIFDONE" = "// This config file " ]; then
  102. echo -e "\n\aChecks indicate that this file has been converted before."
  103. echo "Continuing any further may cause this script to re-convert already converted parts of the map config."
  104. echo "This would cause many errors. Are you sure you wish to continue (Y/N)?"
  105. read ANSR
  106. if [ "$ANSR" = "n" ] || [ "$ANSR" = "N" ] || [ "$ANSR" = "" ]; then
  107. CONTFAILED="1"
  108. echo -e "\a\E[31m\033[1mERROR:\E[0m You've selected not to convert "$file", as it has already been converted."
  109. continue
  110. fi
  111. fi
  112. # Remove the old comment before adding the new one...
  113. sed -i '/This config file was converted/d' $file
  114. echo -e "\n// This config file was converted by "$0" on `date +%c`." >> $file
  115. echo "Now converting "$file" to a compatible map config file..."
  116. echo "Converting mapmodels..."
  117. sed -i '/mapmodel/s/\<laptop1\>/jcdpc\/laptop/1' $file
  118. sed -i '/mapmodel/s/\<rattrap\/cbbox\>/toca\/cardboardbox/1' $file
  119. sed -i '/mapmodel/s/\<rattrap\/rbbox\>/ratboy\/toca_cardboardbox_reskin/1' $file
  120. sed -i '/mapmodel/s/\<rattrap\/hanginlamp\>/jcdpc\/hanginglamp/1' $file
  121. sed -i '/mapmodel/s/\<rattrap\/ventflap\>/jcdpc\/ventflap/1' $file
  122. sed -i '/mapmodel/s/\<rattrap\/milkcrate2\>/ratboy\/toca_milkcrate_blue/1' $file
  123. sed -i '/mapmodel/s/\<rattrap\/milkcrate1\>/ratboy\/toca_milkcrate_red/1' $file
  124. sed -i '/mapmodel/s/\<aard\>/makke\/aardapple_enginebox/1' $file
  125. sed -i '/toxic/!s/\<barrel\>/makke\/barrel/1' $file
  126. sed -i '/mapmodel/s/\<barrel2\>/makke\/barrel_fallen/1' $file
  127. sed -i '/mapmodel/s/\<barrel-toxic\>/makke\/barrel_toxic/1' $file
  128. sed -i '/mapmodel/s/\<rattrapbarrel\>/makke\/barrel_newsteel/1' $file
  129. sed -i '/mapmodel/s/\<rattrapbarrel2\>/makke\/barrel_newsteel_fallen/1' $file
  130. sed -i '/mapmodel/s/\<bench\>/makke\/bench_seat/1' $file
  131. sed -i '/mapmodel/s/\<bridge\>/makke\/platform/1' $file
  132. sed -i '/mapmodel/s/\<bridge_shine\>/makke\/platform_shine/1' $file
  133. sed -i '/mapmodel/s/\<bulb\>/makke\/lightbulb/1' $file
  134. sed -i '/mapmodel/s/\<can\>/makke\/coke_can/1' $file
  135. sed -i '/mapmodel/s/\<can2\>/makke\/coke_can_fallen/1' $file
  136. sed -i '/mapmodel/s/\<chair1\>/makke\/office_chair/1' $file
  137. sed -i '/mapmodel/s/\<coffeemug\>/makke\/coffee_mug/1' $file
  138. sed -i '/mapmodel/s/\<comp_bridge\>/makke\/platform_bridge/1' $file
  139. sed -i '/mapmodel/s/\<drainpipe\>/makke\/drainpipe/1' $file
  140. sed -i '/mapmodel/s/\<dumpster\>/makke\/dumpster/1' $file
  141. sed -i '/mapmodel/s/\<elektro\>/makke\/electric_meter/1' $file
  142. sed -i '/mapmodel/s/\<europalette\>/makke\/pallet/1' $file
  143. sed -i '/mapmodel/s/\<fag\>/makke\/cigarette/1' $file
  144. sed -i '/mapmodel/s/\<fence\>/makke\/fence_chainlink/1' $file
  145. sed -i '/mapmodel/s/\<fencegate_closed\>/makke\/fence_chainlink_closed_gate/1' $file
  146. sed -i '/mapmodel/s/\<fencegate_open\>/makke\/fence_chainlink_no_gate/1' $file
  147. sed -i '/mapmodel/s/\<fencepost\>/makke\/fence_chainlink_post/1' $file
  148. sed -i '/mapmodel/s/\<flyer\>/makke\/flyer_propaganda/1' $file
  149. sed -i '/mapmodel/s/\<tree01\>/makke\/flyer_environmental/1' $file
  150. sed -i '/mapmodel/s/\<gastank\>/makke\/fuel_tank/1' $file
  151. sed -i '/mapmodel/s/\<icicle\>/makke\/icicle/1' $file
  152. sed -i '/mapmodel/s/\<hook\>/makke\/hook/1' $file
  153. sed -i '/mapmodel/s/\<locker\>/makke\/locker/1' $file
  154. sed -i '/mapmodel/s/\<light01\>/makke\/fluorescent_lamp/1' $file
  155. sed -i '/mapmodel/s/\<wood01\>/makke\/broken_wood/1' $file
  156. sed -i '/mapmodel/s/\<wrench\>/makke\/wrench/1' $file
  157. sed -i '/mapmodel/s/\<strahler\>/makke\/wall_spotlight/1' $file
  158. sed -i '/floppy/!s/\<streetlamp\>/makke\/street_light/1' $file
  159. sed -i '/mapmodel/s/\<ladder_rung\>/makke\/ladder_1x/1' $file
  160. sed -i '/mapmodel/s/\<ladder_7x\>/makke\/ladder_7x/1' $file
  161. sed -i '/mapmodel/s/\<ladder_8x\>/makke\/ladder_8x/1' $file
  162. sed -i '/mapmodel/s/\<ladder_10x\>/makke\/ladder_10x/1' $file
  163. sed -i '/mapmodel/s/\<ladder_11x\>/makke\/ladder_11x/1' $file
  164. sed -i '/mapmodel/s/\<ladder_15x\>/makke\/ladder_15x/1' $file
  165. sed -i '/mapmodel/s/\<ladderx15_center3\>/makke\/ladder_15x_offset/1' $file
  166. sed -i '/mapmodel/s/\<gutter_h\>/cleaner\/grates\/grate_hor/1' $file
  167. sed -i '/mapmodel/s/\<gutter_v\>/cleaner\/grates\/grate_vert/1' $file
  168. sed -i '/mapmodel/s/\<minelift\>/makke\/mine-shaft_elevator/1' $file
  169. sed -i '/mapmodel/s/\<screw\>/makke\/bolt_nut/1' $file
  170. sed -i '/mapmodel/s/\<sail\>/makke\/sail/1' $file
  171. sed -i '/mapmodel/s/\<snowsail\>/makke\/sail_snow/1' $file
  172. sed -i '/mapmodel/s/\<wires\/2x8\>/makke\/wires\/2x8/1' $file
  173. sed -i '/mapmodel/s/\<wires\/3x8\>/makke\/wires\/3x8/1' $file
  174. sed -i '/mapmodel/s/\<wires\/4x8\>/makke\/wires\/4x8/1' $file
  175. sed -i '/mapmodel/s/\<wires\/4x8a\>/makke\/wires\/4x8a/1' $file
  176. sed -i '/mapmodel/s/\<poster\>/makke\/signs\/wanted/1' $file
  177. sed -i '/mapmodel/s/\<signs\/arab\>/makke\/signs\/arab/1' $file
  178. sed -i '/toca/!s/\<signs\/biohazard\>/makke\/signs\/biohazard/1' $file
  179. sed -i '/mapmodel/s/\<signs\/caution\>/makke\/signs\/caution_voltage/1' $file
  180. sed -i '/mapmodel/s/\<signs\/maint\>/makke\/signs\/caution_maintainence/1' $file
  181. sed -i '/mapmodel/s/\<signs\/flammable\>/makke\/signs\/flammable/1' $file
  182. sed -i '/mapmodel/s/\<signs\/speed\>/makke\/signs\/speed/1' $file
  183. sed -i '/mapmodel/s/\<nocamp\>/makke\/signs\/no_camping/1' $file
  184. sed -i '/mapmodel/s/\<roadblock01\>/makke\/roadblock/1' $file
  185. sed -i '/mapmodel/s/\<roadblock02\>/makke\/roadblock_graffiti/1' $file
  186. sed -i '/mapmodel/s/\<nothing\>/makke\/nothing_clip/1' $file
  187. sed -i '/mapmodel/s/\<picture1\>/makke\/picture/1' $file
  188. sed -i '/mapmodel/s/\<plant01\>/makke\/plant_leafy/1' $file
  189. sed -i '/mapmodel/s/\<plant01_d\>/makke\/plant_leafy_dry/1' $file
  190. sed -i '/mapmodel/s/\<plant01_s\>/makke\/plant_leafy_snow/1' $file
  191. sed -i '/mapmodel/s/\<grass01\>/makke\/grass_short/1' $file
  192. sed -i '/mapmodel/s/\<grass01_d\>/makke\/grass_short_dry/1' $file
  193. sed -i '/mapmodel/s/\<grass01_s\>/makke\/grass_short_snow/1' $file
  194. sed -i '/mapmodel/s/\<grass02\>/makke\/grass_long/1' $file
  195. sed -i '/mapmodel/s/\<grass02_d\>/makke\/grass_long_dry/1' $file
  196. sed -i '/mapmodel/s/\<grass02_s\>/makke\/grass_long_snow/1' $file
  197. echo "Converting textures..."
  198. sed -i '/texture/s/\<wotwot\/skin\/drainpipe.jpg\>/..\/models\/mapmodels\/wotwot\/makke_drainpipe_gritty\/skin.jpg/1' $file
  199. sed -i '/texture/s/\<wotwot\/skin\/commrack.jpg\>/..\/models\/mapmodels\/wotwot\/toca_commrack_dull\/skin.jpg/1' $file
  200. sed -i '/texture/s/\<wotwot\/skin\/monitor.jpg\>/..\/models\/mapmodels\/wotwot\/toca_monitor_dull\/skin.jpg/1' $file
  201. sed -i '/texture/s/\<wotwot\/skin\/milkcarton.jpg\>/..\/models\/mapmodels\/wotwot\/toca_milkcarton_dull\/skin.jpg/1' $file
  202. sed -i '/texture/s/\<wotwot\/skin\/guardrail2.jpg\>/..\/models\/mapmodels\/wotwot\/toca_guardrail2_dull\/skin.jpg/1' $file
  203. sed -i '/texture/s/\<mitaman\/zastrow\/metal_overlaps.jpg\>/zastrow\/metal_overlaps.jpg/1' $file
  204. sed -i '/texture/s/\<mitaman\/zastrow\/metal_plate_fill.jpg\>/zastrow\/metal_plate_fill.jpg/1' $file
  205. sed -i '/texture/s/\<mitaman\/zastrow\/metal_siding_kinksb.jpg\>/zastrow\/metal_siding_kinksb.jpg/1' $file
  206. sed -i '/texture/s/\<mitaman\/zastrow\/metal_siding_kinks.jpg\>/zastrow\/metal_siding_kinks.jpg/1' $file
  207. sed -i '/texture/s/\<mitaman\/zastrow\/sub_doors512A10.jpg\>/zastrow\/sub_doors512A10.jpg/1' $file
  208. sed -i '/texture/s/\<mitaman\/zastrow\/sub_doors512A16.jpg\>/zastrow\/sub_doors512A16.jpg/1' $file
  209. sed -i '/texture/s/\<mitaman\/zastrow\/sub_doors512B05.jpg\>/zastrow\/sub_doors512B05.jpg/1' $file
  210. sed -i '/texture/s/\<mitaman\/zastrow\/sub_window31.jpg\>/zastrow\/sub_window31.jpg/1' $file
  211. sed -i '/texture/s/\<mitaman\/zastrow\/sub_window33.jpg\>/zastrow\/sub_window33.jpg/1' $file
  212. sed -i '/texture/s/\<sub\/sub_sand.jpg\>/zastrow\/sub_sand.jpg/1' $file
  213. sed -i '/texture/s/\<sub\/brick_wall_08.jpg\>/zastrow\/brick_wall_08.jpg/1' $file
  214. sed -i '/texture/s/\<sub\/brick_wall_09.jpg\>/zastrow\/brick_wall_09.jpg/1' $file
  215. sed -i '/texture/s/\<mitaman\/various\/sub_window23.jpg\>/zastrow\/sub_window23.jpg/1' $file
  216. sed -i '/texture/s/\<mitaman\/various\/vent_cap.jpg\>/zastrow\/vent_cap.jpg/1' $file
  217. sed -i '/texture/s/\<mitaman\/various\/sub_window38.jpg\>/zastrow\/sub_window38.jpg/1' $file
  218. sed -i '/texture/s/\<mitaman\/various\/sub_doors256nf_01.jpg\>/zastrow\/sub_doors256nf_01.jpg/1' $file
  219. sed -i '/texture/s/\<rattrap\/rb_box_07.jpg\>/zastrow\/rb_box_07.jpg/1' $file
  220. sed -i '/texture/s/\<mitaman\/golgotha\/elecpanelstwo.jpg\>/golgotha\/elecpanelstwo.jpg/1' $file
  221. sed -i '/texture/s/\<mitaman\/golgotha\/metal_bumps2.jpg\>/golgotha\/metal_bumps2.jpg/1' $file
  222. sed -i '/texture/s/\<mitaman\/golgotha\/tunnel_ceiling.jpg\>/golgotha\/tunnel_ceiling.jpg/1' $file
  223. sed -i '/texture/s/\<mitaman\/golgotha\/hhroofgray.jpg\>/golgotha\/hhroofgray.jpg/1' $file
  224. sed -i '/texture/s/\<mitaman\/golgotha\/metal_bumps3.jpg\>/golgotha\/metal_bumps3.jpg/1' $file
  225. sed -i '/texture/s/\<mitaman\/golgotha\/tunnel_ceiling_b.jpg\>/golgotha\/tunnel_ceiling_b.jpg/1' $file
  226. sed -i '/texture/s/\<mitaman\/various\/5sqtunnelroad.jpg\>/golgotha\/5sqtunnelroad.jpg/1' $file
  227. sed -i '/texture/s/\<mitaman\/3dcafe\/door07_a.jpg\>/3dcafe\/door07_a.jpg/1' $file
  228. sed -i '/texture/s/\<mitaman\/3dcafe\/door07.jpg\>/3dcafe\/door07.jpg/1' $file
  229. sed -i '/texture/s/\<mitaman\/3dcafe\/door10_a.jpg\>/3dcafe\/door10_a.jpg/1' $file
  230. sed -i '/texture/s/\<mitaman\/3dcafe\/door10.jpg\>/3dcafe\/door10.jpg/1' $file
  231. sed -i '/texture/s/\<mitaman\/3dcafe\/door12.jpg\>/3dcafe\/door12.jpg/1' $file
  232. sed -i '/texture/s/\<mitaman\/3dcafe\/door15.jpg\>/3dcafe\/door15.jpg/1' $file
  233. sed -i '/texture/s/\<mitaman\/3dcafe\/objects08.jpg\>/3dcafe\/objects08.jpg/1' $file
  234. sed -i '/texture/s/\<mitaman\/3dcafe\/objects09_a.jpg\>/3dcafe\/objects09_a.jpg/1' $file
  235. sed -i '/texture/s/\<mitaman\/3dcafe\/stone18.jpg\>/3dcafe\/stone18.jpg/1' $file
  236. sed -i '/texture/s/\<mitaman\/grsites\/brick051.jpg\>/grsites\/brick051.jpg/1' $file
  237. sed -i '/texture/s/\<mitaman\/grsites\/brick065.jpg\>/grsites\/brick065.jpg/1' $file
  238. sed -i '/texture/s/\<mitaman\/grsites\/wood060.jpg\>/grsites\/wood060.jpg/1' $file
  239. sed -i '/texture/s/\<mitaman\/various\/metal020.jpg\>/grsites\/metal020.jpg/1' $file
  240. sed -i '/texture/s/\<mitaman\/various\/metal026.jpg\>/grsites\/metal026.jpg/1' $file
  241. sed -i '/texture/s/\<mitaman\/various\/036metal.jpg\>/lemog\/036metal.jpg/1' $file
  242. sed -i '/texture/s/\<mitaman\/various\/006metal.jpg\>/lemog\/006metal.jpg/1' $file
  243. sed -i '/texture/s/\<mitaman\/various\/063bois.jpg\>/lemog\/063bois.jpg/1' $file
  244. sed -i '/texture/s/\<mitaman\/various\/063bois_b.jpg\>/lemog\/063bois_b.jpg/1' $file
  245. sed -i '/texture/s/\<mitaman\/various\/027metal.jpg\>/lemog\/027metal.jpg/1' $file
  246. sed -i '/texture/s/\<makke\/windows.jpg\>/golgotha\/windows.jpg/1' $file
  247. sed -i '/texture/s/\<makke\/window.jpg\>/golgotha\/window.jpg/1' $file
  248. sed -i '/texture/s/\<makke\/panel.jpg\>/golgotha\/panel.jpg/1' $file
  249. sed -i '/texture/s/\<makke\/door.jpg\>/golgotha\/door.jpg/1' $file
  250. sed -i '/texture/s/\<makke\/smallsteelbox.jpg\>/golgotha\/smallsteelbox.jpg/1' $file
  251. sed -i '/texture/s/\<makke\/klappe3.jpg\>/golgotha\/klappe3.jpg/1' $file
  252. sed -i '/texture/s/\<makke\/bricks_2.jpg\>/mayang\/bricks_2.jpg/1' $file
  253. sed -i '/texture/s/\<wotwot\/urban\/manhole1.jpg\>/mayang\/manhole1.jpg/1' $file
  254. sed -i '/texture/s/\<wotwot\/urban\/hatch1.jpg\>/mayang\/hatch1.jpg/1' $file
  255. sed -i '/texture/s/\<wotwot\/urban\/grill2_s.jpg\>/mayang\/grill2_s.jpg/1' $file
  256. sed -i '/texture/s/\<wotwot\/urban\/door3.jpg\>/mayang\/door3.jpg/1' $file
  257. sed -i '/texture/s/\<wotwot\/urban\/airvent1.jpg\>/mayang\/airvent1.jpg/1' $file
  258. sed -i '/texture/s/\<rattrap\/rb_trim_03.jpg\>/golgotha\/rb_trim_03.jpg/1' $file
  259. sed -i '/texture/s/\<rattrap\/rb_window.jpg\>/makke\/rb_window.jpg/1' $file
  260. sed -i '/texture/s/\<rattrap\/rb_window2.jpg\>/makke\/rb_window2.jpg/1' $file
  261. sed -i '/texture/s/\<rattrap\/rb_trim_01.jpg\>/noctua\/ground\/rb_trim_01.jpg/1' $file
  262. sed -i '/texture/s/\<rattrap\/rb_trim_02.jpg\>/makke\/rb_trim_02.jpg/1' $file
  263. sed -i '/texture/s/\<rattrap\/rb_box_01.jpg\>/makke\/rattrap\/rb_box_01.jpg/1' $file
  264. sed -i '/texture/s/\<rattrap\/rb_box_02.jpg\>/makke\/rattrap\/rb_box_02.jpg/1' $file
  265. sed -i '/texture/s/\<rattrap\/rb_box_03.jpg\>/makke\/rattrap\/rb_box_03.jpg/1' $file
  266. sed -i '/texture/s/\<rattrap\/rb_box_04.jpg\>/makke\/rattrap\/rb_box_04.jpg/1' $file
  267. sed -i '/texture/s/\<rattrap\/rb_box_05.jpg\>/makke\/rattrap\/rb_box_05.jpg/1' $file
  268. sed -i '/texture/s/\<rattrap\/rb_box_06.jpg\>/makke\/rattrap\/rb_box_06.jpg/1' $file
  269. sed -i '/texture/s/\<rattrap\/rb_concrete.jpg\>/makke\/rattrap\/rb_concrete.jpg/1' $file
  270. sed -i '/texture/s/\<rattrap\/rb_bricks_01.jpg\>/mayang\/rb_bricks_01.jpg/1' $file
  271. sed -i '/texture/s/\<rattrap\/rb_bricks_02.jpg\>/mayang\/rb_bricks_02.jpg/1' $file
  272. sed -i '/texture/s/\<rattrap\/rb_bricks_03.jpg\>/mayang\/rb_bricks_03.jpg/1' $file
  273. sed -i '/texture/s/\<rattrap\/rb_planks02_trim.jpg\>/noctua\/wood\/planks02_trim_vert.jpg/1' $file
  274. echo -e "Successfully finished converting: "$file"\n"
  275. else
  276. echo -e "\a\E[31m\033[1mERROR:\E[0m "$file" is an incorrect filename, path or option. Or it is not a \".cfg\" file, or it may be non-readable and/or non-writeable.\n"
  277. CONTFAILED="1"
  278. fi
  279. done
  280. if [ "$CONTFAILED" = "1" ]; then
  281. echo -e "\a\nConversion finished, HOWEVER, \E[31m\033[1msome files were NOT converted and/or stripped.\E[0m!"
  282. echo "Please check the output of this script for their errors!"
  283. echo "It is suggested to check your map config files carefully for any inconsistencies, using the \"diff\" command."
  284. else
  285. echo -e "\aConversion succeessfully completed with NO errors!"
  286. echo "It is suggested to check your map config files carefully for any inconsistencies, using the \"diff\" command."
  287. fi