Skip to content

Commit 4d99b6c

Browse files
better particle support
1 parent 5642ae9 commit 4d99b6c

1 file changed

Lines changed: 10 additions & 12 deletions

File tree

mgz/header/objects.py

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,15 @@
4141
)))
4242
)
4343

44+
particle = "particle"/Struct(
45+
"type"/Int16ul,
46+
Embedded(If(lambda ctx: ctx.type == 1, Struct(
47+
"name"/de_string,
48+
"x"/Float32l,
49+
"y"/Float32l,
50+
Bytes(26)
51+
))),
52+
)
4453

4554
static = "static"/Struct(
4655
"object_type"/Int16ul,
@@ -74,19 +83,8 @@
7483
"de_static_unk1"/If(lambda ctx: find_version(ctx) == Version.DE, Bytes(19)),
7584
"has_sprite_list"/Byte,
7685
"sprite_list"/If(lambda ctx: ctx.has_sprite_list != 0, RepeatUntil(lambda x,lst,ctx: lst[-1].type == 0, sprite_list)),
77-
"de_effect_block"/If(lambda ctx: find_version(ctx) == Version.DE, Struct(
78-
Padding(4),
79-
"has_effect"/Byte,
80-
"effect"/If(lambda ctx: ctx.has_effect == 1, Struct(
81-
Padding(3),
82-
"length"/Int16ul,
83-
"name"/Bytes(lambda ctx: ctx.length),
84-
If(lambda ctx: ctx.length > 0, Padding(33))
85-
)),
86-
If(lambda ctx: ctx.effect is None or (ctx.effect and ctx.effect.length > 0), Byte)
87-
)),
8886
"de_extension"/If(lambda ctx: find_version(ctx) == Version.DE, Struct(
89-
Bytes(4),
87+
"particles"/Array(5, particle),
9088
If(lambda ctx: find_save_version(ctx) >= 13.15, Bytes(5)),
9189
If(lambda ctx: find_save_version(ctx) >= 13.17, Bytes(2)),
9290
If(lambda ctx: find_save_version(ctx) >= 13.34, Struct(

0 commit comments

Comments
 (0)