implement EntityList decoding. May need to deal with ESH-less entities from entity_file block

This commit is contained in:
mykola2312 2023-09-04 03:08:14 +03:00
parent 6d7b9f735b
commit 4e8cc4a5e8

View file

@ -18,6 +18,7 @@ pub struct EntityList {
encoding: EntityEncoding, encoding: EntityEncoding,
entity_file_tag: Option<Tag>, entity_file_tag: Option<Tag>,
entity_tag: Option<Tag>, entity_tag: Option<Tag>,
unk1: u32,
enc_size: usize, enc_size: usize,
types: Vec<FString>, types: Vec<FString>,
@ -57,6 +58,7 @@ impl DecoderCtx<EntityEncoding> for EntityList {
encoding: ctx, encoding: ctx,
entity_file_tag: None, entity_file_tag: None,
entity_tag: None, entity_tag: None,
unk1: 0,
enc_size: 0, enc_size: 0,
types: Vec::new(), types: Vec::new(),
entities: Vec::new() entities: Vec::new()
@ -81,7 +83,18 @@ impl DecoderCtx<EntityEncoding> for EntityList {
}, },
EntityEncoding::World => { 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.enc_size = rd.offset() - offset;
ent_list ent_list