Game/AbilityAim.cs

Static utility that encodes directional aim input into a bitmask. It reads IPlayerInput flags and optionally includes recently released button presses depending on the simulation version.

Reflection
namespace BlockParty;

/// <summary>Directional aim before Jump is projected into movement. Kept independent of the
/// player so keyboard, controller and replay snapshots share the same rules.</summary>
public static class AbilityAim
{
	public static int ReadMask( IPlayerInput input, int simVersion )
	{
		bool includeReleasedPresses = simVersion < Sim.CURRENT_ABILITY_AIM;
		return (input.Left || (includeReleasedPresses && input.LeftJust) ? 1 : 0)
			| (input.Right || (includeReleasedPresses && input.RightJust) ? 2 : 0)
			| (input.Up || (includeReleasedPresses && input.UpJust) ? 4 : 0)
			| (input.Down || (includeReleasedPresses && input.DownJust) ? 8 : 0);
	}
}