plac loader

png-branch
an 2019-02-20 18:39:29 -05:00
parent c4e9f1d698
commit 068f122f00
4 changed files with 62 additions and 11 deletions

View File

@ -370,23 +370,23 @@ main menu, and physics files. Here is a listing of all chunks used within them:
| Name | Description |
| ---- | ----------- |
| `Minf` | Static Map Info structure |
| `PNTS` | Array of Points |
| `EPNT` | Array of Endpoints |
| `LINS` | Array of Lines |
| `SIDS` | Array of Sides |
| `POLY` | Array of Polygons |
| `LITE` | Array of Lights |
| `PNTS` | Array of Point |
| `EPNT` | Array of Endpoint |
| `LINS` | Array of Line |
| `SIDS` | Array of Side |
| `POLY` | Array of Polygon |
| `LITE` | Array of Light |
| `NOTE` | Not analyzed (annotations) |
| `OBJS` | Array of Objects |
| `OBJS` | Array of Object |
| `påth` | Not analyzed (å is $8C) (guardpaths) |
| `plac` | Not analyzed (item placement) |
| `plac` | Array of Object Frequency |
| `door` | No test data (extra door data) |
| `plat` | No test data (platform data) |
| `PLAT` | Not analyzed (saved platform data) |
| `medi` | Array of Media Data |
| `ambi` | Array of Ambient Sounds |
| `bonk` | Array of Random Sounds |
| `term` | Array of Terminals |
| `ambi` | Array of Ambient Sound |
| `bonk` | Array of Random Sound |
| `term` | Array of Terminal |
| `iidx` | Not analyzed (saved map indices) |
| `ShPa` | Not analyzed (shapes) |
| `MMLS` | Not analyzed (MML scripts) |
@ -761,6 +761,21 @@ Object is 16 bytes.
- `Flags` is a Map Object Flags bit field, and the upper 4 bits are the
activation bias for monsters.
### Object Frequency ###
Object Frequency is 12 bytes.
| Name | Type | Offset |
| ---- | ---- | ------ |
| `Flags` | `u16` | `0` |
| `CountInit` | `u16` | `2` |
| `CountMin` | `u16` | `4` |
| `CountMax` | `u16` | `6` |
| `CountRand` | `u16` | `8` |
| `Chance` | `u16` | `10` |
- `Flags` is an Object Frequency Flags bit field.
### Ambient Sound ###
Ambient Sound is 16 bytes.
@ -1796,4 +1811,10 @@ gravity.
- `SoundObstruct` means the media makes no sound when under the floor. This is
most sensible for, for instance, lava which can be drained.
### Object Frequency Flags ###
| Name | Bit |
| ---- | --- |
| `RandomLocation` | `0` |
<!-- EOF -->

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"plac" => make_yaml(opt, &rd_array(cnk, map::read_plac)?)?,
b"ambi" => make_yaml(opt, &rd_array(cnk, map::read_ambi)?)?,
b"bonk" => make_yaml(opt, &rd_array(cnk, map::read_bonk)?)?,
b"medi" => make_yaml(opt, &rd_array(cnk, map::read_medi)?)?,

View File

@ -218,6 +218,23 @@ 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_plac(b: &[u8]) -> ResultS<(ObjectFreq, usize)>
{
read_data! {
12, BE in b =>
flags = u16[0];
cnt_ini = u16[2];
cnt_min = u16[4];
cnt_max = u16[6];
cnt_rnd = u16[8];
chance = u16[10];
}
let rnd_loc = flags != 0;
Ok((ObjectFreq{rnd_loc, cnt_ini, cnt_min, cnt_max, cnt_rnd, chance}, 12))
}
pub fn read_ambi(b: &[u8]) -> ResultS<(SoundAmbi, usize)>
{
read_data! {
@ -391,6 +408,17 @@ pub struct Object
pub bias: u16,
}
#[derive(Debug, Serialize)]
pub struct ObjectFreq
{
rnd_loc: bool,
cnt_ini: u16,
cnt_min: u16,
cnt_max: u16,
cnt_rnd: u16,
chance: u16,
}
#[derive(Debug, Serialize)]
pub struct SoundAmbi
{

View File

@ -27,6 +27,7 @@ impl Wad<'_>
Ver::Base => true,
_ => false,
};
let entsize = if !is_old {10} else {8 };
let cnksize = if !is_old {16} else {12};