acdream/tests/AcDream.App.Tests/Input/LocalPlayerOutboundCombatStyleTests.cs
Erik 124e046976 fix(runtime): align portal and movement presentation
Port retail portal viewport projection and reveal behavior, preserve outbound combat style, drive remote and local grounded movement from authored CSequence root frames, and reuse the local prepared pose so animation hooks advance once.

User-verified portal, observer movement, combat stance, and short-tap locomotion gates. Release build passed with 5,767 tests and five intentional skips.

Co-authored-by: OpenAI Codex <codex@openai.com>
2026-07-17 08:48:27 +02:00

51 lines
1.7 KiB
C#

using System.Buffers.Binary;
using AcDream.App.Input;
using AcDream.App.Rendering;
using AcDream.Core.Net.Messages;
using AcDream.Core.Net.Packets;
using AcDream.Core.Physics;
namespace AcDream.App.Tests.Input;
public sealed class LocalPlayerOutboundCombatStyleTests
{
[Theory]
[InlineData(0x8000003Cu)] // HandCombat
[InlineData(0x8000003Eu)] // Magic
[InlineData(0x8000003Fu)] // BowCombat
[InlineData(0x80000041u)] // CrossbowCombat
public void CaptureAndBuild_PreservesCanonicalRawCombatStyle(uint combatStyle)
{
var controller = new PlayerMovementController(new PhysicsEngine());
controller.Motion.RawState.CurrentStyle = combatStyle;
MovementResult movement = controller.CaptureMovementResult(
mouseLookEvent: false);
RawMotionState outbound = GameWindow.BuildOutboundRawMotionState(
movement);
Assert.Equal(combatStyle, movement.CurrentStyle);
Assert.Equal(combatStyle, outbound.CurrentStyle);
var writer = new PacketWriter(16);
RawMotionStatePacker.Pack(writer, outbound);
byte[] bytes = writer.ToArray();
uint flags = BinaryPrimitives.ReadUInt32LittleEndian(bytes);
Assert.NotEqual(0u, flags & 0x2u);
Assert.Equal(
combatStyle,
BinaryPrimitives.ReadUInt32LittleEndian(bytes.AsSpan(4)));
}
[Fact]
public void CaptureAndBuild_NonCombatRetainsRetailDefault()
{
var controller = new PlayerMovementController(new PhysicsEngine());
RawMotionState outbound = GameWindow.BuildOutboundRawMotionState(
controller.CaptureMovementResult(mouseLookEvent: false));
Assert.Equal(RawMotionState.Default.CurrentStyle, outbound.CurrentStyle);
}
}