using System.Numerics; namespace GamePort.Game; /// 43A420 active Jimmy facing, followed by334→458F90→472480. /// Targets are retained caller state; all three axes take the shortest arc. /// Source4.5/3.7 constants are doubles and delta parameters publish as floats. public static class JimmyOrientation { public static Vector3 Step(Vector3 current,Vector3 target,float seconds,bool enabled=true,bool dirty=true) { if(!float.IsFinite(current.X)||!float.IsFinite(current.Y)||!float.IsFinite(current.Z) ||!float.IsFinite(target.X)||!float.IsFinite(target.Y)||!float.IsFinite(target.Z) ||!float.IsFinite(seconds)||seconds<0||seconds>=1) throw new ArgumentOutOfRangeException(nameof(seconds)); if(!enabled||!dirty)return current; static float Arc(float value)=>value>180?value-360:value< -180?value+360:value; static double WideArc(double value)=>value>180?value-360:value< -180?value+360:value; var x=Arc(target.X-current.X);var y=Arc(target.Y-current.Y); //X/Y differences have explicit float stack stores. The Z difference //remains on x87 until its final float argument publication. var z=WideArc((double)target.Z-current.Z); var delta=new Vector3((float)((double)x*seconds*4.5),(float)((double)y*seconds*3.7),(float)(z*seconds*4.5)); return RocketOrientation.Add(current,delta); } }