partial plat loading
parent
068f122f00
commit
a26f182852
|
@ -381,7 +381,7 @@ main menu, and physics files. Here is a listing of all chunks used within them:
|
|||
| `påth` | Not analyzed (å is $8C) (guardpaths) |
|
||||
| `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 Sound |
|
||||
|
@ -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.
|
||||
|
||||
|
@ -776,6 +777,25 @@ Object Frequency is 12 bytes.
|
|||
|
||||
- `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.
|
||||
|
@ -1598,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 ###
|
||||
|
@ -1817,4 +1854,39 @@ most sensible for, for instance, lava which can be drained.
|
|||
| ---- | --- |
|
||||
| `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 -->
|
||||
|
|
|
@ -59,6 +59,7 @@ fn dump_chunk(opt: &Options, cid: Ident, cnk: &[u8], eid: u16) -> ResultS<()>
|
|||
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)?)?,
|
||||
_ => (),
|
||||
}
|
||||
|
|
|
@ -305,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
|
||||
{
|
||||
|
@ -458,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());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue