feat: Implement player locomotion constants and update movement logic in engine
feat: Add key icons to HUD modules and implement key rendering in HUD test: Add player movement and rotation parity tests to ensure consistency with classic Wolf3D test: Enhance HUD rendering tests for gold and silver key icons Signed-off-by: Hans Kokx <hans.d.kokx@gmail.com>
This commit is contained in:
@@ -27,6 +27,36 @@ void main() {
|
||||
|
||||
expect(livesDigitCall.imageIndex, expectedDigitIndex);
|
||||
});
|
||||
|
||||
test('standard VGA HUD renders gold key icon when collected', () {
|
||||
final engine = _buildEngine();
|
||||
engine.init();
|
||||
engine.player.hasGoldKey = true;
|
||||
|
||||
final renderer = _HudProbeRenderer(vgaImages: engine.data.vgaImages);
|
||||
renderer.drawHudForTest(engine);
|
||||
|
||||
final expectedGoldKeyIndex = engine.data.registry.hud
|
||||
.resolve(HudKey.goldKeyIcon)
|
||||
?.vgaIndex;
|
||||
final expectedNoKeyIndex = engine.data.registry.hud
|
||||
.resolve(HudKey.noKeyIcon)
|
||||
?.vgaIndex;
|
||||
expect(expectedGoldKeyIndex, isNotNull);
|
||||
expect(expectedNoKeyIndex, isNotNull);
|
||||
|
||||
final goldKeyCall = renderer.drawCalls.firstWhere(
|
||||
(call) => call.startY == 164 && call.startX == 30,
|
||||
orElse: () => throw StateError('Gold key slot was not rendered.'),
|
||||
);
|
||||
final silverKeyCall = renderer.drawCalls.firstWhere(
|
||||
(call) => call.startY == 180 && call.startX == 30,
|
||||
orElse: () => throw StateError('Silver key slot was not rendered.'),
|
||||
);
|
||||
|
||||
expect(goldKeyCall.imageIndex, expectedGoldKeyIndex);
|
||||
expect(silverKeyCall.imageIndex, expectedNoKeyIndex);
|
||||
});
|
||||
}
|
||||
|
||||
class _HudProbeRenderer extends RendererBackend<int> {
|
||||
|
||||
@@ -45,7 +45,8 @@ void main() {
|
||||
expect(changedPixels, greaterThan(mapPixels.length ~/ 5));
|
||||
expect(mapPixels.contains(ColorPalette.vga32Bit[6]), isTrue);
|
||||
expect(mapPixels.contains(ColorPalette.vga32Bit[12]), isTrue);
|
||||
expect(mapPixels.contains(ColorPalette.vga32Bit[10]), isTrue);
|
||||
expect(mapPixels.contains(ColorPalette.vga32Bit[15]), isTrue);
|
||||
expect(mapPixels.contains(ColorPalette.vga32Bit[2]), isTrue);
|
||||
expect(mapPixels[hudProbeIndex], equals(normalPixels[hudProbeIndex]));
|
||||
});
|
||||
});
|
||||
@@ -78,6 +79,7 @@ WolfEngine _buildEngine() {
|
||||
wallGrid[5][5] = 1;
|
||||
objectGrid[2][2] = MapObject.playerEast;
|
||||
objectGrid[5][5] = MapObject.pushwallTrigger;
|
||||
objectGrid[10][10] = MapObject.normalExitTrigger;
|
||||
|
||||
return WolfEngine(
|
||||
data: WolfensteinData(
|
||||
|
||||
Reference in New Issue
Block a user