diff options
author | Diego Roversi <diegor@tiscali.it> | 2020-05-23 09:51:48 +0200 |
---|---|---|
committer | Diego Roversi <diegor@tiscali.it> | 2020-05-23 09:51:48 +0200 |
commit | d1b895d07747fc102a056b1f81895bbbeb0236ff (patch) | |
tree | 1d47dd0be4cdf14244ee7e3d177444870cad5cd3 | |
parent | 3925a488bfa06b549de1eefaafe7e833de9df329 (diff) |
binboards.py: fix loading of a level in binary format
-rw-r--r-- | bubbob/binboards.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/bubbob/binboards.py b/bubbob/binboards.py index 110d8ed..fe19484 100644 --- a/bubbob/binboards.py +++ b/bubbob/binboards.py @@ -1,3 +1,4 @@ +import sys import macbinary import boards import gamesrv @@ -57,7 +58,8 @@ def load(filename): mnstrlist = [Nasty, Monky, Ghosty, Flappy, Springy, Orcy, Gramy, Blitzy] - for key, lvl in list(Bin['LEVL'].items()): + for key, lvl in list(Bin[b'LEVL'].items()): + print(f"load: lvl={lvl} {dir(lvl)}",file=sys.stderr) d = lvl.getlevel(mnstrlist) class BinBoard(boards.Board): pass @@ -65,7 +67,7 @@ def load(filename): setattr(BinBoard, key1, value1) levels[key] = BinBoard - def loader(code, rsrc=Bin['ppat'], cache={}): + def loader(code, rsrc=Bin[b'ppat'], cache={}): try: return cache[code] except KeyError: @@ -104,7 +106,7 @@ def load(filename): keycol1 = KEYCOL if result is not None: w, h, data = macbinary.image2rgb(result) - ppmdata = "P6\n%d %d\n255\n%s" % (w, h, data) + ppmdata = b"P6\n%d %d\n255\n%s" % (w, h, data) result = gamesrv.newbitmap(ppmdata, keycol1), (0, 0, w, h) cache[code] = result return result |