ambi loader

png-branch
an 2019-02-20 14:29:05 -05:00
parent c6e561e406
commit 8fe530352a
3 changed files with 21 additions and 1 deletions

View File

@ -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.

View File

@ -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)?)?,
_ => (),
}

View File

@ -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
{