Skip to content

Commit

Permalink
Handle new texts in legacy data conversion script
Browse files Browse the repository at this point in the history
  • Loading branch information
nextghost committed Jul 19, 2021
1 parent c99e9ac commit 31c9481
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions tools/extract_langdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,13 @@ def copy_file(src, dst):
with open(dst, 'wb') as fw:
fw.write(data)

def copy_list(datadir, subpath, file_list):
for item in file_list:
dstpath = os.path.join('lang', *subpath, item)
if not os.path.isfile(dstpath):
srcpath = os.path.join(datadir, *subpath, item)
copy_file(srcpath, dstpath)

def create_dirs(toolsdir):
bitmap_list = ('mmnu0.png', 'mmnu1.png', 'mmnu2.png', 'mmnu3.png')
text_list = (
Expand Down Expand Up @@ -91,17 +98,9 @@ def create_dirs(toolsdir):
if os.path.isfile(srcpath) and not os.path.isfile(dstpath):
copy_file(srcpath, dstpath)

for item in bitmap_list:
dstpath = os.path.join('lang', 'graphics', 'bitmaps', item)
if not os.path.isfile(dstpath):
srcpath = os.path.join(datadir, 'graphics', 'bitmaps', item)
copy_file(srcpath, dstpath)

for item in text_list:
dstpath = os.path.join('lang', 'texts', item)
if not os.path.isfile(dstpath):
srcpath = os.path.join(datadir, 'texts', item)
copy_file(srcpath, dstpath)
copy_list(datadir, ('graphics', 'bitmaps'), bitmap_list)
copy_list(datadir, ('texts',), text_list)
copy_list(datadir, ('texts',), ('txt%d.txt' % x for x in range(77, 85)))

def write_wav(name, data):
fw = wave.open(name + '.wav', 'wb')
Expand Down

0 comments on commit 31c9481

Please sign in to comment.