Compare commits
3 Commits
c4e9f1d698
...
717e0c841a
Author | SHA1 | Date |
---|---|---|
an | 717e0c841a | |
an | a26f182852 | |
an | 068f122f00 |
125
MarathonData.md
125
MarathonData.md
|
@ -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` | Array of 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) |
|
||||
|
@ -401,10 +401,11 @@ main menu, and physics files. Here is a listing of all chunks used within them:
|
|||
|
||||
Map files can be identified by the Minf chunk.
|
||||
|
||||
Map files will always have either a PNTS or EPNT chunk, depending on what the
|
||||
map (and editor) use. PNTS are plain and have no more information than the
|
||||
actual position, while EPNT has flags and some extra stuff to help the engine
|
||||
load quicker (not that it needs it.)
|
||||
Map files will always have either a `PNTS` or `EPNT` chunk, depending on what
|
||||
the map (and editor) use. `PNTS` are plain and have no more information than
|
||||
the actual position, while `EPNT` can be loaded directly into memory by the
|
||||
engine. `EPNT` also tells the engine that the map is preprocessed and that an
|
||||
`iidx` chunk also exists.
|
||||
|
||||
Images can be identified by the PICT chunk.
|
||||
|
||||
|
@ -761,6 +762,40 @@ 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.
|
||||
|
||||
### Platform Data ###
|
||||
|
||||
Platform Data is 32 bytes.
|
||||
|
||||
| Name | Type | Offset |
|
||||
| ---- | ---- | ------ |
|
||||
| `Type` | `u16` | `0` |
|
||||
| `Speed` | `u16` | `2` |
|
||||
| `Delay` | `u16` | `4` |
|
||||
| `HeightMax` | `unit` | `6` |
|
||||
| `HeightMin` | `unit` | `8` |
|
||||
| `Flags` | `u32` | `10` |
|
||||
| `Index` | `u16` | `14` |
|
||||
| `Tag` | `u16` | `16` |
|
||||
|
||||
- `Type` is a Platform Type enumeration.
|
||||
- `Index` is the polygon this platform is attached to.
|
||||
- `Flags` is a Static Platform Flags bit field.
|
||||
|
||||
### Ambient Sound ###
|
||||
|
||||
Ambient Sound is 16 bytes.
|
||||
|
@ -1583,6 +1618,23 @@ unobstructed.
|
|||
| `Goo` | `2` |
|
||||
| `Sewage` | `3` |
|
||||
|
||||
### Platform Type ###
|
||||
|
||||
| Name | Value |
|
||||
| ---- | ----- |
|
||||
| `SphtDoor` | `0` |
|
||||
| `SphtDoorSplit` | `1` |
|
||||
| `SphtDoorLock` | `2` |
|
||||
| `SphtPlat` | `3` |
|
||||
| `SphtPlatNoisy` | `4` |
|
||||
| `SphtDoorHeavy` | `5` |
|
||||
| `PfhorDoor` | `6` |
|
||||
| `SphtPlatHeavy` | `7` |
|
||||
| `PfhorPlatform` | `8` |
|
||||
|
||||
This apparently used to do something, but now does nothing, and is merely left
|
||||
over for editor preset usage.
|
||||
|
||||
# FLAGS #######################################################################
|
||||
|
||||
### Endpoint Flags ###
|
||||
|
@ -1796,4 +1848,45 @@ 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` |
|
||||
|
||||
### Static Platform Flags ###
|
||||
|
||||
| Name | Bit |
|
||||
| ---- | --- |
|
||||
| `is_initially_active` | `0` |
|
||||
| `is_initially_extended` | `1` |
|
||||
| `deactivates_at_each_level` | `2` |
|
||||
| `deactivates_at_initial_level` | `3` |
|
||||
| `activates_adjacent_platforms_when_deactivating` | `4` |
|
||||
| `extends_floor_to_ceiling` | `5` |
|
||||
| `comes_from_floor` | `6` |
|
||||
| `comes_from_ceiling` | `7` |
|
||||
| `causes_damage` | `8` |
|
||||
| `does_not_activate_parent` | `9` |
|
||||
| `activates_only_once` | `10` |
|
||||
| `activates_light` | `11` |
|
||||
| `deactivates_light` | `12` |
|
||||
| `is_player_controllable` | `13` |
|
||||
| `is_monster_controllable` | `14` |
|
||||
| `reverses_direction_when_obstructed` | `15` |
|
||||
| `cannot_be_externally_deactivated` | `16` |
|
||||
| `uses_native_polygon_heights` | `17` |
|
||||
| `delays_before_activation` | `18` |
|
||||
| `activates_adjacent_platforms_when_activating` | `19` |
|
||||
| `deactivates_adjacent_platforms_when_activating` | `20` |
|
||||
| `deactivates_adjacent_platforms_when_deactivating` | `21` |
|
||||
| `contracts_slower` | `22` |
|
||||
| `activates_adjacent_platforms_at_each_level` | `23` |
|
||||
| `is_locked` | `24` |
|
||||
| `is_secret` | `25` |
|
||||
| `is_door` | `26` |
|
||||
|
||||
If I could explain to you why there are this many flags, I gladly would, but
|
||||
this actually hurts my head.
|
||||
|
||||
<!-- EOF -->
|
||||
|
|
|
@ -55,9 +55,11 @@ 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)?)?,
|
||||
b"plat" => make_yaml(opt, &rd_array(cnk, map::read_plat)?)?,
|
||||
b"term" => make_yaml(opt, &rd_array(cnk, trm::read_term)?)?,
|
||||
_ => (),
|
||||
}
|
||||
|
|
|
@ -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! {
|
||||
|
@ -288,6 +305,26 @@ pub fn read_medi(b: &[u8]) -> ResultS<(Media, usize)>
|
|||
min_lt, texture, xfer}, 32))
|
||||
}
|
||||
|
||||
pub fn read_plat(b: &[u8]) -> ResultS<(Platform, usize)>
|
||||
{
|
||||
read_data! {
|
||||
32, BE in b =>
|
||||
ptype = u16[0];
|
||||
speed = u16[2];
|
||||
delay = u16[4];
|
||||
hei_max = u16[6];
|
||||
hei_min = u16[8];
|
||||
flags = u32[10];
|
||||
index = u16[14];
|
||||
tag = u16[16];
|
||||
}
|
||||
|
||||
let hei_min = Unit::from_bits(hei_min);
|
||||
let hei_max = Unit::from_bits(hei_max);
|
||||
|
||||
Ok((Platform{ptype, speed, delay, hei_min, hei_max, flags, index, tag}, 32))
|
||||
}
|
||||
|
||||
#[derive(Clone, PartialEq, Serialize)]
|
||||
pub struct Point
|
||||
{
|
||||
|
@ -391,6 +428,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
|
||||
{
|
||||
|
@ -430,6 +478,19 @@ pub struct Media
|
|||
pub xfer: TransferMode,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
pub struct Platform
|
||||
{
|
||||
pub ptype: u16,
|
||||
pub speed: u16,
|
||||
pub delay: u16,
|
||||
pub hei_min: Unit,
|
||||
pub hei_max: Unit,
|
||||
pub flags: u32,
|
||||
pub index: u16,
|
||||
pub tag: u16,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize)]
|
||||
pub struct Minf
|
||||
{
|
||||
|
|
|
@ -82,9 +82,8 @@ fn read_pm_ind(mut im: Image8, b: &[u8], hdr: Header) -> ResultS<Image8>
|
|||
|
||||
p += pp;
|
||||
|
||||
for x in 0..im.w() {
|
||||
let idx = d[x] as usize;
|
||||
im.cr.push(ok!(clut.get(idx), "invalid index")?.clone());
|
||||
for &idx in &d {
|
||||
im.cr.push(ok!(clut.get(idx as usize), "invalid index")?.clone());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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};
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ fn get_clut_must_process_this()
|
|||
assert_eq!(get_clut(INPUT).unwrap(), (OUTPUT.to_vec(), 2056));
|
||||
}
|
||||
|
||||
const INPUT: &'static [u8] = include_bytes!("clut.in");
|
||||
const OUTPUT: [Color8; 256] = include!("clut.out");
|
||||
const INPUT: &'static [u8] = include_bytes!("data/clut.in");
|
||||
const OUTPUT: [Color8; 256] = include!("data/clut.out");
|
||||
|
||||
// EOF
|
||||
|
|
|
@ -6,7 +6,7 @@ fn read_epnt_must_process_this()
|
|||
assert_eq!(bin::rd_array(INPUT, map::read_epnt).unwrap(), OUTPUT.to_vec());
|
||||
}
|
||||
|
||||
const INPUT: &'static [u8] = include_bytes!("epnt.in");
|
||||
const OUTPUT: [map::Point; 54] = include!("epnt.out");
|
||||
const INPUT: &'static [u8] = include_bytes!("data/epnt.in");
|
||||
const OUTPUT: [map::Point; 54] = include!("data/epnt.out");
|
||||
|
||||
// EOF
|
||||
|
|
|
@ -9,6 +9,6 @@ fn macbin_must_process_this()
|
|||
assert_eq!(try_mac_header(INPUT_MACBIN), 128);
|
||||
}
|
||||
|
||||
const INPUT_MACBIN: &'static [u8] = include_bytes!("macbin.in");
|
||||
const INPUT_MACBIN: &'static [u8] = include_bytes!("data/macbin.in");
|
||||
|
||||
// EOF
|
||||
|
|
|
@ -14,6 +14,6 @@ fn read_minf_must_process_map0()
|
|||
});
|
||||
}
|
||||
|
||||
const INPUT: &'static [u8] = include_bytes!("minf.in");
|
||||
const INPUT: &'static [u8] = include_bytes!("data/minf.in");
|
||||
|
||||
// EOF
|
||||
|
|
Loading…
Reference in New Issue