bonk loading

png-branch
an 2019-02-20 14:44:58 -05:00
parent 8fe530352a
commit fd2b589049
3 changed files with 70 additions and 1 deletions

View File

@ -384,7 +384,7 @@ main menu, and physics files. Here is a listing of all chunks used within them:
| `PLAT` | No test data (platform static data) | | `PLAT` | No test data (platform static data) |
| `medi` | Media (liquids) | | `medi` | Media (liquids) |
| `ambi` | Array of Ambient Sounds | | `ambi` | Array of Ambient Sounds |
| `bonk` | Not analyzed (random sounds) | | `bonk` | Array of Random Sounds |
| `term` | Array of Terminals | | `term` | Array of Terminals |
| `iidx` | Not analyzed (map indices) | | `iidx` | Not analyzed (map indices) |
| `ShPa` | Not analyzed (shapes) | | `ShPa` | Not analyzed (shapes) |
@ -771,6 +771,27 @@ Ambient Sound is 16 bytes.
- `Volume` is the volume of this sound, in range 0-256. - `Volume` is the volume of this sound, in range 0-256.
### Random Sound ###
Random Sound is 32 bytes.
| Name | Type | Offset |
| ---- | ---- | ------ |
| `Flags` | `u16` | `0` |
| `Index` | `u16` | `2` |
| `Volume` | `u16` | `4` |
| `DeltaVolume` | `u16` | `6` |
| `Period` | `u16` | `8` |
| `DeltaPeriod` | `u16` | `10` |
| `Angle` | `angle` | `12` |
| `DeltaAngle` | `angle` | `14` |
| `Pitch` | `fixed` | `16` |
| `DeltaPitch` | `fixed` | `20` |
| `Phase` | `u16` | `24` |
- `Flags` is a Random Sound Flags bit field.
- `Phase` must be `65535`.
### Static Map Info ### ### Static Map Info ###
Static Map Info is 88 bytes. Static Map Info is 88 bytes.
@ -1722,4 +1743,10 @@ gravity.
| `NoMediaObstruct` | `5` | | `NoMediaObstruct` | `5` |
| `Ambient` | `6` | | `Ambient` | `6` |
### Random Sound Flags ###
| Name | Bit |
| ---- | --- |
| `IgnoreDirection` | `0` |
<!-- EOF --> <!-- EOF -->

View File

@ -56,6 +56,7 @@ fn dump_chunk(opt: &Options, cid: Ident, cnk: &[u8], eid: u16) -> ResultS<()>
b"LITE" => make_yaml(opt, &rd_array(cnk, map::read_lite)?)?, b"LITE" => make_yaml(opt, &rd_array(cnk, map::read_lite)?)?,
b"OBJS" => make_yaml(opt, &rd_array(cnk, map::read_objs)?)?, b"OBJS" => make_yaml(opt, &rd_array(cnk, map::read_objs)?)?,
b"ambi" => make_yaml(opt, &rd_array(cnk, map::read_ambi)?)?, b"ambi" => make_yaml(opt, &rd_array(cnk, map::read_ambi)?)?,
b"bonk" => make_yaml(opt, &rd_array(cnk, map::read_bonk)?)?,
b"term" => make_yaml(opt, &rd_array(cnk, trm::read_term)?)?, b"term" => make_yaml(opt, &rd_array(cnk, trm::read_term)?)?,
_ => (), _ => (),
} }

View File

@ -229,6 +229,32 @@ pub fn read_ambi(b: &[u8]) -> ResultS<(SoundAmbi, usize)>
Ok((SoundAmbi{index, volume}, 16)) Ok((SoundAmbi{index, volume}, 16))
} }
pub fn read_bonk(b: &[u8]) -> ResultS<(SoundRand, usize)>
{
read_data! {
32, BE in b =>
flags = u16[0];
index = u16[2];
vol_nrm = u16[4];
vol_dta = u16[6];
prd_nrm = u16[8];
prd_dta = u16[10];
yaw_nrm = u16[12];
yaw_dta = u16[14];
pit_nrm = u32[16];
pit_dta = u32[20];
}
let no_dir = flags != 0;
let yaw_nrm = Angle::from_bits(yaw_nrm);
let yaw_dta = Angle::from_bits(yaw_dta);
let pit_nrm = Fixed::from_bits(pit_nrm);
let pit_dta = Fixed::from_bits(pit_dta);
Ok((SoundRand{no_dir, index, vol_nrm, vol_dta, prd_nrm, prd_dta, yaw_nrm,
yaw_dta, pit_nrm, pit_dta}, 32))
}
#[derive(Clone, PartialEq, Serialize)] #[derive(Clone, PartialEq, Serialize)]
pub struct Point pub struct Point
{ {
@ -339,6 +365,21 @@ pub struct SoundAmbi
pub volume: u16, pub volume: u16,
} }
#[derive(Debug, Serialize)]
pub struct SoundRand
{
pub no_dir: bool,
pub index: u16,
pub vol_nrm: u16,
pub vol_dta: u16,
pub prd_nrm: u16,
pub prd_dta: u16,
pub yaw_nrm: Angle,
pub yaw_dta: Angle,
pub pit_nrm: Fixed,
pub pit_dta: Fixed,
}
#[derive(Debug, PartialEq, Serialize)] #[derive(Debug, PartialEq, Serialize)]
pub struct Minf pub struct Minf
{ {