maps: removed legacy maps and script
authorLukas Krickl <lukas@krickl.dev>
Sun, 21 Sep 2025 15:08:53 +0000 (17:08 +0200)
committerLukas Krickl <lukas@krickl.dev>
Sun, 21 Sep 2025 15:08:53 +0000 (17:08 +0200)
makefile
tiles/bank8800.inc
tools/tms2map.py [deleted file]

index c4d0dcce000f42fedc3fc7a6bb4d73da45273883..99eeabf12ede28a0616d98d2667425722cd38b18 100644 (file)
--- a/makefile
+++ b/makefile
@@ -16,6 +16,3 @@ tiles:
        ./tools/png2chr.py assets/tiles/bank8C00.png > tiles/bank8C00.inc
        ./tools/png2chr.py assets/tiles/bank9000.png > tiles/bank9000.inc
 
-.PHONY: maps
-maps:
-       ./tools/tms2map.py assets/maps/l1.tmx l1 > maps/l1.s
index 2647bac0ce3b5538f426b34d335a532bca5bbf7f..4022f01833d961604bfd459ab4b51cccd0993686 100644 (file)
@@ -1,71 +1,71 @@
 ; tile 0
-.chr 22233333
-.chr 22311113
-.chr 23111113
-.chr 31111113
-.chr 31111113
-.chr 31111113
-.chr 31111113
-.chr 31111113
-.chr 31111113
-.chr 31111113
-.chr 31111113
-.chr 31111113
-.chr 31111113
-.chr 31111113
-.chr 31111113
-.chr 33333333
+.chr 32000000
+.chr 10000000
+.chr 00000000
+.chr 00000000
+.chr 00000000
+.chr 00000000
+.chr 00000000
+.chr 00000000
+.chr 00000000
+.chr 00000000
+.chr 00000000
+.chr 00000000
+.chr 00000000
+.chr 00000000
+.chr 00000000
+.chr 00000000
 ; tile 1
-.chr 33333222
-.chr 31111322
-.chr 31111132
-.chr 31111113
-.chr 31111113
-.chr 31111113
-.chr 31111113
-.chr 31111113
-.chr 31111113
-.chr 31111113
-.chr 31111113
-.chr 31111113
-.chr 31111113
-.chr 31111113
-.chr 31111113
-.chr 33333333
+.chr 00000000
+.chr 00000000
+.chr 00000000
+.chr 00000000
+.chr 00000000
+.chr 00000000
+.chr 00000000
+.chr 00000000
+.chr 00000000
+.chr 00000000
+.chr 00000000
+.chr 00000000
+.chr 00000000
+.chr 00000000
+.chr 00000000
+.chr 00000000
 ; tile 2
-.chr 33333333
-.chr 31111111
-.chr 31111111
-.chr 31111111
-.chr 31111111
-.chr 31111111
-.chr 31111111
-.chr 33333333
-.chr 33333333
-.chr 31111111
-.chr 31111111
-.chr 31111111
-.chr 31111111
-.chr 31111111
-.chr 31111111
-.chr 33333333
+.chr 00000000
+.chr 00000000
+.chr 00000000
+.chr 00000000
+.chr 00000000
+.chr 00000000
+.chr 00000000
+.chr 00000000
+.chr 00000000
+.chr 00000000
+.chr 00000000
+.chr 00000000
+.chr 00000000
+.chr 00000000
+.chr 00000000
+.chr 00000000
 ; tile 3
-.chr 33333222
-.chr 11111322
-.chr 11111132
-.chr 11111113
-.chr 11111113
-.chr 11111113
-.chr 11111113
-.chr 33333333
-.chr 33333333
-.chr 11111113
-.chr 11111113
-.chr 11111113
-.chr 11111113
-.chr 11111132
-.chr 11111322
-.chr 33333222
+.chr 00000000
+.chr 00000000
+.chr 00000000
+.chr 00000000
+.chr 00000000
+.chr 00000000
+.chr 00000000
+.chr 00000000
+.chr 00000000
+.chr 00000000
+.chr 00000000
+.chr 00000000
+.chr 00000000
+.chr 00000000
+.chr 00000000
+.chr 00000000
 ; tile 4
 .chr 00000000
 .chr 00000033
 ; tile 16
 .chr 00000000
 .chr 00000000
-.chr 00300000
-.chr 03130000
-.chr 03213000
-.chr 00313000
-.chr 00321300
-.chr 00031300
-.chr 00032130
-.chr 00003130
-.chr 00003213
-.chr 00000313
-.chr 00000323
-.chr 00000030
+.chr 00000000
+.chr 00000000
+.chr 00000000
+.chr 00000000
+.chr 00000000
+.chr 00000000
+.chr 00000000
+.chr 00000000
+.chr 00000000
+.chr 00000000
+.chr 00000000
+.chr 00000000
 .chr 00000000
 .chr 00000000
 ; tile 17
