From 656ddcfdeec883e22f3c2574c251787257ede902 Mon Sep 17 00:00:00 2001 From: Benau Date: Fri, 11 Nov 2016 09:06:06 +0800 Subject: [PATCH] Add tools from hiker --- tools/ai_test/test_track.sh | 9 ++ tools/check_textures.py | 198 ++++++++++++++++++++++++++++++++++++ 2 files changed, 207 insertions(+) create mode 100755 tools/ai_test/test_track.sh create mode 100755 tools/check_textures.py diff --git a/tools/ai_test/test_track.sh b/tools/ai_test/test_track.sh new file mode 100755 index 000000000..6121aff82 --- /dev/null +++ b/tools/ai_test/test_track.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +for track in abyss cocoa_temple fortmagma greenvalley lighthouse olivermath snowmountain stk_enterprise zengarden hacienda mansion snowtuxpeak farm mines sandtrack city gran_paradiso_island minigolf scotland xr591; do + echo "Testing $track" + $1 --log=0 -R \ + --ai=nolok,nolok,nolok,nolok,nolok,nolok,nolok,nolok \ + --track=$track --difficulty=2 --type=1 --test-ai=2 \ + --profile-laps=10 --no-graphics > stdout.$track +done diff --git a/tools/check_textures.py b/tools/check_textures.py new file mode 100755 index 000000000..57065b09f --- /dev/null +++ b/tools/check_textures.py @@ -0,0 +1,198 @@ +#!/usr/bin/env python + +import os +import re +import struct + +# Reads all texture names from the specified directory. +# Textures must end in jpg, png, or bmp. +# Returns a directory with the texture name as key. +def readAllTextures(dir, result): + if type(dir)==type([]): + for i in dir: + readAllTextures(i,result) + return + + re_is_texture = re.compile("^.*\.(jpg|png|bmp)$") + for i in os.listdir(dir): + if re_is_texture.match(i): + result[i]=1 + +# ----------------------------------------------------------------------------- +# Reads all texture names specified in a materials.xml file. + +def readMaterialsXML(filename): + textures = {} + f = open(filename, "r") + + # Crude RE instead of XML parsing + re_texture_name = re.compile("^ *