From bd486e4c82c27a3848bb22af21204ccb006736a7 Mon Sep 17 00:00:00 2001 From: Hans Kokx Date: Mon, 16 Mar 2026 17:42:16 +0100 Subject: [PATCH] Fix door opening sound Signed-off-by: Hans Kokx --- .../lib/screens/episode_screen.dart | 4 +-- .../wolf_3d_data_types/lib/src/sound.dart | 4 +-- .../wolf_3d_engine/lib/src/engine_audio.dart | 1 + .../lib/src/silent_renderer.dart | 5 +++ .../wolf_3d_entities/analysis_options.yaml | 32 ++----------------- .../lib/src/entities/door.dart | 6 +++- .../wolf_3d_flutter/analysis_options.yaml | 4 +-- .../lib/audio/audio_adaptor.dart | 5 +++ .../wolf_3d_synth/lib/src/wolf_3d_audio.dart | 3 +- 9 files changed, 27 insertions(+), 37 deletions(-) diff --git a/apps/wolf_3d_gui/lib/screens/episode_screen.dart b/apps/wolf_3d_gui/lib/screens/episode_screen.dart index 93953cd..447244c 100644 --- a/apps/wolf_3d_gui/lib/screens/episode_screen.dart +++ b/apps/wolf_3d_gui/lib/screens/episode_screen.dart @@ -38,7 +38,7 @@ class _EpisodeScreenState extends State { FloatingActionButtonLocation.miniCenterFloat, floatingActionButton: Row( children: [ - FloatingActionButton( + ElevatedButton( onPressed: () { Navigator.of(context).push( MaterialPageRoute( @@ -50,7 +50,7 @@ class _EpisodeScreenState extends State { }, child: Text('VGA Gallery'), ), - FloatingActionButton( + ElevatedButton( onPressed: () { Navigator.of(context).push( MaterialPageRoute( diff --git a/packages/wolf_3d_data_types/lib/src/sound.dart b/packages/wolf_3d_data_types/lib/src/sound.dart index f19ec2f..8ea101e 100644 --- a/packages/wolf_3d_data_types/lib/src/sound.dart +++ b/packages/wolf_3d_data_types/lib/src/sound.dart @@ -51,8 +51,8 @@ typedef WolfMusicMap = List; /// Use these to index into `activeGame.sounds[id]`. abstract class WolfSound { // --- Doors & Environment --- - static const int openDoor = 18; - static const int closeDoor = 19; + static const int openDoor = 8; + static const int closeDoor = 9; static const int pushWall = 46; // Secret sliding walls // --- Weapons & Combat --- diff --git a/packages/wolf_3d_engine/lib/src/engine_audio.dart b/packages/wolf_3d_engine/lib/src/engine_audio.dart index 6d378af..a79d221 100644 --- a/packages/wolf_3d_engine/lib/src/engine_audio.dart +++ b/packages/wolf_3d_engine/lib/src/engine_audio.dart @@ -2,6 +2,7 @@ import 'package:wolf_3d_data_types/wolf_3d_data_types.dart'; abstract class EngineAudio { WolfensteinData? activeGame; + Future debugSoundTest(); void playMenuMusic(); void playLevelMusic(WolfLevel level); void stopMusic(); diff --git a/packages/wolf_3d_engine/lib/src/silent_renderer.dart b/packages/wolf_3d_engine/lib/src/silent_renderer.dart index ce67ca9..93ba47f 100644 --- a/packages/wolf_3d_engine/lib/src/silent_renderer.dart +++ b/packages/wolf_3d_engine/lib/src/silent_renderer.dart @@ -31,4 +31,9 @@ class CliSilentAudio implements EngineAudio { @override void dispose() {} + + @override + Future debugSoundTest() async { + return Future.value(null); + } } diff --git a/packages/wolf_3d_entities/analysis_options.yaml b/packages/wolf_3d_entities/analysis_options.yaml index dee8927..85ac016 100644 --- a/packages/wolf_3d_entities/analysis_options.yaml +++ b/packages/wolf_3d_entities/analysis_options.yaml @@ -1,30 +1,4 @@ -# This file configures the static analysis results for your project (errors, -# warnings, and lints). -# -# This enables the 'recommended' set of lints from `package:lints`. -# This set helps identify many issues that may lead to problems when running -# or consuming Dart code, and enforces writing Dart using a single, idiomatic -# style and format. -# -# If you want a smaller set of lints you can change this to specify -# 'package:lints/core.yaml'. These are just the most critical lints -# (the recommended set includes the core lints). -# The core lints are also what is used by pub.dev for scoring packages. +include: package:flutter_lints/flutter.yaml -include: package:lints/recommended.yaml - -# Uncomment the following section to specify additional rules. - -# linter: -# rules: -# - camel_case_types - -# analyzer: -# exclude: -# - path/to/excluded/files/** - -# For more information about the core and recommended set of lints, see -# https://dart.dev/go/core-lints - -# For additional information about configuring this file, see -# https://dart.dev/guides/language/analysis-options +formatter: + trailing_commas: preserve diff --git a/packages/wolf_3d_entities/lib/src/entities/door.dart b/packages/wolf_3d_entities/lib/src/entities/door.dart index b1f771d..d4a9c31 100644 --- a/packages/wolf_3d_entities/lib/src/entities/door.dart +++ b/packages/wolf_3d_entities/lib/src/entities/door.dart @@ -10,7 +10,11 @@ class Door { int openTime = 0; static const int openDurationMs = 3000; - Door({required this.x, required this.y, required this.mapId}); + Door({ + required this.x, + required this.y, + required this.mapId, + }); /// Updates animation. Returns the NEW state if it changed this frame, else null. DoorState? update(int currentTimeMs) { diff --git a/packages/wolf_3d_flutter/analysis_options.yaml b/packages/wolf_3d_flutter/analysis_options.yaml index a5744c1..85ac016 100644 --- a/packages/wolf_3d_flutter/analysis_options.yaml +++ b/packages/wolf_3d_flutter/analysis_options.yaml @@ -1,4 +1,4 @@ include: package:flutter_lints/flutter.yaml -# Additional information about this file can be found at -# https://dart.dev/guides/language/analysis-options +formatter: + trailing_commas: preserve diff --git a/packages/wolf_3d_flutter/lib/audio/audio_adaptor.dart b/packages/wolf_3d_flutter/lib/audio/audio_adaptor.dart index da0e1fd..8106874 100644 --- a/packages/wolf_3d_flutter/lib/audio/audio_adaptor.dart +++ b/packages/wolf_3d_flutter/lib/audio/audio_adaptor.dart @@ -33,6 +33,11 @@ class FlutterAudioAdapter implements EngineAudio { Wolf3d.I.audio.dispose(); } + @override + Future debugSoundTest() async { + Wolf3d.I.audio.debugSoundTest(); + } + @override WolfensteinData? get activeGame => Wolf3d.I.activeGame; diff --git a/packages/wolf_3d_synth/lib/src/wolf_3d_audio.dart b/packages/wolf_3d_synth/lib/src/wolf_3d_audio.dart index 6a90b8c..c5b588c 100644 --- a/packages/wolf_3d_synth/lib/src/wolf_3d_audio.dart +++ b/packages/wolf_3d_synth/lib/src/wolf_3d_audio.dart @@ -6,7 +6,8 @@ import 'package:wolf_3d_engine/wolf_3d_engine.dart'; import 'package:wolf_3d_synth/src/imf_renderer.dart'; class WolfAudio implements EngineAudio { - void debugSoundTest() { + @override + Future debugSoundTest() async { // Play the first 50 sounds with a 2-second gap to identify them for (int i = 0; i < 50; i++) { Future.delayed(Duration(seconds: i * 2), () {