diff --git a/tools/tms2map.py b/tools/tms2map.py
deleted file mode 100755 (executable)
index 2328276..0000000
+++ /dev/null
@@ -1,201 +0,0 @@
-#!/usr/bin/env python
-
-import sys 
-import os
-import xml.etree.ElementTree as ET
-
-TILE_SIZE = 16
-ACTOR_OFFSET_X = 0
-ACTOR_OFFSET_Y = 0
-
-state_ptr = "st_map_null"
-tile_bank0 = "bank8000"
-tile_bank1 = "bank8800"
-tile_bank2 = "bank8C00"
-tile_bank3 = "bank9000"
-actor_table_ptr = "map_actor_table_null"
-map_name = "noname"
-NAME_LEN = 8
-
-TILE_FLAGS = [0] * 256
-MAP_W = 16
-MAP_H = 16
-
-# set by layer properties 
-# flags_x,y
-BG_FLAGS = [0] * MAP_W * MAP_H
-
-if len(sys.argv) < 3:
-    print("Usage: tmx2map.py <source> <map name>")
-    sys.exit(-1)
-
-src = sys.argv[1]
-name = sys.argv[2]
-
-def compress(data, convert):
-    compressed = []
-
-    run_length = 0
-    last_byte = 0
-
-    for i, byte in enumerate(data):
-        if (last_byte != byte and run_length > 0) or run_length >= 255:
-            compressed.append(run_length)
-            compressed.append(convert(last_byte))
-            run_length = 0
-        
-        last_byte = byte
-        run_length += 1
-    
-    if run_length > 0:
-        compressed.append(run_length)
-        compressed.append(convert(last_byte))
-
-    return compressed
-
-
-def convert_val(byte):
-    val = int(byte)
-    if val > 0:
-        val -= 1
-    # calculate the real tile offset from a 16x16 tileset
-    # to a 8x8 tileset
-    return (val * 2 + int(val / 8) * 16) & 0xFF 
-
-def convert_none(byte):
-    return int(byte)
-
-def print_bg_data(data, name, layer):
-    split = data.split(",")
-    print_data(split, name, layer, convert_val)
-
-def print_data(data, name, layer, convert):
-    data = compress(data, convert)
-    print(name + "_" + layer + ":")
-    for i, byte in enumerate(data):
-        end = ', '
-
-        if i % 8 == 0: 
-            print("\n.db ", end = '');
-        
-        val = byte
-
-        if (i+1) % 8 == 0:
-            end = ''
-        if i == len(data) - 1:
-            end = '\n'
-        print(hex(val), end=end)
-
-    print(".db 0x00 ; termiante data")
-
-def print_bg_flags(data, name, layer):
-    split = data.split(",")
-    flags = []
-    for i, byte in enumerate(split):
-        flags.append(TILE_FLAGS[int(byte)-1] | BG_FLAGS[i])
-    print_data(flags, name, 'tile_flags', convert_none)
-
-def print_header(name):
-    print(name + "_header:")
-    print(".db 0, 0, 0, 0 ; flags")
-    print(".str \"" + map_name.upper().ljust(NAME_LEN)[:NAME_LEN] + "\"") 
-    print("dw " + name + "_bg")
-    print("dw " + name + "_tile_flags")
-    print("dw " + state_ptr)
-    print("dw " + actor_table_ptr)
-    print("dw " + tile_bank0)
-    print("dw " + tile_bank1)
-    print("dw " + tile_bank2)
-    print("dw " + tile_bank3)
-    print("")
-    
-def get_flag(tile):
-    for child in tile:
-        if child.tag == 'properties':
-            for sub_child in child:
-                if sub_child.tag == 'property':
-                    if sub_child.attrib['name'] == 'flags':
-                        TILE_FLAGS[int(tile.attrib['id'])] |= int(sub_child.attrib['value'])
-
-# get all flags and write them to TILE_FLAGS
-def get_flags(tileset):
-    # do we have to load a tileset?
-    tilesetfile = os.path.join(os.path.dirname(src),tileset.attrib['source'])
-    tileset = ET.parse(tilesetfile).getroot()
-    
-
-    for child in tileset:
-        if child.tag == 'tile':
-            get_flag(child)
-
-def get_map_props(root):
-    global state_ptr
-    global actor_table_ptr
-    global tile_bank0
-    global tile_bank1
-    global tile_bank2
-    global tile_bank3
-    global map_name
-
-    for child in root:
-        if child.tag == "properties":
-            for prop in child:
-                name = prop.attrib['name']
-                value = prop.attrib['value']
-                if name == 'state_ptr':
-                    state_ptr = value
-                elif name == 'actor_table_ptr':
-                    actor_table_ptr = value
-                elif name == 'tile_bank0':
-                    tile_bank0 = value
-                elif name == 'tile_bank1':
-                    tile_bank1 = value
-                elif name == 'tile_bank2':
-                    tile_bank2 = value
-                elif name == 'tile_bank3':
-                    tile_bank3 = value
-                elif name == 'map_name':
-                    map_name = value
-
-    return
-
-def read_bg_props(data):
-    for child in data:
-        name = child.attrib['name']
-        if name.startswith('flags_left'):
-            for i in range(0, MAP_H): 
-                BG_FLAGS[(MAP_W)*i] = int(child.attrib['value'])
-        elif name.startswith('flags_up'):
-            for i in range(0, MAP_W): 
-                BG_FLAGS[i] = int(child.attrib['value'])
-        elif name.startswith('flags_down'):
-            for i in range(0, MAP_W): 
-                BG_FLAGS[(MAP_H) * (MAP_W - 1) + i] = int(child.attrib['value'])
-        elif name.startswith('flags_right'):
-            for i in range(0, MAP_H): 
-                BG_FLAGS[(MAP_W - 1) + (MAP_W) * i] = int(child.attrib['value'])
-        elif name.startswith('flags_'):
-            name = name.replace('flags_', '')
-            coords = name.split(',')
-            tile_index = int(coords[1]) * MAP_W + int(coords[0])
-            BG_FLAGS[tile_index] = int(child.attrib['value'])
-
-def convert(src, name):
-    tree = ET.parse(src)
-    root = tree.getroot()
-    
-    get_map_props(root)
-    print_header(name)
-
-    for child in root:
-        if child.tag == "layer":
-            for data in child:
-                if data.tag == "properties":
-                    read_bg_props(data)
-                else:
-                    print_bg_data(data.text, name, child.attrib['name'])
-                    print_bg_flags(data.text, name, child.attrib['name'])
-        elif child.tag == "tileset":
-            get_flags(child)
-
-convert(src, name)