diff --git a/MarathonData.md b/MarathonData.md index 84a9127..63585ba 100644 --- a/MarathonData.md +++ b/MarathonData.md @@ -766,10 +766,11 @@ Ambient Sound is 16 bytes. | Name | Type | Offset | | ---- | ---- | ------ | -| `Flags` | `u16` | `0` | | `Index` | `u16` | `2` | | `Volume` | `u16` | `4` | +- `Volume` is the volume of this sound, in range 0-256. + ### Static Map Info ### Static Map Info is 88 bytes. diff --git a/src/main.rs b/src/main.rs index 17d5bd9..9b5acee 100644 --- a/src/main.rs +++ b/src/main.rs @@ -55,6 +55,7 @@ fn dump_chunk(opt: &Options, cid: Ident, cnk: &[u8], eid: u16) -> ResultS<()> b"POLY" => make_yaml(opt, &rd_array(cnk, map::read_poly)?)?, b"LITE" => make_yaml(opt, &rd_array(cnk, map::read_lite)?)?, b"OBJS" => make_yaml(opt, &rd_array(cnk, map::read_objs)?)?, + b"ambi" => make_yaml(opt, &rd_array(cnk, map::read_ambi)?)?, b"term" => make_yaml(opt, &rd_array(cnk, trm::read_term)?)?, _ => (), } diff --git a/src/marathon/map.rs b/src/marathon/map.rs index c887f06..a6f5d2b 100644 --- a/src/marathon/map.rs +++ b/src/marathon/map.rs @@ -218,6 +218,17 @@ pub fn read_objs(b: &[u8]) -> ResultS<(Object, usize)> Ok((Object{group, index, angle, poly, pos_x, pos_y, pos_z, flags, bias}, 16)) } +pub fn read_ambi(b: &[u8]) -> ResultS<(SoundAmbi, usize)> +{ + read_data! { + 16, BE in b => + index = u16[2]; + volume = u16[4]; + } + + Ok((SoundAmbi{index, volume}, 16)) +} + #[derive(Clone, PartialEq, Serialize)] pub struct Point { @@ -321,6 +332,13 @@ pub struct Object pub bias: u16, } +#[derive(Debug, Serialize)] +pub struct SoundAmbi +{ + pub index: u16, + pub volume: u16, +} + #[derive(Debug, PartialEq, Serialize)] pub struct Minf {