diff options
author | lonkaars <loek@pipeframe.xyz> | 2022-05-05 12:39:34 +0200 |
---|---|---|
committer | lonkaars <loek@pipeframe.xyz> | 2022-05-05 12:39:34 +0200 |
commit | 9af10c2b7851e74f0f67fbbbcb2c299f566285f9 (patch) | |
tree | e0dd21f592139f27c60e79b4798d339c62e0bbcf /maps/mapgen.py | |
parent | a4bd0d8b339c74ba626b99c3a4993b3e56e7b240 (diff) |
remove map sketches and added technical operation summary + discussion notes
Diffstat (limited to 'maps/mapgen.py')
-rwxr-xr-x | maps/mapgen.py | 31 |
1 files changed, 0 insertions, 31 deletions
diff --git a/maps/mapgen.py b/maps/mapgen.py deleted file mode 100755 index a7e6817..0000000 --- a/maps/mapgen.py +++ /dev/null @@ -1,31 +0,0 @@ -import sys -from struct import pack - -def mapgen(filename): - file = open(filename, 'r') - target = open(filename + '.map', 'wb') - contents = file.read() - - lines = contents.strip().split("\n") - target.write(pack('>H', len(lines[0]))) - target.write(pack('>H', len(lines))) - - first_nibble = False - temp_byte = 0 - for char in contents.replace('\n', '').strip(): - first_nibble = not first_nibble - num = int(char, 16) - temp_byte |= num << (4 * first_nibble) - if not first_nibble: - target.write(pack('B', temp_byte)) - temp_byte = 0 - if first_nibble: target.write(pack('B', temp_byte)) - - file.close() - target.close() - -if __name__ == "__main__": - if len(sys.argv) > 1: - mapgen(sys.argv[1]) - else: - exit(1) |