fix side data interpretation
parent
24c3ccc680
commit
23871101b4
|
@ -633,7 +633,7 @@ Side is 64 bytes.
|
|||
| Point | Collision top-right | ExTRight |
|
||||
| Point | Collision bottom-left | ExBLeft |
|
||||
| Point | Collision bottom-right | ExBRight |
|
||||
| u16 | Control Panel Type | PanelType |
|
||||
| u16 | Control panel preset number | PanelType |
|
||||
| i16 | Control panel permutation | PanelPerm |
|
||||
| u16 | First texture transfer mode | XferPri |
|
||||
| u16 | Second texture transfer mode | XferSec |
|
||||
|
@ -1041,6 +1041,9 @@ exit upon reading them.
|
|||
|
||||
### Control Panel Type ###
|
||||
|
||||
This is used internally for each control panel preset and determines the
|
||||
permutation each one uses.
|
||||
|
||||
| Value | Description | Permutation | Name |
|
||||
| ----- | ----------- | ----------- | ---- |
|
||||
| 0 | Oxygen refuel | None | Oxygen |
|
||||
|
|
|
@ -55,6 +55,7 @@ fn read_side_tex(b: &[u8]) -> ResultS<SideTex>
|
|||
{
|
||||
let offs = Point::read(&b[0..4])?;
|
||||
let tex_id = b.c_u16b(4)?;
|
||||
let tex_id = if tex_id == 65535 {None} else {Some(tex_id)};
|
||||
Ok(SideTex{offs, tex_id})
|
||||
}
|
||||
|
||||
|
@ -80,13 +81,7 @@ impl Chunked<Side> for Side
|
|||
let xfer_tra = b.c_u16b(46)?;
|
||||
let shade = b.c_u32b(48)?;
|
||||
let flags = SideFlags::from_bits_truncate(flags);
|
||||
let paneltyp =
|
||||
if flags.contains(SideFlags::Panel) {
|
||||
Some(PanelType::from_repr(paneltyp)?)
|
||||
} else {
|
||||
None
|
||||
};
|
||||
let shade = Fx32::from_bits(shade);
|
||||
let shade = Fx32::from_bits(shade);
|
||||
Ok(Side{stype, flags, tex_pri, tex_sec, tex_tra, ex_tleft, ex_trigh,
|
||||
ex_bleft, ex_brigh, paneltyp, paneldat, xfer_pri, xfer_sec,
|
||||
xfer_tra, shade})
|
||||
|
@ -148,7 +143,7 @@ pub struct Line
|
|||
pub struct SideTex
|
||||
{
|
||||
offs: Point,
|
||||
tex_id: u16,
|
||||
tex_id: Option<u16>,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
|
@ -163,7 +158,7 @@ pub struct Side
|
|||
ex_trigh: Point,
|
||||
ex_bleft: Point,
|
||||
ex_brigh: Point,
|
||||
paneltyp: Option<PanelType>,
|
||||
paneltyp: u16,
|
||||
paneldat: i16,
|
||||
xfer_pri: u16,
|
||||
xfer_sec: u16,
|
||||
|
@ -262,22 +257,6 @@ bitflags! {
|
|||
}
|
||||
}
|
||||
|
||||
c_enum! {
|
||||
#[derive(Debug)]
|
||||
pub enum PanelType: u16
|
||||
{
|
||||
0 => Oxygen,
|
||||
1 => Shield,
|
||||
2 => Shield2x,
|
||||
3 => Shield3x,
|
||||
4 => Light,
|
||||
5 => Platform,
|
||||
6 => Tag,
|
||||
7 => PatternBuf,
|
||||
8 => Terminal,
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Debug for Point
|
||||
{
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result
|
||||
|
|
Loading…
Reference in New Issue