PRpx loader
parent
352f6f4086
commit
961e0d6de0
162
MarathonData.md
162
MarathonData.md
|
@ -989,35 +989,38 @@ Effect Definition is 14 bytes.
|
|||
|
||||
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` |
|
||||
| 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` |
|
||||
| `TriggerPri` | `struct` | `62` |
|
||||
| `TriggerSec` | `struct` | `98` |
|
||||
|
||||
- `WeaponClass` is a Weapon Type enumeration.
|
||||
- `Flags` is a Weapon Flags bit field.
|
||||
- `TriggerPri` and `TriggerSec` are Trigger Definition structures used for the
|
||||
primary and secondary fire buttons.
|
||||
|
||||
### Trigger Definition ###
|
||||
|
||||
|
@ -1046,6 +1049,49 @@ Trigger Definition is 36 bytes.
|
|||
|
||||
- `CasingType` is a Casing Type enumeration.
|
||||
|
||||
### Projectile Definition ###
|
||||
|
||||
Projectile Definition is 48 bytes.
|
||||
|
||||
| Name | Type | Offset |
|
||||
| ---- | ---- | ------ |
|
||||
| `Collection` | `u16opt` | `0` |
|
||||
| `Shape` | `u16` | `2` |
|
||||
| `FxExplode` | `u16opt` | `4` |
|
||||
| `FxExplodeMed` | `u16opt` | `6` |
|
||||
| `FxTrail` | `u16opt` | `8` |
|
||||
| `TicksTrail` | `u16` | `10` |
|
||||
| `MaxTrails` | `u16opt` | `12` |
|
||||
| `MediaType` | `u16opt` | `14` |
|
||||
| `Radius` | `unit` | `16` |
|
||||
| `AreaOfEffect` | `unit` | `18` |
|
||||
| `Damage` | `struct` | `20` |
|
||||
| `Flags` | `u32` | `32` |
|
||||
| `Speed` | `unit` | `36` |
|
||||
| `Range` | `unit` | `38` |
|
||||
| `SndPitch` | `fixed` | `40` |
|
||||
| `SndFly` | `u16opt` | `44` |
|
||||
| `SndBounce` | `u16opt` | `46` |
|
||||
|
||||
- `MediaType` is the type of projectile this becomes when below media.
|
||||
- `Damage` is a Damage Definition structure.
|
||||
- `Flags` is a Projectile Flags bit field.
|
||||
|
||||
### Damage Definition ###
|
||||
|
||||
Damage Definition is 12 bytes.
|
||||
|
||||
| Name | Type | Offset |
|
||||
| ---- | ---- | ------ |
|
||||
| `Type` | `u16` | `0` |
|
||||
| `Flags` | `u16` | `2` |
|
||||
| `DmgBase` | `u16` | `4` |
|
||||
| `DmgRand` | `u16` | `6` |
|
||||
| `Scale` | `fixed` | `8` |
|
||||
|
||||
- `Type` is a Damage Type enumeration.
|
||||
- `Flags` is a Damage Flags enumeration.
|
||||
|
||||
## Images ##
|
||||
|
||||
### Picture Resource ###
|
||||
|
@ -1760,6 +1806,36 @@ over for editor preset usage.
|
|||
| `SMG` | `4` |
|
||||
| `None` | `65535` |
|
||||
|
||||
### Damage Type ###
|
||||
|
||||
| Name | Value |
|
||||
| ---- | ----- |
|
||||
| `Explosion` | `0` |
|
||||
| `ElectricalStaff` | `1` |
|
||||
| `Projectile` | `2` |
|
||||
| `Absorbed` | `3` |
|
||||
| `Flame` | `4` |
|
||||
| `HoundClaws` | `5` |
|
||||
| `AlienProjectile` | `6` |
|
||||
| `HulkSlap` | `7` |
|
||||
| `CompilerBolt` | `8` |
|
||||
| `FusionBolt` | `9` |
|
||||
| `HunterBolt` | `10` |
|
||||
| `Fist` | `11` |
|
||||
| `Teleporter` | `12` |
|
||||
| `Defender` | `13` |
|
||||
| `YetiClaws` | `14` |
|
||||
| `YetiProjectile` | `15` |
|
||||
| `Crushing` | `16` |
|
||||
| `Lava` | `17` |
|
||||
| `Suffocation` | `18` |
|
||||
| `Goo` | `19` |
|
||||
| `EnergyDrain` | `20` |
|
||||
| `OxygenDrain` | `21` |
|
||||
| `HummerBolt` | `22` |
|
||||
| `ShotgunProjectile` | `23` |
|
||||
| `None` | `65535` |
|
||||
|
||||
# FLAGS #######################################################################
|
||||
|
||||
### Endpoint Flags ###
|
||||
|
@ -2040,4 +2116,38 @@ this actually hurts my head.
|
|||
| `TriggerSameAmmo` | `9` |
|
||||
| `SecondaryFlip` | `10` |
|
||||
|
||||
### Damage Flags ###
|
||||
|
||||
| Name | Bit |
|
||||
| ---- | --- |
|
||||
| `AlienDamage` | `0` |
|
||||
|
||||
- `AlienDamage` will decrease the damage on Easy and Wuss.
|
||||
|
||||
### Projectile Flags ###
|
||||
|
||||
| Name | Bit |
|
||||
| ---- | --- |
|
||||
| `Guided` | `0` |
|
||||
| `StopOnLoop` | `1` |
|
||||
| `Persistent` | `2` |
|
||||
| `Alien` | `3` |
|
||||
| `Gravity` | `4` |
|
||||
| `NoHorzError` | `5` |
|
||||
| `NoVertError` | `6` |
|
||||
| `TogglePanels` | `7` |
|
||||
| `PosVertError` | `8` |
|
||||
| `Melee` | `9` |
|
||||
| `Ripper` | `10` |
|
||||
| `PassTransRandom` | `11` |
|
||||
| `PassTransMore` | `12` |
|
||||
| `DoubleGravity` | `13` |
|
||||
| `ReboundFloor` | `14` |
|
||||
| `ThroughMedia` | `15` |
|
||||
| `BecomeItem` | `16` |
|
||||
| `Bloody` | `17` |
|
||||
| `WanderHorz` | `18` |
|
||||
| `UseLowGrav` | `19` |
|
||||
| `PassMedia` | `20` |
|
||||
|
||||
<!-- EOF -->
|
||||
|
|
|
@ -63,8 +63,9 @@ fn dump_chunk(opt: &Options, cid: Ident, cnk: &[u8], eid: u16) -> ResultS<()>
|
|||
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)?)?,
|
||||
b"PXpx" => make_yaml(opt, &rd_array(cnk, phy::read_pxpx)?)?,
|
||||
b"FXpx" => make_yaml(opt, &rd_array(cnk, phy::read_fxpx)?)?,
|
||||
b"PRpx" => make_yaml(opt, &rd_array(cnk, phy::read_prpx)?)?,
|
||||
b"PXpx" => make_yaml(opt, &rd_array(cnk, phy::read_pxpx)?)?,
|
||||
b"WPpx" => make_yaml(opt, &rd_array(cnk, phy::read_wppx)?)?,
|
||||
_ => (),
|
||||
}
|
||||
|
|
|
@ -98,6 +98,36 @@ pub fn read_wppx(b: &[u8]) -> ResultS<(Weapon, usize)>
|
|||
typ_powerup, typ_weapon, wid_idle}, 134))
|
||||
}
|
||||
|
||||
pub fn read_prpx(b: &[u8]) -> ResultS<(Projectile, usize)>
|
||||
{
|
||||
read_data! {
|
||||
48, BE in b =>
|
||||
collection = OptU16[0];
|
||||
shape = u16[2];
|
||||
fxt_explode = OptU16[4];
|
||||
fxt_exp_media = OptU16[6];
|
||||
fxt_trail = OptU16[8];
|
||||
tic_trail = u16[10];
|
||||
max_trail = OptU16[12];
|
||||
typ_media = OptU16[14];
|
||||
radius = Unit[16];
|
||||
dmg_rad = Unit[18];
|
||||
dmg_def = read_damage[20..32];
|
||||
flags = u32[32];
|
||||
speed = Unit[36];
|
||||
range = Unit[38];
|
||||
snd_pitch = Fixed[40];
|
||||
snd_fly = OptU16[44];
|
||||
snd_bounce = OptU16[46];
|
||||
}
|
||||
|
||||
let flags = flag_ok!(ProjectileFlags, flags)?;
|
||||
|
||||
Ok((Projectile{collection, shape, fxt_explode, fxt_exp_media, fxt_trail,
|
||||
tic_trail, max_trail, typ_media, radius, dmg_rad, dmg_def,
|
||||
flags, speed, range, snd_pitch, snd_fly, snd_bounce}, 48))
|
||||
}
|
||||
|
||||
fn read_trigger(b: &[u8]) -> ResultS<Trigger>
|
||||
{
|
||||
read_data! {
|
||||
|
@ -129,6 +159,23 @@ fn read_trigger(b: &[u8]) -> ResultS<Trigger>
|
|||
tic_recover, tic_round, typ_ammo, typ_casing, typ_proj})
|
||||
}
|
||||
|
||||
fn read_damage(b: &[u8]) -> ResultS<Damage>
|
||||
{
|
||||
read_data! {
|
||||
12, BE in b =>
|
||||
dtype = u16[0];
|
||||
flags = u16[2];
|
||||
dmg_base = u16[4];
|
||||
dmg_rand = u16[6];
|
||||
scale = Fixed[8];
|
||||
}
|
||||
|
||||
let dtype = DamageType::from_repr(dtype)?;
|
||||
let alien = flags != 0;
|
||||
|
||||
Ok(Damage{dtype, alien, dmg_base, dmg_rand, scale})
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
pub struct Physics
|
||||
{
|
||||
|
@ -224,6 +271,38 @@ pub struct Trigger
|
|||
pub typ_proj: u16,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
pub struct Projectile
|
||||
{
|
||||
pub collection: OptU16,
|
||||
pub shape: u16,
|
||||
pub fxt_explode: OptU16,
|
||||
pub fxt_exp_media: OptU16,
|
||||
pub fxt_trail: OptU16,
|
||||
pub tic_trail: u16,
|
||||
pub max_trail: OptU16,
|
||||
pub typ_media: OptU16,
|
||||
pub radius: Unit,
|
||||
pub dmg_rad: Unit,
|
||||
pub dmg_def: Damage,
|
||||
pub flags: ProjectileFlags,
|
||||
pub speed: Unit,
|
||||
pub range: Unit,
|
||||
pub snd_pitch: Fixed,
|
||||
pub snd_fly: OptU16,
|
||||
pub snd_bounce: OptU16,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
pub struct Damage
|
||||
{
|
||||
pub dtype: DamageType,
|
||||
pub alien: bool,
|
||||
pub dmg_base: u16,
|
||||
pub dmg_rand: u16,
|
||||
pub scale: Fixed,
|
||||
}
|
||||
|
||||
bitflags! {
|
||||
#[derive(Serialize)]
|
||||
pub struct EffectFlags: u16
|
||||
|
@ -254,6 +333,34 @@ bitflags! {
|
|||
}
|
||||
}
|
||||
|
||||
bitflags! {
|
||||
#[derive(Serialize)]
|
||||
pub struct ProjectileFlags: u32
|
||||
{
|
||||
const Guided = 1;
|
||||
const StopOnLoop = 1 << 1;
|
||||
const Persistent = 1 << 2;
|
||||
const Alien = 1 << 3;
|
||||
const Gravity = 1 << 4;
|
||||
const NoHorzError = 1 << 5;
|
||||
const NoVertError = 1 << 6;
|
||||
const TogglePanels = 1 << 7;
|
||||
const PosVertError = 1 << 8;
|
||||
const Melee = 1 << 9;
|
||||
const Ripper = 1 << 10;
|
||||
const PassTransRandom = 1 << 11;
|
||||
const PassTransMore = 1 << 12;
|
||||
const DoubleGravity = 1 << 13;
|
||||
const ReboundFloor = 1 << 14;
|
||||
const ThroughMedia = 1 << 15;
|
||||
const BecomeItem = 1 << 16;
|
||||
const Bloody = 1 << 17;
|
||||
const WanderHorz = 1 << 18;
|
||||
const UseLowGrav = 1 << 19;
|
||||
const PassMedia = 1 << 20;
|
||||
}
|
||||
}
|
||||
|
||||
c_enum! {
|
||||
#[derive(Debug, Serialize)]
|
||||
pub enum CasingType: u16
|
||||
|
@ -279,4 +386,36 @@ c_enum! {
|
|||
}
|
||||
}
|
||||
|
||||
c_enum! {
|
||||
#[derive(Debug, Serialize)]
|
||||
pub enum DamageType: u16
|
||||
{
|
||||
0 => Explosion,
|
||||
1 => ElectricalStaff,
|
||||
2 => Projectile,
|
||||
3 => Absorbed,
|
||||
4 => Flame,
|
||||
5 => HoundClaws,
|
||||
6 => AlienProjectile,
|
||||
7 => HulkSlap,
|
||||
8 => CompilerBolt,
|
||||
9 => FusionBolt,
|
||||
10 => HunterBolt,
|
||||
11 => Fist,
|
||||
12 => Teleporter,
|
||||
13 => Defender,
|
||||
14 => YetiClaws,
|
||||
15 => YetiProjectile,
|
||||
16 => Crushing,
|
||||
17 => Lava,
|
||||
18 => Suffocation,
|
||||
19 => Goo,
|
||||
20 => EnergyDrain,
|
||||
21 => OxygenDrain,
|
||||
22 => HummerBolt,
|
||||
23 => ShotgunProjectile,
|
||||
65535 => None,
|
||||
}
|
||||
}
|
||||
|
||||
// EOF
|
||||
|
|
Loading…
Reference in New Issue