using AcDream.Core.Physics; using Xunit; namespace AcDream.Core.Tests.Physics; /// /// R4-V5 #160 fix: retail's apply_run_to_command (0x00527be0) run-rate /// chain is weenie ? (InqRunRate() ?: my_run_rate) : 1.0. Remote /// weenies FAIL InqRunRate, landing on my_run_rate — the field the mt-6/7 /// unpack writes with the wire's MoveToRunRate (M13). These pin that a /// RemoteWeenie-equipped interp scales the run promotion by MyRunRate /// (observer-side movetos ran in slow motion when the interp had no /// weenie and took the degenerate 1.0 branch). /// public class RemoteWeenieRunRateTests { [Fact] public void ApplyRunToCommand_RemoteWeenie_ScalesByWireRunRate() { var interp = new MotionInterpreter(new PhysicsBody()) { WeenieObj = new RemoteWeenie(), MyRunRate = 4.5f, // the mt-6 wire write (unpack @300603) }; uint motion = MotionCommand.WalkForward; float speed = 1.0f; interp.apply_run_to_command(ref motion, ref speed); Assert.Equal(MotionCommand.RunForward, motion); Assert.Equal(4.5f, speed, 3); } [Fact] public void ApplyRunToCommand_NoWeenie_KeepsRetailDegenerateBranch() { // Verbatim retail: a weenie-LESS (detached-class) object scales by // 1.0 (raw 305062-305076 `else x87_r7 = 1f`). Production bodies all // carry a weenie (player: PlayerWeenie; remotes: RemoteWeenie). var interp = new MotionInterpreter(new PhysicsBody()) { MyRunRate = 4.5f, }; uint motion = MotionCommand.WalkForward; float speed = 1.0f; interp.apply_run_to_command(ref motion, ref speed); Assert.Equal(MotionCommand.RunForward, motion); Assert.Equal(1.0f, speed, 3); } }