import 'dart:math' as math;

/// Canonical player movement and rotation constants derived directly from the
/// original Wolfenstein 3D source code (WL_PLAY.C / WL_AGENT.C).
///
/// Source constants (keyboard, walking state):
///   BASEMOVE = 35, RUNMOVE = 70
///   MOVESCALE = 150, BACKMOVESCALE = 100
///   BASETURN = 35, RUNTURN = 70, ANGLESCALE = 20
///   TILEGLOBAL = 65536 (fixed-point units per tile), TICRATE = 70
abstract final class PlayerLocomotionConstants {
  static const double basemove = 35.0;
  static const double runmove = 70.0;
  static const double movescale = 150.0;
  static const double backmovescale = 100.0;
  static const double baseturn = 35.0;
  static const double runturn = 70.0;
  static const double anglescale = 20.0;
  static const double tileglobal = 65536.0;
  static const double ticrate = 70.0;

  /// Walking forward speed in tiles per second.
  ///
  /// Derived from: `(BASEMOVE * MOVESCALE * TICRATE) / TILEGLOBAL`
  static const double forwardTilesPerSecond =
      (basemove * movescale * ticrate) / tileglobal;

  /// Walking backward speed in tiles per second (intentionally slower than
  /// forward in the original game).
  ///
  /// Derived from: `(BASEMOVE * BACKMOVESCALE * TICRATE) / TILEGLOBAL`
  static const double backwardTilesPerSecond =
      (basemove * backmovescale * ticrate) / tileglobal;

  /// Walking turn rate in radians per second.
  ///
  /// Derived from: `(BASETURN / ANGLESCALE) * TICRATE` in degrees/sec,
  /// then converted to radians.
  static const double turnRadiansPerSecond =
      (baseturn / anglescale) * ticrate * (math.pi / 180.0);
}
