From dd97a27eb2e479e2682028d85195ab80bc051fbc Mon Sep 17 00:00:00 2001 From: RandumKiwi Date: Sun, 13 Jan 2013 02:05:34 +0000 Subject: [PATCH] Update conversion script... git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@7083 e016b1c5-ed68-44aa-a2f7-31cac88cffde --- config/convert_mapconfig.sh | 125 ++++++++++++++++++++++++++++++++++++ packages/convert_mapcfgs.sh | 121 ---------------------------------- 2 files changed, 125 insertions(+), 121 deletions(-) create mode 100644 config/convert_mapconfig.sh delete mode 100644 packages/convert_mapcfgs.sh diff --git a/config/convert_mapconfig.sh b/config/convert_mapconfig.sh new file mode 100644 index 00000000..e15c4cb1 --- /dev/null +++ b/config/convert_mapconfig.sh @@ -0,0 +1,125 @@ +#!/bin/bash +# A simple script using SED to make map configs +# compatible with the new layout. + +if [[ -r "$1" && -w "$1" ]]; then + echo "Making a backup file of $1" + cp "$1" "$1".BAK + if [ -r "$1".BAK ]; then + echo "Backup successful, continuing..." + else + echo "Backup failed, please check files can be written in the \"`dirname $1`\" directory." + exit + fi + + echo "Converting $1 to a compatible map config file..." + + echo -e "\nConverting mapmodels..." + sed -i '/^mapmodel/s/\/jcdpc\/laptop/g' $1 + sed -i '/^mapmodel/s/\/jcdpc\/cardboardbox/g' $1 + sed -i '/^mapmodel/s/\/jcdpc\/hanginglamp/g' $1 + sed -i '/^mapmodel/s/\/jcdpc\/ventflap/g' $1 + sed -i '/^mapmodel/s/\/ratboy\/toca_milkcrate_blue/g' $1 + sed -i '/^mapmodel/s/\/ratboy\/toca_milkcrate_red/g' $1 + sed -i '/^mapmodel/s/\/makke\/aardapple_enginebox/g' $1 + sed -i '/toxic/!s/\/makke\/barrel/g' $1 + sed -i '/^mapmodel/s/\/makke\/barrel_fallen/g' $1 + sed -i '/^mapmodel/s/\/makke\/barrel_toxic/g' $1 + sed -i '/^mapmodel/s/\/makke\/barrel_newsteel/g' $1 + sed -i '/^mapmodel/s/\/makke\/barrel_newsteel_fallen/g' $1 + sed -i '/^mapmodel/s/\/makke\/bench_seat/g' $1 + sed -i '/^mapmodel/s/\/makke\/platform/g' $1 + sed -i '/^mapmodel/s/\/makke\/platform_shine/g' $1 + sed -i '/^mapmodel/s/\/makke\/lightbulb/g' $1 + sed -i '/^mapmodel/s/\/makke\/coke_can/g' $1 + sed -i '/^mapmodel/s/\/makke\/coke_can_fallen/g' $1 + sed -i '/^mapmodel/s/\/makke\/office_chair/g' $1 + sed -i '/^mapmodel/s/\/makke\/coffee_mug/g' $1 + sed -i '/^mapmodel/s/\/makke\/platform_bridge/g' $1 + sed -i '/^mapmodel/s/\/makke\/drainpipe/g' $1 + sed -i '/^mapmodel/s/\/makke\/dumpster/g' $1 + sed -i '/^mapmodel/s/\/makke\/electric_meter/g' $1 + sed -i '/^mapmodel/s/\/makke\/pallet/g' $1 + sed -i '/^mapmodel/s/\/makke\/cigarette/g' $1 + sed -i '/^mapmodel/s/\/makke\/fence_chainlink/g' $1 + sed -i '/^mapmodel/s/\/makke\/fence_chainlink_closed_gate/g' $1 + sed -i '/^mapmodel/s/\/makke\/fence_chainlink_no_gate/g' $1 + sed -i '/^mapmodel/s/\/makke\/fence_chainlink_post/g' $1 + sed -i '/^mapmodel/s/\/makke\/flyer_propaganda/g' $1 + sed -i '/^mapmodel/s/\/makke\/flyer_environmental/g' $1 + sed -i '/^mapmodel/s/\/makke\/fuel_tank/g' $1 + sed -i '/^mapmodel/s/\/makke\/icicle/g' $1 + sed -i '/^mapmodel/s/\/makke\/hook/g' $1 + sed -i '/^mapmodel/s/\/makke\/locker/g' $1 + sed -i '/^mapmodel/s/\/makke\/fluorescent_lamp/g' $1 + sed -i '/^mapmodel/s/\/makke\/broken_wood/g' $1 + sed -i '/^mapmodel/s/\/makke\/wrench/g' $1 + sed -i '/^mapmodel/s/\/makke\/wall_spotlight/g' $1 + sed -i '/floppy/!s/\/makke\/street_light/g' $1 + sed -i '/^mapmodel/s/\/makke\/ladder_1x/g' $1 + sed -i '/^mapmodel/s/\/makke\/ladder_7x/g' $1 + sed -i '/^mapmodel/s/\/makke\/ladder_8x/g' $1 + sed -i '/^mapmodel/s/\/makke\/ladder_10x/g' $1 + sed -i '/^mapmodel/s/\/makke\/ladder_11x/g' $1 + sed -i '/^mapmodel/s/\/makke\/ladder_15x/g' $1 + sed -i '/^mapmodel/s/\/makke\/ladder_15x_offset/g' $1 + sed -i '/^mapmodel/s/\/makke\/grate_hor/g' $1 + sed -i '/^mapmodel/s/\/makke\/grate_vert/g' $1 + sed -i '/^mapmodel/s/\/makke\/mine-shaft_elevator/g' $1 + sed -i '/^mapmodel/s/\/makke\/bolt_nut/g' $1 + sed -i '/^mapmodel/s/\/makke\/sail/g' $1 + sed -i '/^mapmodel/s/\/makke\/sail_snow/g' $1 + sed -i '/^mapmodel/s/\/makke\/wires\/2x8/g' $1 + sed -i '/^mapmodel/s/\/makke\/wires\/3x8/g' $1 + sed -i '/^mapmodel/s/\/makke\/wires\/4x8/g' $1 + sed -i '/^mapmodel/s/\/makke\/wires\/4x8a/g' $1 + sed -i '/^mapmodel/s/\/makke\/signs\/wanted/g' $1 + sed -i '/^mapmodel/s/\/makke\/signs\/arab/g' $1 + sed -i '/toca/!s/\/makke\/signs\/biohazard/g' $1 + sed -i '/^mapmodel/s/\/makke\/signs\/caution_voltage/g' $1 + sed -i '/^mapmodel/s/\/makke\/signs\/caution_maintainence/g' $1 + sed -i '/^mapmodel/s/\/makke\/signs\/flammable/g' $1 + sed -i '/^mapmodel/s/\/makke\/signs\/speed/g' $1 + sed -i '/^mapmodel/s/\/makke\/signs\/no_camping/g' $1 + sed -i '/^mapmodel/s/\/makke\/roadblock/g' $1 + sed -i '/^mapmodel/s/\/makke\/roadblock_graffiti/g' $1 + sed -i '/^mapmodel/s/\/makke\/nothing_clip/g' $1 + sed -i '/^mapmodel/s/\/makke\/picture/g' $1 + sed -i '/^mapmodel/s/\/makke\/plant_leafy/g' $1 + sed -i '/^mapmodel/s/\/makke\/plant_leafy_dry/g' $1 + sed -i '/^mapmodel/s/\/makke\/plant_leafy_snow/g' $1 + sed -i '/^mapmodel/s/\/makke\/grass_short/g' $1 + sed -i '/^mapmodel/s/\/makke\/grass_short_dry/g' $1 + sed -i '/^mapmodel/s/\/makke\/grass_short_snow/g' $1 + sed -i '/^mapmodel/s/\/makke\/grass_long/g' $1 + sed -i '/^mapmodel/s/\/makke\/grass_long_dry/g' $1 + sed -i '/^mapmodel/s/\/makke\/grass_long_snow/g' $1 + + echo -e "\nConverting textures..." + sed -i '/^texture/s/\/..\/models\/mapmodels\/wotwot\/makke_drainpipe_gritty\/skin.jpg/g' $1 + sed -i '/^texture/s/\/..\/models\/mapmodels\/wotwot\/toca_commrack_dull\/skin.jpg/g' $1 + sed -i '/^texture/s/\/..\/models\/mapmodels\/wotwot\/toca_monitor_dull\/skin.jpg/g' $1 + sed -i '/^texture/s/\/..\/models\/mapmodels\/wotwot\/toca_milkcarton_dull\/skin.jpg/g' $1 + sed -i '/^texture/s/\/..\/models\/mapmodels\/wotwot\/toca_guardrail2_dull\/skin.jpg/g' $1 + sed -i '/^texture/s/\/zastrow\/metal_overlaps.jpg/g' $1 + sed -i '/^texture/s/\/zastrow\/metal_plate_fill.jpg/g' $1 + sed -i '/^texture/s/\/zastrow\/metal_siding_kinksb.jpg/g' $1 + sed -i '/^texture/s/\/zastrow\/metal_siding_kinks.jpg/g' $1 + sed -i '/^texture/s/\/zastrow\/sub_doors512A10.jpg/g' $1 + sed -i '/^texture/s/\/zastrow\/sub_doors512A16.jpg/g' $1 + sed -i '/^texture/s/\/zastrow\/sub_doors512B05.jpg/g' $1 + sed -i '/^texture/s/\/zastrow\/sub_window31.jpg/g' $1 + sed -i '/^texture/s/\/zastrow\/sub_window33.jpg/g' $1 + + echo -e "\a\nConversion finished!" + echo "Please check your map config file carefully for any inconsistencies." +else + if [ "$1" = "" ]; then + echo -e "\a\E[31m\033[1mERROR:\E[0m Please append the path of your map config file to the end of this script." + echo "For example, run:" + echo -e "\tsh convert_mapconfig.sh ../packages/maps/yourmapname.cfg" + else + echo -e "\a\E[31m\033[1mERROR:\E[0m The path you've stated to the map config file is non-readable and/or non-writeable and/or incorrect." + exit + fi +fi diff --git a/packages/convert_mapcfgs.sh b/packages/convert_mapcfgs.sh deleted file mode 100644 index 76395877..00000000 --- a/packages/convert_mapcfgs.sh +++ /dev/null @@ -1,121 +0,0 @@ -#!/bin/bash -# A simple script using SED to make map configs -# compatible with the new layout. - -while getopts "c:" copt; do - if [ "$copt" = "c" ]; then - if [ -e "$OPTARG" ]; then - echo "Converting your map cfg file..." - - echo -e "\nConverting mapmodels..." - sed -i '/^mapmodel/s/\/jcdpc\/laptop/g' $OPTARG - sed -i '/^mapmodel/s/\/jcdpc\/cardboardbox/g' $OPTARG - sed -i '/^mapmodel/s/\/jcdpc\/hanginglamp/g' $OPTARG - sed -i '/^mapmodel/s/\/jcdpc\/ventflap/g' $OPTARG - sed -i '/^mapmodel/s/\/ratboy\/toca_milkcrate_blue/g' $OPTARG - sed -i '/^mapmodel/s/\/ratboy\/toca_milkcrate_red/g' $OPTARG - sed -i '/^mapmodel/s/\/makke\/aardapple_enginebox/g' $OPTARG - sed -i '/toxic/!s/\/makke\/barrel/g' $OPTARG - sed -i '/^mapmodel/s/\/makke\/barrel_fallen/g' $OPTARG - sed -i '/^mapmodel/s/\/makke\/barrel_toxic/g' $OPTARG - sed -i '/^mapmodel/s/\/makke\/barrel_newsteel/g' $OPTARG - sed -i '/^mapmodel/s/\/makke\/barrel_newsteel_fallen/g' $OPTARG - sed -i '/^mapmodel/s/\/makke\/bench_seat/g' $OPTARG - sed -i '/^mapmodel/s/\/makke\/platform/g' $OPTARG - sed -i '/^mapmodel/s/\/makke\/platform_shine/g' $OPTARG - sed -i '/^mapmodel/s/\/makke\/lightbulb/g' $OPTARG - sed -i '/^mapmodel/s/\/makke\/coke_can/g' $OPTARG - sed -i '/^mapmodel/s/\/makke\/coke_can_fallen/g' $OPTARG - sed -i '/^mapmodel/s/\/makke\/office_chair/g' $OPTARG - sed -i '/^mapmodel/s/\/makke\/coffee_mug/g' $OPTARG - sed -i '/^mapmodel/s/\/makke\/platform_bridge/g' $OPTARG - sed -i '/^mapmodel/s/\/makke\/drainpipe/g' $OPTARG - sed -i '/^mapmodel/s/\/makke\/dumpster/g' $OPTARG - sed -i '/^mapmodel/s/\/makke\/electric_meter/g' $OPTARG - sed -i '/^mapmodel/s/\/makke\/pallet/g' $OPTARG - sed -i '/^mapmodel/s/\/makke\/cigarette/g' $OPTARG - sed -i '/^mapmodel/s/\/makke\/fence_chainlink/g' $OPTARG - sed -i '/^mapmodel/s/\/makke\/fence_chainlink_closed_gate/g' $OPTARG - sed -i '/^mapmodel/s/\/makke\/fence_chainlink_no_gate/g' $OPTARG - sed -i '/^mapmodel/s/\/makke\/fence_chainlink_post/g' $OPTARG - sed -i '/^mapmodel/s/\/makke\/flyer_propaganda/g' $OPTARG - sed -i '/^mapmodel/s/\/makke\/flyer_environmental/g' $OPTARG - sed -i '/^mapmodel/s/\/makke\/fuel_tank/g' $OPTARG - sed -i '/^mapmodel/s/\/makke\/icicle/g' $OPTARG - sed -i '/^mapmodel/s/\/makke\/hook/g' $OPTARG - sed -i '/^mapmodel/s/\/makke\/locker/g' $OPTARG - sed -i '/^mapmodel/s/\/makke\/fluorescent_lamp/g' $OPTARG - sed -i '/^mapmodel/s/\/makke\/broken_wood/g' $OPTARG - sed -i '/^mapmodel/s/\/makke\/wrench/g' $OPTARG - sed -i '/^mapmodel/s/\/makke\/wall_spotlight/g' $OPTARG - sed -i '/floppy/!s/\/makke\/street_light/g' $OPTARG - sed -i '/^mapmodel/s/\/makke\/ladder_1x/g' $OPTARG - sed -i '/^mapmodel/s/\/makke\/ladder_7x/g' $OPTARG - sed -i '/^mapmodel/s/\/makke\/ladder_8x/g' $OPTARG - sed -i '/^mapmodel/s/\/makke\/ladder_10x/g' $OPTARG - sed -i '/^mapmodel/s/\/makke\/ladder_11x/g' $OPTARG - sed -i '/^mapmodel/s/\/makke\/ladder_15x/g' $OPTARG - sed -i '/^mapmodel/s/\/makke\/ladder_15x_offset/g' $OPTARG - sed -i '/^mapmodel/s/\/makke\/grate_hor/g' $OPTARG - sed -i '/^mapmodel/s/\/makke\/grate_vert/g' $OPTARG - sed -i '/^mapmodel/s/\/makke\/mine-shaft_elevator/g' $OPTARG - sed -i '/^mapmodel/s/\/makke\/bolt_nut/g' $OPTARG - sed -i '/^mapmodel/s/\/makke\/sail/g' $OPTARG - sed -i '/^mapmodel/s/\/makke\/sail_snow/g' $OPTARG - sed -i '/^mapmodel/s/\/makke\/wires\/2x8/g' $OPTARG - sed -i '/^mapmodel/s/\/makke\/wires\/3x8/g' $OPTARG - sed -i '/^mapmodel/s/\/makke\/wires\/4x8/g' $OPTARG - sed -i '/^mapmodel/s/\/makke\/wires\/4x8a/g' $OPTARG - sed -i '/^mapmodel/s/\/makke\/signs\/wanted/g' $OPTARG - sed -i '/^mapmodel/s/\/makke\/signs\/arab/g' $OPTARG - sed -i '/toca/!s/\/makke\/signs\/biohazard/g' $OPTARG - sed -i '/^mapmodel/s/\/makke\/signs\/caution_voltage/g' $OPTARG - sed -i '/^mapmodel/s/\/makke\/signs\/caution_maintainence/g' $OPTARG - sed -i '/^mapmodel/s/\/makke\/signs\/flammable/g' $OPTARG - sed -i '/^mapmodel/s/\/makke\/signs\/speed/g' $OPTARG - sed -i '/^mapmodel/s/\/makke\/signs\/no_camping/g' $OPTARG - sed -i '/^mapmodel/s/\/makke\/roadblock/g' $OPTARG - sed -i '/^mapmodel/s/\/makke\/roadblock_graffiti/g' $OPTARG - sed -i '/^mapmodel/s/\/makke\/nothing_clip/g' $OPTARG - sed -i '/^mapmodel/s/\/makke\/picture/g' $OPTARG - sed -i '/^mapmodel/s/\/makke\/plant_leafy/g' $OPTARG - sed -i '/^mapmodel/s/\/makke\/plant_leafy_dry/g' $OPTARG - sed -i '/^mapmodel/s/\/makke\/plant_leafy_snow/g' $OPTARG - sed -i '/^mapmodel/s/\/makke\/grass_short/g' $OPTARG - sed -i '/^mapmodel/s/\/makke\/grass_short_dry/g' $OPTARG - sed -i '/^mapmodel/s/\/makke\/grass_short_snow/g' $OPTARG - sed -i '/^mapmodel/s/\/makke\/grass_long/g' $OPTARG - sed -i '/^mapmodel/s/\/makke\/grass_long_dry/g' $OPTARG - sed -i '/^mapmodel/s/\/makke\/grass_long_snow/g' $OPTARG - - echo -e "\nConverting textures..." - sed -i '/^texture/s/\/..\/models\/mapmodels\/wotwot\/makke_drainpipe_gritty\/skin.jpg/g' $OPTARG - sed -i '/^texture/s/\/..\/models\/mapmodels\/wotwot\/toca_commrack_dull\/skin.jpg/g' $OPTARG - sed -i '/^texture/s/\/..\/models\/mapmodels\/wotwot\/toca_monitor_dull\/skin.jpg/g' $OPTARG - sed -i '/^texture/s/\/..\/models\/mapmodels\/wotwot\/toca_milkcarton_dull\/skin.jpg/g' $OPTARG - sed -i '/^texture/s/\/..\/models\/mapmodels\/wotwot\/toca_guardrail2_dull\/skin.jpg/g' $OPTARG - sed -i '/^texture/s/\/zastrow\/metal_overlaps.jpg/g' $OPTARG - sed -i '/^texture/s/\/zastrow\/metal_plate_fill.jpg/g' $OPTARG - sed -i '/^texture/s/\/zastrow\/metal_siding_kinksb.jpg/g' $OPTARG - sed -i '/^texture/s/\/zastrow\/metal_siding_kinks.jpg/g' $OPTARG - sed -i '/^texture/s/\/zastrow\/sub_doors512A10.jpg/g' $OPTARG - sed -i '/^texture/s/\/zastrow\/sub_doors512A16.jpg/g' $OPTARG - sed -i '/^texture/s/\/zastrow\/sub_doors512B05.jpg/g' $OPTARG - sed -i '/^texture/s/\/zastrow\/sub_window31.jpg/g' $OPTARG - sed -i '/^texture/s/\/zastrow\/sub_window33.jpg/g' $OPTARG - - echo -e "\a\nConversion finished!" - echo "Please check your map config file carefully for any inconsistencies." - else - echo -e "\a\E[31m\033[1mERROR:\E[0m The path you've stated to the map config file is invalid." - fi - else - echo -e "\a\E[31m\033[1mERROR:\E[0m Invalid OPTION." - echo -e "Try running this script with the -c option, specifying the path to your maps config file." - fi -exit -done - -# If no options are given, this will skip the while loop and output this error. -echo -e "\a\E[31m\033[1mERROR:\E[0m No OPTION given." -echo -e "Try running this script with the -c option, specifying the path to your maps config file."