Fix door opening sound

Signed-off-by: Hans Kokx <hans.d.kokx@gmail.com>
This commit is contained in:
2026-03-16 17:42:16 +01:00
parent bc74f7beee
commit bd486e4c82
9 changed files with 27 additions and 37 deletions

View File

@@ -38,7 +38,7 @@ class _EpisodeScreenState extends State<EpisodeScreen> {
FloatingActionButtonLocation.miniCenterFloat, FloatingActionButtonLocation.miniCenterFloat,
floatingActionButton: Row( floatingActionButton: Row(
children: [ children: [
FloatingActionButton( ElevatedButton(
onPressed: () { onPressed: () {
Navigator.of(context).push( Navigator.of(context).push(
MaterialPageRoute( MaterialPageRoute(
@@ -50,7 +50,7 @@ class _EpisodeScreenState extends State<EpisodeScreen> {
}, },
child: Text('VGA Gallery'), child: Text('VGA Gallery'),
), ),
FloatingActionButton( ElevatedButton(
onPressed: () { onPressed: () {
Navigator.of(context).push( Navigator.of(context).push(
MaterialPageRoute( MaterialPageRoute(

View File

@@ -51,8 +51,8 @@ typedef WolfMusicMap = List<int>;
/// Use these to index into `activeGame.sounds[id]`. /// Use these to index into `activeGame.sounds[id]`.
abstract class WolfSound { abstract class WolfSound {
// --- Doors & Environment --- // --- Doors & Environment ---
static const int openDoor = 18; static const int openDoor = 8;
static const int closeDoor = 19; static const int closeDoor = 9;
static const int pushWall = 46; // Secret sliding walls static const int pushWall = 46; // Secret sliding walls
// --- Weapons & Combat --- // --- Weapons & Combat ---

View File

@@ -2,6 +2,7 @@ import 'package:wolf_3d_data_types/wolf_3d_data_types.dart';
abstract class EngineAudio { abstract class EngineAudio {
WolfensteinData? activeGame; WolfensteinData? activeGame;
Future<void> debugSoundTest();
void playMenuMusic(); void playMenuMusic();
void playLevelMusic(WolfLevel level); void playLevelMusic(WolfLevel level);
void stopMusic(); void stopMusic();

View File

@@ -31,4 +31,9 @@ class CliSilentAudio implements EngineAudio {
@override @override
void dispose() {} void dispose() {}
@override
Future<void> debugSoundTest() async {
return Future.value(null);
}
} }

View File

@@ -1,30 +1,4 @@
# This file configures the static analysis results for your project (errors, include: package:flutter_lints/flutter.yaml
# 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:lints/recommended.yaml formatter:
trailing_commas: preserve
# 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

View File

@@ -10,7 +10,11 @@ class Door {
int openTime = 0; int openTime = 0;
static const int openDurationMs = 3000; 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. /// Updates animation. Returns the NEW state if it changed this frame, else null.
DoorState? update(int currentTimeMs) { DoorState? update(int currentTimeMs) {

View File

@@ -1,4 +1,4 @@
include: package:flutter_lints/flutter.yaml include: package:flutter_lints/flutter.yaml
# Additional information about this file can be found at formatter:
# https://dart.dev/guides/language/analysis-options trailing_commas: preserve

View File

@@ -33,6 +33,11 @@ class FlutterAudioAdapter implements EngineAudio {
Wolf3d.I.audio.dispose(); Wolf3d.I.audio.dispose();
} }
@override
Future<void> debugSoundTest() async {
Wolf3d.I.audio.debugSoundTest();
}
@override @override
WolfensteinData? get activeGame => Wolf3d.I.activeGame; WolfensteinData? get activeGame => Wolf3d.I.activeGame;

View File

@@ -6,7 +6,8 @@ import 'package:wolf_3d_engine/wolf_3d_engine.dart';
import 'package:wolf_3d_synth/src/imf_renderer.dart'; import 'package:wolf_3d_synth/src/imf_renderer.dart';
class WolfAudio implements EngineAudio { class WolfAudio implements EngineAudio {
void debugSoundTest() { @override
Future<void> debugSoundTest() async {
// Play the first 50 sounds with a 2-second gap to identify them // Play the first 50 sounds with a 2-second gap to identify them
for (int i = 0; i < 50; i++) { for (int i = 0; i < 50; i++) {
Future.delayed(Duration(seconds: i * 2), () { Future.delayed(Duration(seconds: i * 2), () {