WPpx loader
parent
fe2f830f3e
commit
352f6f4086
100
MarathonData.md
100
MarathonData.md
|
@ -395,7 +395,7 @@ main menu, and physics files. Here is a listing of all chunks used within them:
|
|||
| `MNpx` | Monster definitions |
|
||||
| `PRpx` | Player definitions |
|
||||
| `PXpx` | Array of Physics Definition |
|
||||
| `WPpx` | Weapon definitions |
|
||||
| `WPpx` | Array of Weapon Definition |
|
||||
| `PICT` | Picture Resource |
|
||||
| `clut` | Unused(?) |
|
||||
|
||||
|
@ -985,6 +985,67 @@ Effect Definition is 14 bytes.
|
|||
|
||||
- `Flags` is an Effect Definition Flags bit field.
|
||||
|
||||
### Weapon Definition ###
|
||||
|
||||
Weapon Definition is 134 bytes.
|
||||
|
||||
| Name | Type | Offset |
|
||||
| ---- | ---- | ------ |
|
||||
| `ItemType` | `u16` | `0` |
|
||||
| `PowerupType` | `u16` | `2` |
|
||||
| `WeaponClass` | `u16` | `4` |
|
||||
| `Flags` | `u16` | `6` |
|
||||
| `LightValue` | `fixed` | `8` |
|
||||
| `LightDecay` | `u16` | `12` |
|
||||
| `HeightIdle` | `fixed` | `14` |
|
||||
| `AmpBob` | `fixed` | `18` |
|
||||
| `HeightKick` | `fixed` | `22` |
|
||||
| `HeightReload` | `fixed` | `26` |
|
||||
| `WidthIdle` | `fixed` | `30` |
|
||||
| `AmpHorz` | `fixed` | `34` |
|
||||
| `Collection` | `u16` | `38` |
|
||||
| `FrameIdle` | `u16` | `40` |
|
||||
| `FrameFiring` | `u16` | `42` |
|
||||
| `FrameReload` | `u16` | `44` |
|
||||
| `FrameCharge` | `u16` | `48` |
|
||||
| `FrameCharged` | `u16` | `50` |
|
||||
| `TicksReady` | `u16` | `52` |
|
||||
| `TicksLoadBeg` | `u16` | `54` |
|
||||
| `TicksLoadMid` | `u16` | `56` |
|
||||
| `TicksLoadEnd` | `u16` | `58` |
|
||||
| `TicksPowerup` | `u16` | `60` |
|
||||
| `Triggers` | `struct[2]` | `62` |
|
||||
|
||||
- `WeaponClass` is a Weapon Type enumeration.
|
||||
- `Flags` is a Weapon Flags bit field.
|
||||
|
||||
### Trigger Definition ###
|
||||
|
||||
Trigger Definition is 36 bytes.
|
||||
|
||||
| Name | Type | Offset |
|
||||
| ---- | ---- | ------ |
|
||||
| `MagRounds` | `u16` | `0` |
|
||||
| `AmmoType` | `u16` | `2` |
|
||||
| `TicksRound` | `u16` | `4` |
|
||||
| `TicksRecover` | `u16` | `6` |
|
||||
| `TicksCharge` | `u16` | `8` |
|
||||
| `Recoil` | `unit` | `10` |
|
||||
| `SoundFire` | `u16` | `12` |
|
||||
| `SoundClick` | `u16` | `14` |
|
||||
| `SoundCharge` | `u16` | `16` |
|
||||
| `SoundCasing` | `u16` | `18` |
|
||||
| `SoundReload` | `u16` | `20` |
|
||||
| `SoundCharged` | `u16` | `22` |
|
||||
| `Projectile` | `u16` | `24` |
|
||||
| TODO | `u16` | `26` |
|
||||
| TODO | `i16` | `28` |
|
||||
| TODO | `i16` | `30` |
|
||||
| `CasingType` | `u16` | `32` |
|
||||
| `BurstCount` | `u16` | `34` |
|
||||
|
||||
- `CasingType` is a Casing Type enumeration.
|
||||
|
||||
## Images ##
|
||||
|
||||
### Picture Resource ###
|
||||
|
@ -1678,6 +1739,27 @@ unobstructed.
|
|||
This apparently used to do something, but now does nothing, and is merely left
|
||||
over for editor preset usage.
|
||||
|
||||
### Weapon Type ###
|
||||
|
||||
| Name | Value |
|
||||
| ---- | ----- |
|
||||
| `Melee` | `0` |
|
||||
| `Normal` | `1` |
|
||||
| `DualFunc` | `2` |
|
||||
| `DualPistol` | `3` |
|
||||
| `Multipurpose` | `4` |
|
||||
|
||||
### Casing Type ###
|
||||
|
||||
| Name | Value |
|
||||
| ---- | ----- |
|
||||
| `Rifle` | `0` |
|
||||
| `Pistol` | `1` |
|
||||
| `PistolLeft` | `2` |
|
||||
| `PistolRight` | `3` |
|
||||
| `SMG` | `4` |
|
||||
| `None` | `65535` |
|
||||
|
||||
# FLAGS #######################################################################
|
||||
|
||||
### Endpoint Flags ###
|
||||
|
@ -1942,4 +2024,20 @@ this actually hurts my head.
|
|||
| `MakeTwinVisible` | `3` |
|
||||
| `MediaEffect` | `4` |
|
||||
|
||||
### Weapon Flags ###
|
||||
|
||||
| Name | Bit |
|
||||
| ---- | --- |
|
||||
| `Automatic` | `0` |
|
||||
| `RemoveAfterUse` | `1` |
|
||||
| `InstantCasing` | `2` |
|
||||
| `Overloads` | `3` |
|
||||
| `RandomAmmo` | `4` |
|
||||
| `TemporaryPower` | `5` |
|
||||
| `ReloadOneHand` | `6` |
|
||||
| `FireOutOfPhase` | `7` |
|
||||
| `FireUnderMedia` | `8` |
|
||||
| `TriggerSameAmmo` | `9` |
|
||||
| `SecondaryFlip` | `10` |
|
||||
|
||||
<!-- EOF -->
|
||||
|
|
|
@ -65,6 +65,7 @@ fn dump_chunk(opt: &Options, cid: Ident, cnk: &[u8], eid: u16) -> ResultS<()>
|
|||
b"term" => make_yaml(opt, &rd_array(cnk, trm::read_term)?)?,
|
||||
b"PXpx" => make_yaml(opt, &rd_array(cnk, phy::read_pxpx)?)?,
|
||||
b"FXpx" => make_yaml(opt, &rd_array(cnk, phy::read_fxpx)?)?,
|
||||
b"WPpx" => make_yaml(opt, &rd_array(cnk, phy::read_wppx)?)?,
|
||||
_ => (),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,6 +57,78 @@ pub fn read_fxpx(b: &[u8]) -> ResultS<(Effect, usize)>
|
|||
Ok((Effect{collection, shape, pitch, flags, delay, delay_snd}, 14))
|
||||
}
|
||||
|
||||
pub fn read_wppx(b: &[u8]) -> ResultS<(Weapon, usize)>
|
||||
{
|
||||
read_data! {
|
||||
134, BE in b =>
|
||||
typ_item = u16[0];
|
||||
typ_powerup = OptU16[2];
|
||||
typ_weapon = u16[4];
|
||||
flags = u16[6];
|
||||
lit_value = Fixed[8];
|
||||
lit_decay = u16[12];
|
||||
hei_idle = Fixed[14];
|
||||
amp_bob = Fixed[18];
|
||||
hei_kick = Fixed[22];
|
||||
hei_reload = Fixed[26];
|
||||
wid_idle = Fixed[30];
|
||||
amp_horz = Fixed[34];
|
||||
collection = u16[38];
|
||||
frm_idle = u16[40];
|
||||
frm_firing = u16[42];
|
||||
frm_reload = OptU16[44];
|
||||
frm_charge = OptU16[48];
|
||||
frm_charged = OptU16[50];
|
||||
tic_ready = u16[52];
|
||||
tic_load_beg = u16[54];
|
||||
tic_load_mid = u16[56];
|
||||
tic_load_end = u16[58];
|
||||
tic_powerup = u16[60];
|
||||
trig_pri = read_trigger[62..98];
|
||||
trig_sec = read_trigger[98..134];
|
||||
}
|
||||
|
||||
let typ_weapon = WeaponType::from_repr(typ_weapon)?;
|
||||
let flags = flag_ok!(WeaponFlags, flags)?;
|
||||
|
||||
Ok((Weapon{amp_bob, amp_horz, collection, flags, frm_charge, frm_charged,
|
||||
frm_firing, frm_idle, frm_reload, hei_idle, hei_kick, hei_reload,
|
||||
lit_decay, lit_value, tic_load_beg, tic_load_end, tic_load_mid,
|
||||
tic_powerup, tic_ready, trig_pri, trig_sec, typ_item,
|
||||
typ_powerup, typ_weapon, wid_idle}, 134))
|
||||
}
|
||||
|
||||
fn read_trigger(b: &[u8]) -> ResultS<Trigger>
|
||||
{
|
||||
read_data! {
|
||||
36, BE in b =>
|
||||
magazine = u16[0];
|
||||
typ_ammo = OptU16[2];
|
||||
tic_round = OptU16[4];
|
||||
tic_recover = u16[6];
|
||||
tic_charge = u16[8];
|
||||
recoil = Unit[10];
|
||||
snd_fire = OptU16[12];
|
||||
snd_click = OptU16[14];
|
||||
snd_charge = OptU16[16];
|
||||
snd_casing = OptU16[18];
|
||||
snd_reload = OptU16[20];
|
||||
snd_charged = OptU16[22];
|
||||
typ_proj = u16[24];
|
||||
theta = u16[26];
|
||||
dx = i16[28];
|
||||
dz = i16[30];
|
||||
typ_casing = u16[32];
|
||||
burst = u16[34];
|
||||
}
|
||||
|
||||
let typ_casing = CasingType::from_repr(typ_casing)?;
|
||||
|
||||
Ok(Trigger{burst, dx, dz, magazine, recoil, snd_casing, snd_charge,
|
||||
snd_charged, snd_click, snd_fire, snd_reload, theta, tic_charge,
|
||||
tic_recover, tic_round, typ_ammo, typ_casing, typ_proj})
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
pub struct Physics
|
||||
{
|
||||
|
@ -99,6 +171,59 @@ pub struct Effect
|
|||
pub delay_snd: OptU16,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
pub struct Weapon
|
||||
{
|
||||
pub amp_bob: Fixed,
|
||||
pub amp_horz: Fixed,
|
||||
pub collection: u16,
|
||||
pub flags: WeaponFlags,
|
||||
pub frm_charge: OptU16,
|
||||
pub frm_charged: OptU16,
|
||||
pub frm_firing: u16,
|
||||
pub frm_idle: u16,
|
||||
pub frm_reload: OptU16,
|
||||
pub hei_idle: Fixed,
|
||||
pub hei_kick: Fixed,
|
||||
pub hei_reload: Fixed,
|
||||
pub lit_decay: u16,
|
||||
pub lit_value: Fixed,
|
||||
pub tic_load_beg: u16,
|
||||
pub tic_load_end: u16,
|
||||
pub tic_load_mid: u16,
|
||||
pub tic_powerup: u16,
|
||||
pub tic_ready: u16,
|
||||
pub trig_pri: Trigger,
|
||||
pub trig_sec: Trigger,
|
||||
pub typ_item: u16,
|
||||
pub typ_powerup: OptU16,
|
||||
pub typ_weapon: WeaponType,
|
||||
pub wid_idle: Fixed,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
pub struct Trigger
|
||||
{
|
||||
pub burst: u16,
|
||||
pub dx: i16,
|
||||
pub dz: i16,
|
||||
pub magazine: u16,
|
||||
pub recoil: Unit,
|
||||
pub snd_casing: OptU16,
|
||||
pub snd_charge: OptU16,
|
||||
pub snd_charged: OptU16,
|
||||
pub snd_click: OptU16,
|
||||
pub snd_fire: OptU16,
|
||||
pub snd_reload: OptU16,
|
||||
pub theta: u16,
|
||||
pub tic_charge: u16,
|
||||
pub tic_recover: u16,
|
||||
pub tic_round: OptU16,
|
||||
pub typ_ammo: OptU16,
|
||||
pub typ_casing: CasingType,
|
||||
pub typ_proj: u16,
|
||||
}
|
||||
|
||||
bitflags! {
|
||||
#[derive(Serialize)]
|
||||
pub struct EffectFlags: u16
|
||||
|
@ -111,4 +236,47 @@ bitflags! {
|
|||
}
|
||||
}
|
||||
|
||||
bitflags! {
|
||||
#[derive(Serialize)]
|
||||
pub struct WeaponFlags: u16
|
||||
{
|
||||
const Automatic = 1;
|
||||
const RemoveAfterUse = 1 << 1;
|
||||
const InstantCasing = 1 << 2;
|
||||
const Overloads = 1 << 3;
|
||||
const RandomAmmo = 1 << 4;
|
||||
const TemporaryPower = 1 << 5;
|
||||
const ReloadOneHand = 1 << 6;
|
||||
const FireOutOfPhase = 1 << 7;
|
||||
const FireUnderMedia = 1 << 8;
|
||||
const TriggerSameAmmo = 1 << 9;
|
||||
const SecondaryFlip = 1 << 10;
|
||||
}
|
||||
}
|
||||
|
||||
c_enum! {
|
||||
#[derive(Debug, Serialize)]
|
||||
pub enum CasingType: u16
|
||||
{
|
||||
0 => Rifle,
|
||||
1 => Pistol,
|
||||
2 => PistolLeft,
|
||||
3 => PistolRight,
|
||||
4 => SMG,
|
||||
65535 => None,
|
||||
}
|
||||
}
|
||||
|
||||
c_enum! {
|
||||
#[derive(Debug, Serialize)]
|
||||
pub enum WeaponType: u16
|
||||
{
|
||||
0 => Melee,
|
||||
1 => Normal,
|
||||
2 => DualFunc,
|
||||
3 => DualPistol,
|
||||
4 => Multipurpose,
|
||||
}
|
||||
}
|
||||
|
||||
// EOF
|
||||
|
|
Loading…
Reference in New Issue