import os import bt.extract.btfile as btfile import bt.extract.btimage as btimage res_path = os.path.join("..", "res") amiga_bt1_path = os.path.join(res_path, "amiga", "bt1", "bards_data") # levels #btfile.show_indexed_file_info("levs", amiga_bt1_path) data = btfile.load_indexed_file("levs", amiga_bt1_path) btfile.show_compressed_file_info("CITY/bi1", amiga_bt1_path) data1 = btfile.load_compressed_file("CITY/bi1", amiga_bt1_path) btfile.show_compressed_file_info("CITY/bi2", amiga_bt1_path) data2 = btfile.load_compressed_file("CITY/bi2", amiga_bt1_path) btfile.show_compressed_file_info("CITY/BI3", amiga_bt1_path) data3 = btfile.load_compressed_file("CITY/BI3", amiga_bt1_path) btfile.show_indexed_file_info("pics", amiga_bt1_path) data = btfile.load_indexed_file("pics", amiga_bt1_path, index=2) ind = 0 # skip load addr ind += 2 # time = data[ind] ind += 1
import os, sys import bt.extract.btfile as btfile res_path = os.path.join("..", "res") msdos_bt1_path = os.path.join(res_path, "msdos", "bt1") btfile.show_indexed_file_info("levs", msdos_bt1_path) data = btfile.load_indexed_file("levs", msdos_bt1_path) if len(sys.argv)>=2: levnum=int(sys.argv[1]) else: levnum=0 print levnum print lev1 = data[levnum] #lev1=lev1[2:] wall_data = lev1[0x0000:0x0200] spec_data = lev1[0x0200:0x0400] for i in xrange(22): for j in xrange(22): print "%02x" % wall_data[j+(21-i)*22], print print
def read_level(level, path): "Read a BT1 level (0=Wine Cellar,4=Catacombs1,7=Castle1,10=Kylearan,11=Mangar1,15=Mangar5) from disk and decode it." return load_indexed_file('levs', path, level)
msdos_bt1_path = os.path.join(res_path, "msdos", "bt1") # images pal16 = btimage.palette_cga16() pal16g = btimage.palette_grey16() pal64 = btimage.palette_ega64() pal256 = btimage.palette_grey256() vsize = btimage.view_size() if True: # does not work # btfile.show_indexed_file_info("bigpic", msdos_bt1_path) # data = btfile.load_indexed_file("bigpic", msdos_bt1_path) data0 = btfile.load_indexed_file("bigpic", msdos_bt1_path, index=3) print for i, c in enumerate(list(data0)): if i % 16 == 0: print print hex(c), # if i > 256: break print # btimage.save_4bit_image(data, (w, h), pal16, "bigpic0-foo.png") # btimage.save_8bit_image(data, (w, h), pal64, "bigpic0-foo.png") if True: # works show = lambda im: btimage.show(im)