Add a pure Core projectile driver for retail clock quanta, final-state acceleration, 50-unit velocity clamping, world-space angular integration, full-3D AlignPath, and oriented Setup-local sphere sweeps. Preserve exact success versus set_frame-only failure semantics, independent Contact/OnWalkable state, and full-cell identity across all landblock directions. Port OBJECTINFO::missile_ignore with explicit weenie/creature metadata, remove the invented transition-step cap, retain PathClipped without arming PerfectClip, and keep authoritative target identity optional. Add malformed-shape/clock, thin-wall, terrain, target-exclusion, frame-spike, failure-state, and boundary conformance coverage. Retire TS-2 and synchronize the architecture, milestones, roadmap, research oracle, and durable physics memory. Co-Authored-By: Codex <noreply@openai.com>
75 lines
3.4 KiB
C#
75 lines
3.4 KiB
C#
namespace AcDream.Core.Physics;
|
|
|
|
/// <summary>
|
|
/// Per-entity flags driving the retail-faithful PvP / Player /
|
|
/// Impenetrable exemption logic in <c>FindObjCollisions</c>. Decoded
|
|
/// from <c>PublicWeenieDesc._bitfield</c> at <c>CreateObject</c> time.
|
|
///
|
|
/// <para>
|
|
/// Bit positions (verified against
|
|
/// <c>docs/research/named-retail/acclient_2013_pseudo_c.txt:406898-406918</c>
|
|
/// where <c>ACCWeenieObject::IsPK/IsPKLite/IsImpenetrable</c> read directly
|
|
/// from <c>this->pwd._bitfield</c>):
|
|
/// </para>
|
|
/// <list type="bullet">
|
|
/// <item><c>BF_PLAYER = 0x8</c> (bit 3) → <see cref="IsPlayer"/></item>
|
|
/// <item><c>BF_PLAYER_KILLER = 0x20</c> (bit 5) → <see cref="IsPK"/></item>
|
|
/// <item><c>BF_FREE_PKSTATUS = 0x200000</c> (bit 21) → <see cref="IsImpenetrable"/></item>
|
|
/// <item><c>BF_PKLITE_PKSTATUS = 0x2000000</c> (bit 25) → <see cref="IsPKLite"/></item>
|
|
/// </list>
|
|
///
|
|
/// <para>
|
|
/// <see cref="IsCreature"/> is NOT a PWD bit — retail derives it from
|
|
/// <c>PublicWeenieDesc._type</c> matching <c>ITEM_TYPE_CREATURE</c>
|
|
/// (acclient.h ITEM_TYPE enum). Set at registration time by callers that
|
|
/// already know the item type.
|
|
/// </para>
|
|
/// </summary>
|
|
[Flags]
|
|
public enum EntityCollisionFlags : byte
|
|
{
|
|
None = 0x00,
|
|
/// <summary>Set when <c>BF_PLAYER (0x8)</c> is set in <c>pwd._bitfield</c>.</summary>
|
|
IsPlayer = 0x01,
|
|
/// <summary>Derived from <c>ItemType.Creature</c> on the spawn payload.</summary>
|
|
IsCreature = 0x02,
|
|
/// <summary>Set when <c>BF_PLAYER_KILLER (0x20)</c> is set.</summary>
|
|
IsPK = 0x04,
|
|
/// <summary>Set when <c>BF_PKLITE_PKSTATUS (0x2000000)</c> is set.</summary>
|
|
IsPKLite = 0x08,
|
|
/// <summary>Set when <c>BF_FREE_PKSTATUS (0x200000)</c> is set (a.k.a. "Free" PK status — cannot be PKed).</summary>
|
|
IsImpenetrable = 0x10,
|
|
/// <summary>
|
|
/// Runtime collision metadata: the target has a retail
|
|
/// <c>CWeenieObject</c>. This is deliberately distinct from
|
|
/// <see cref="IsCreature"/> because doors, portals, and items also have a
|
|
/// weenie. <c>OBJECTINFO::missile_ignore</c> at <c>0x0050CEB0</c>
|
|
/// requires this distinction for ethereal targets.
|
|
/// </summary>
|
|
HasWeenie = 0x20,
|
|
}
|
|
|
|
/// <summary>Helpers to convert raw retail bitfields into <see cref="EntityCollisionFlags"/>.</summary>
|
|
public static class EntityCollisionFlagsExt
|
|
{
|
|
/// <summary>
|
|
/// Decode the player/PK/PKLite/Impenetrable bits from a
|
|
/// <c>PublicWeenieDesc._bitfield</c> value (the WeenieHeader trailer
|
|
/// field acdream's parser surfaces as <c>ObjectDescriptionFlags</c>).
|
|
///
|
|
/// <para>Bit positions per
|
|
/// <c>docs/research/named-retail/acclient.h:6431-6463</c>
|
|
/// (<c>PublicWeenieDesc::BitfieldIndex</c>) and
|
|
/// <c>acclient_2013_pseudo_c.txt:441868-441890</c>
|
|
/// (<c>PublicWeenieDesc::SetPlayerKillerStatus</c>).</para>
|
|
/// </summary>
|
|
public static EntityCollisionFlags FromPwdBitfield(uint bitfield)
|
|
{
|
|
var flags = EntityCollisionFlags.None;
|
|
if ((bitfield & 0x8u) != 0) flags |= EntityCollisionFlags.IsPlayer;
|
|
if ((bitfield & 0x20u) != 0) flags |= EntityCollisionFlags.IsPK;
|
|
if ((bitfield & 0x200000u) != 0) flags |= EntityCollisionFlags.IsImpenetrable;
|
|
if ((bitfield & 0x2000000u) != 0) flags |= EntityCollisionFlags.IsPKLite;
|
|
return flags;
|
|
}
|
|
}
|