From 6fff585dd6b9ecdf6938df31626da450a43ec1f1 Mon Sep 17 00:00:00 2001 From: Nicolas Weeger Date: Sun, 19 Mar 2023 15:30:59 +0100 Subject: [PATCH] Handle more than 10 faces for a facing --- utils/make_face_from_files.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/utils/make_face_from_files.py b/utils/make_face_from_files.py index 1cbbddb1e..cd07b149c 100644 --- a/utils/make_face_from_files.py +++ b/utils/make_face_from_files.py @@ -15,6 +15,12 @@ import argparse import shutil +def frame_code(frame): + if frame < 10: + return frame + return chr(ord('A') + frame - 10) + + parser = argparse.ArgumentParser(description="Copy a sequence of files to Crossfire faces, adequately named. Also " "generate the .face file.\nFiles are supposed to be ordered by direction " "then animation frame, that is the second file is direction 2, " @@ -56,10 +62,10 @@ for f in range(0, len(facings) + 1): anims.append([]) magicmap.append([]) for file in args.files: - shutil.copyfile(file, "{0}.{1}.1{2}{3}.png".format(args.face, args.faceset, facing, frame)) - anims[facing].append("{0}.1{1}{2}\n".format(args.face, facing, frame)) + shutil.copyfile(file, "{0}.{1}.1{2}{3}.png".format(args.face, args.faceset, facing, frame_code(frame))) + anims[facing].append("{0}.1{1}{2}\n".format(args.face, facing, frame_code(frame))) if args.magicmap: - magicmap[facing] += "face {0}.1{1}{2}\nmagicmap {3}\nend\n".format(args.face, facing, frame, args.magicmap) + magicmap[facing] += "face {0}.1{1}{2}\nmagicmap {3}\nend\n".format(args.face, facing, frame_code(frame), args.magicmap) facing += 1 if facing == len(facings) + 1: