diff --git a/tools/cookobj/parsers.py b/tools/cookobj/parsers.py index dea73b3..97a36e9 100644 --- a/tools/cookobj/parsers.py +++ b/tools/cookobj/parsers.py @@ -164,18 +164,19 @@ def parse_object_group( p.rotcw = int(float(obj.get("rotation", 0))) == 90 p.rotct = int(float(obj.get("rotation", 0))) == -90 props = obj.find("properties") - if props: - if p.otype == ObjectId.MONITOR.value: + if p.otype == ObjectId.MONITOR.value: + m = MonitorProperties() + if props: prop = props.find("property") - m = MonitorProperties() m.kind = MonitorKind.get(prop.get("value")).value - p.properties = m - elif p.otype == ObjectId.BUBBLE_PATCH.value: + p.properties = m + elif p.otype == ObjectId.BUBBLE_PATCH.value: + bp = BubblePatchProperties() + if props: prop = props.find("property") - bp = BubblePatchProperties() # Get first available value bp.frequency = int(prop.get("value")) - p.properties = bp + p.properties = bp # print( # f"Object type {current_ts.object_types[p.otype + current_ts.firstgid].name if p.otype >= 0 else 'DUMMY'}" # ) diff --git a/tools/layouts/omp.hexpat b/tools/layouts/omp.hexpat index 15d66a2..3615a69 100644 --- a/tools/layouts/omp.hexpat +++ b/tools/layouts/omp.hexpat @@ -4,16 +4,21 @@ enum ObjectType: s8 { RING_3V = 0xfe, // -2 RING_3H = 0xff, // -1 - RING = 0, - MONITOR = 1, - SPIKES = 2, - CHECKPOINT = 3, - SPRING_YELLOW = 4, - SPRING_RED = 5, - SPRING_YELLOW_DIAGONAL = 6, - SPRING_RED_DIAGONAL = 7, - GOAL_SIGN = 8, - SWITCH = 9, + RING = 0x0, + MONITOR = 0x1, + SPIKES = 0x2, + CHECKPOINT = 0x3, + SPRING_YELLOW = 0x4, + SPRING_RED = 0x5, + SPRING_YELLOW_DIAGONAL = 0x6, + SPRING_RED_DIAGONAL = 0x7, + SWITCH = 0x8, + GOAL_SIGN = 0x9, + EXPLOSION = 0xa, + MONITOR_IMAGE = 0xb, + SHIELD = 0xc, + BUBBLE_PATCH = 0xd, + BUBBLE = 0xe }; enum MonitorKind: u8 { @@ -38,6 +43,10 @@ struct MonitorProperties { MonitorKind kind; }; +struct BubblePatchProperties { + u8 frequency; +}; + struct ObjectPlacement { u8 is_level_specific; ObjectType type; @@ -48,6 +57,8 @@ struct ObjectPlacement { // Properties, type-dependent if(type == ObjectType::MONITOR) { MonitorProperties properties; + } else if(type == ObjectType::BUBBLE_PATCH) { + BubblePatchProperties properties; } };