Enhance animation and control tests; improve rendering and shape loading validation

- Added tests for player animations in animation_archive_tests to ensure all animations are loaded correctly.
- Updated entity_dispatch_entry_tests to validate animation direction updates and added tests for sixteen-direction animations.
- Expanded isometric_controls_tests with comprehensive key event handling and action requests for various controller states.
- Improved map_renderer_tests by adding viewport rendering tests to compare unbounded and bounded views.
- Enhanced shape_archive_tests to validate shape frame loading and decoding consistency.
This commit is contained in:
Maddo 2026-10-07 00:18:08 +02:00
commit a76b071049
28 changed files with 1608 additions and 154 deletions

View file

@ -997,6 +997,10 @@ int main()
assert(animationKernel.startAnimPrimitiveProcess(3, animationItems, walking));
const auto* npcAnimation = animationItems.findNpcAnimation(1);
assert(npcAnimation && npcAnimation->lastAnimation == 1 && npcAnimation->frame == 0);
assert(animationKernel.updateAnimPrimitiveDirection(3, animationItems, 7) == 6);
assert(animation->extra[6] == 6 && npcAnimation->frame == 0 && npcAnimation->direction == 6);
assert(animationKernel.updateAnimPrimitiveDirection(3, animationItems, 0x11) == 8);
assert(animationKernel.updateAnimPrimitiveDirection(3, animationItems, 0x12) == 6);
assert(!animationKernel.startAnimPrimitiveProcess(3, animationItems, walking));
auto* repeatedWalk = animationKernel.createAnimPrimitiveProcess(1, 1, 1, 6, walking, animationGroups);
assert(animationKernel.startAnimPrimitiveProcess(4, animationItems, walking));
@ -1004,6 +1008,21 @@ int main()
auto* turning = animationKernel.createAnimPrimitiveProcess(1, 1, 0, 6, walking, animationGroups);
assert(animationKernel.startAnimPrimitiveProcess(5, animationItems, walking));
assert(turning->base.bytes[0x3a] == 1 && animationItems.findNpcAnimation(1)->frame == 0);
remorse::ProcessKernel sixteenDirectionKernel;
remorse::u16 sixteenDirectionGroups[32]{};
for (int reservedSlot = 0; reservedSlot < 3; ++reservedSlot) {
sixteenDirectionKernel.createProcess(1, sixteenDirectionGroups);
}
auto sixteenWalking = walking;
sixteenWalking.header[3] |= 0x40;
auto* sixteenDirection = sixteenDirectionKernel.createAnimPrimitiveProcess(1, 1, 1, 6,
sixteenWalking, sixteenDirectionGroups);
remorse::LiveFixedMapItems sixteenItems({});
assert(sixteenItems.initializeAvatar());
assert(sixteenDirectionKernel.startAnimPrimitiveProcess(3, sixteenItems, sixteenWalking));
assert(sixteenDirectionKernel.updateAnimPrimitiveDirection(3, sixteenItems, 0x11) == 15);
assert(sixteenDirection->extra[6] == 15);
assert(sixteenDirectionKernel.updateAnimPrimitiveDirection(3, sixteenItems, 0x12) == 14);
remorse::StagedFixedMapItem animationSpawn{};
animationSpawn.data.x = 512;
animationSpawn.data.y = 512;
@ -1022,6 +1041,11 @@ int main()
walking, animationShapes, animationArea) == true);
assert(animationItems.findItem(1)->data.x == 514 && animationItems.findItem(1)->data.y == 514);
assert(movingNpc.frame == 1);
nextWalkFrame.bytes[5] = 0;
assert(animationKernel.advanceGroundedAnimPrimitive(3, animationItems,
walking, animationShapes, animationArea) == true);
assert(animationItems.findItem(1)->data.x == 514 && movingNpc.frame == 2);
nextWalkFrame.bytes[5] = 2;
nextWalkFrame.bytes[4] = 100;
movingNpc.frame = 0;
remorse::StagedFixedMapItem animationWall{};