From 4e8cc4a5e8e19e9313e57b0f81d55f0e92ff7ebe Mon Sep 17 00:00:00 2001 From: mykola2312 <49044616+mykola2312@users.noreply.github.com> Date: Mon, 4 Sep 2023 03:08:14 +0300 Subject: [PATCH] implement EntityList decoding. May need to deal with ESH-less entities from entity_file block --- src/fot/entitylist.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/fot/entitylist.rs b/src/fot/entitylist.rs index 498ab96..703ef3d 100644 --- a/src/fot/entitylist.rs +++ b/src/fot/entitylist.rs @@ -18,6 +18,7 @@ pub struct EntityList { encoding: EntityEncoding, entity_file_tag: Option, entity_tag: Option, + unk1: u32, enc_size: usize, types: Vec, @@ -57,6 +58,7 @@ impl DecoderCtx for EntityList { encoding: ctx, entity_file_tag: None, entity_tag: None, + unk1: 0, enc_size: 0, types: Vec::new(), entities: Vec::new() @@ -81,7 +83,18 @@ impl DecoderCtx for EntityList { }, EntityEncoding::World => { + ent_list.entity_file_tag = Some(rd.read(0)?); + let n = rd.read_u32()?; + for _ in 0..n { + ent_list.types.push(rd.read(0)?); + } + let m = rd.read_u16()?; + ent_list.unk1 = rd.read_u32()?; + for _ in 0..m { + let ent: Entity = rd.read_opt(0, &mut ent_list)?; + ent_list.entities.push(ent); + } ent_list.enc_size = rd.offset() - offset; ent_list