refactor: Update imports and restructure key definitions for music and sound effects
Signed-off-by: Hans Kokx <hans.d.kokx@gmail.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import 'package:wolf_3d_dart/src/data_types/game_version.dart';
|
import 'package:wolf_3d_dart/src/data_types/game_version.dart';
|
||||||
import 'package:wolf_3d_dart/src/registry/keys/music.dart';
|
import 'package:wolf_3d_dart/src/registry/keys/music_key.dart';
|
||||||
import 'package:wolf_3d_dart/src/registry/modules/music_module.dart';
|
import 'package:wolf_3d_dart/src/registry/modules/music_module.dart';
|
||||||
|
|
||||||
/// Built-in music router backed directly by [Music] metadata.
|
/// Built-in music router backed directly by [Music] metadata.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import 'package:wolf_3d_dart/src/data_types/game_version.dart';
|
import 'package:wolf_3d_dart/src/data_types/game_version.dart';
|
||||||
import 'package:wolf_3d_dart/src/registry/keys/sound_effect.dart';
|
import 'package:wolf_3d_dart/src/registry/keys/sfx_key.dart';
|
||||||
import 'package:wolf_3d_dart/src/registry/modules/sfx_module.dart';
|
import 'package:wolf_3d_dart/src/registry/modules/sfx_module.dart';
|
||||||
|
|
||||||
/// Built-in sound-slot resolver backed directly by [SoundEffect] metadata.
|
/// Built-in sound-slot resolver backed directly by [SoundEffect] metadata.
|
||||||
|
|||||||
@@ -1,39 +1,25 @@
|
|||||||
/// Extensible typed key for entity asset definitions (enemies, bosses, etc.).
|
/// Typed key for entity asset definitions (enemies, bosses, etc.).
|
||||||
///
|
enum EntityKey {
|
||||||
/// Built-in Wolf3D entity types are exposed as named static constants.
|
|
||||||
/// Custom modules can define new keys with `const EntityKey('myEnemy')`
|
|
||||||
/// without modifying this class.
|
|
||||||
///
|
|
||||||
/// Example:
|
|
||||||
/// ```dart
|
|
||||||
/// registry.entities.resolve(EntityKey.guard)
|
|
||||||
/// ```
|
|
||||||
final class EntityKey {
|
|
||||||
const EntityKey(this._id);
|
|
||||||
|
|
||||||
final String _id;
|
|
||||||
|
|
||||||
// --- Standard Enemies ---
|
// --- Standard Enemies ---
|
||||||
static const guard = EntityKey('guard');
|
guard('guard'),
|
||||||
static const dog = EntityKey('dog');
|
dog('dog'),
|
||||||
static const ss = EntityKey('ss');
|
ss('ss'),
|
||||||
static const mutant = EntityKey('mutant');
|
mutant('mutant'),
|
||||||
static const officer = EntityKey('officer');
|
officer('officer'),
|
||||||
|
|
||||||
// --- Bosses (Wolf3D) ---
|
// --- Bosses (Wolf3D) ---
|
||||||
static const hansGrosse = EntityKey('hansGrosse');
|
hansGrosse('hansGrosse'),
|
||||||
static const drSchabbs = EntityKey('drSchabbs');
|
drSchabbs('drSchabbs'),
|
||||||
static const hitler = EntityKey('hitler');
|
hitler('hitler'),
|
||||||
static const mechaHitler = EntityKey('mechaHitler');
|
mechaHitler('mechaHitler'),
|
||||||
static const ottoGiftmacher = EntityKey('ottoGiftmacher');
|
ottoGiftmacher('ottoGiftmacher'),
|
||||||
static const gretelGrosse = EntityKey('gretelGrosse');
|
gretelGrosse('gretelGrosse')
|
||||||
|
;
|
||||||
|
|
||||||
|
const EntityKey(this.id);
|
||||||
|
|
||||||
|
final String id;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) => other is EntityKey && other._id == _id;
|
String toString() => 'EntityKey($id)';
|
||||||
|
|
||||||
@override
|
|
||||||
int get hashCode => _id.hashCode;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String toString() => 'EntityKey($_id)';
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,54 +1,40 @@
|
|||||||
/// Extensible typed key for HUD image elements.
|
/// Typed key for HUD image elements.
|
||||||
///
|
enum HudKey {
|
||||||
/// Built-in Wolf3D HUD elements are exposed as named static constants.
|
|
||||||
/// Custom modules can define new keys with `const HudKey('myElement')`
|
|
||||||
/// without modifying this class.
|
|
||||||
///
|
|
||||||
/// Example:
|
|
||||||
/// ```dart
|
|
||||||
/// registry.hud.resolve(HudKey.statusBar)
|
|
||||||
/// ```
|
|
||||||
final class HudKey {
|
|
||||||
const HudKey(this._id);
|
|
||||||
|
|
||||||
final String _id;
|
|
||||||
|
|
||||||
// --- Layout ---
|
// --- Layout ---
|
||||||
static const statusBar = HudKey('statusBar');
|
statusBar('statusBar'),
|
||||||
|
|
||||||
// --- Score/Floor/Lives/Ammo digits (0-9 for each counter) ---
|
// --- Score/Floor/Lives/Ammo digits (0-9 for each counter) ---
|
||||||
static const digit0 = HudKey('digit0');
|
digit0('digit0'),
|
||||||
static const digit1 = HudKey('digit1');
|
digit1('digit1'),
|
||||||
static const digit2 = HudKey('digit2');
|
digit2('digit2'),
|
||||||
static const digit3 = HudKey('digit3');
|
digit3('digit3'),
|
||||||
static const digit4 = HudKey('digit4');
|
digit4('digit4'),
|
||||||
static const digit5 = HudKey('digit5');
|
digit5('digit5'),
|
||||||
static const digit6 = HudKey('digit6');
|
digit6('digit6'),
|
||||||
static const digit7 = HudKey('digit7');
|
digit7('digit7'),
|
||||||
static const digit8 = HudKey('digit8');
|
digit8('digit8'),
|
||||||
static const digit9 = HudKey('digit9');
|
digit9('digit9'),
|
||||||
|
|
||||||
// --- BJ face health bands (each maps to the base of 3 animated frames) ---
|
// --- BJ face health bands (each maps to the base of 3 animated frames) ---
|
||||||
static const faceHealthy = HudKey('faceHealthy'); // health 85–100
|
faceHealthy('faceHealthy'), // health 85-100
|
||||||
static const faceScratched = HudKey('faceScratched'); // health 69–84
|
faceScratched('faceScratched'), // health 69-84
|
||||||
static const faceHurt = HudKey('faceHurt'); // health 53–68
|
faceHurt('faceHurt'), // health 53-68
|
||||||
static const faceWounded = HudKey('faceWounded'); // health 37–52
|
faceWounded('faceWounded'), // health 37-52
|
||||||
static const faceBadlyWounded = HudKey('faceBadlyWounded'); // health 21–36
|
faceBadlyWounded('faceBadlyWounded'), // health 21-36
|
||||||
static const faceDying = HudKey('faceDying'); // health 5–20
|
faceDying('faceDying'), // health 5-20
|
||||||
static const faceNearDeath = HudKey('faceNearDeath'); // health 1–4
|
faceNearDeath('faceNearDeath'), // health 1-4
|
||||||
static const faceDead = HudKey('faceDead'); // health ≤ 0
|
faceDead('faceDead'), // health <= 0
|
||||||
|
|
||||||
// --- Weapon icons ---
|
// --- Weapon icons ---
|
||||||
static const pistolIcon = HudKey('pistolIcon');
|
pistolIcon('pistolIcon'),
|
||||||
static const machineGunIcon = HudKey('machineGunIcon');
|
machineGunIcon('machineGunIcon'),
|
||||||
static const chainGunIcon = HudKey('chainGunIcon');
|
chainGunIcon('chainGunIcon')
|
||||||
|
;
|
||||||
|
|
||||||
|
const HudKey(this.id);
|
||||||
|
|
||||||
|
final String id;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) => other is HudKey && other._id == _id;
|
String toString() => 'HudKey($id)';
|
||||||
|
|
||||||
@override
|
|
||||||
int get hashCode => _id.hashCode;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String toString() => 'HudKey($_id)';
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,55 +1,41 @@
|
|||||||
/// Extensible typed key for menu VGA picture elements.
|
/// Typed key for menu VGA picture elements.
|
||||||
///
|
enum MenuPicKey {
|
||||||
/// Built-in Wolf3D menu pictures are exposed as named static constants.
|
|
||||||
/// Custom modules can define new keys with `const MenuPicKey('myPic')`
|
|
||||||
/// without modifying this class.
|
|
||||||
///
|
|
||||||
/// Example:
|
|
||||||
/// ```dart
|
|
||||||
/// registry.menu.resolve(MenuPicKey.title)
|
|
||||||
/// ```
|
|
||||||
final class MenuPicKey {
|
|
||||||
const MenuPicKey(this._id);
|
|
||||||
|
|
||||||
final String _id;
|
|
||||||
|
|
||||||
// --- Full-screen art ---
|
// --- Full-screen art ---
|
||||||
static const title = MenuPicKey('title');
|
title('title'),
|
||||||
static const credits = MenuPicKey('credits');
|
credits('credits'),
|
||||||
static const pg13 = MenuPicKey('pg13');
|
pg13('pg13'),
|
||||||
|
|
||||||
// --- Control-panel chrome ---
|
// --- Control-panel chrome ---
|
||||||
static const controlBackground = MenuPicKey('controlBackground');
|
controlBackground('controlBackground'),
|
||||||
static const footer = MenuPicKey('footer');
|
footer('footer'),
|
||||||
static const heading = MenuPicKey('heading');
|
heading('heading'),
|
||||||
static const optionsLabel = MenuPicKey('optionsLabel');
|
optionsLabel('optionsLabel'),
|
||||||
|
|
||||||
// --- Cursor / selection markers ---
|
// --- Cursor / selection markers ---
|
||||||
static const cursorActive = MenuPicKey('cursorActive');
|
cursorActive('cursorActive'),
|
||||||
static const cursorInactive = MenuPicKey('cursorInactive');
|
cursorInactive('cursorInactive'),
|
||||||
static const markerSelected = MenuPicKey('markerSelected');
|
markerSelected('markerSelected'),
|
||||||
static const markerUnselected = MenuPicKey('markerUnselected');
|
markerUnselected('markerUnselected'),
|
||||||
|
|
||||||
// --- Episode selection ---
|
// --- Episode selection ---
|
||||||
static const episode1 = MenuPicKey('episode1');
|
episode1('episode1'),
|
||||||
static const episode2 = MenuPicKey('episode2');
|
episode2('episode2'),
|
||||||
static const episode3 = MenuPicKey('episode3');
|
episode3('episode3'),
|
||||||
static const episode4 = MenuPicKey('episode4');
|
episode4('episode4'),
|
||||||
static const episode5 = MenuPicKey('episode5');
|
episode5('episode5'),
|
||||||
static const episode6 = MenuPicKey('episode6');
|
episode6('episode6'),
|
||||||
|
|
||||||
// --- Difficulty selection ---
|
// --- Difficulty selection ---
|
||||||
static const difficultyBaby = MenuPicKey('difficultyBaby');
|
difficultyBaby('difficultyBaby'),
|
||||||
static const difficultyEasy = MenuPicKey('difficultyEasy');
|
difficultyEasy('difficultyEasy'),
|
||||||
static const difficultyNormal = MenuPicKey('difficultyNormal');
|
difficultyNormal('difficultyNormal'),
|
||||||
static const difficultyHard = MenuPicKey('difficultyHard');
|
difficultyHard('difficultyHard')
|
||||||
|
;
|
||||||
|
|
||||||
|
const MenuPicKey(this.id);
|
||||||
|
|
||||||
|
final String id;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) => other is MenuPicKey && other._id == _id;
|
String toString() => 'MenuPicKey($id)';
|
||||||
|
|
||||||
@override
|
|
||||||
int get hashCode => _id.hashCode;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String toString() => 'MenuPicKey($_id)';
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import 'package:wolf_3d_dart/src/registry/keys/music.dart';
|
import 'package:wolf_3d_dart/src/registry/keys/music_key.dart';
|
||||||
|
|
||||||
/// The resolved reference for a music track: a numeric index into
|
/// The resolved reference for a music track: a numeric index into
|
||||||
/// [WolfensteinData.music].
|
/// [WolfensteinData.music].
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import 'package:wolf_3d_dart/src/registry/keys/sound_effect.dart';
|
import 'package:wolf_3d_dart/src/registry/keys/sfx_key.dart';
|
||||||
|
|
||||||
/// The resolved reference for a sound effect: a numeric slot index into
|
/// The resolved reference for a sound effect: a numeric slot index into
|
||||||
/// [WolfensteinData.sounds].
|
/// [WolfensteinData.sounds].
|
||||||
|
|||||||
@@ -33,8 +33,8 @@ export 'src/registry/built_in/shareware_asset_registry.dart'
|
|||||||
export 'src/registry/keys/entity_key.dart' show EntityKey;
|
export 'src/registry/keys/entity_key.dart' show EntityKey;
|
||||||
export 'src/registry/keys/hud_key.dart' show HudKey;
|
export 'src/registry/keys/hud_key.dart' show HudKey;
|
||||||
export 'src/registry/keys/menu_pic_key.dart' show MenuPicKey;
|
export 'src/registry/keys/menu_pic_key.dart' show MenuPicKey;
|
||||||
export 'src/registry/keys/music.dart' show Music;
|
export 'src/registry/keys/music_key.dart' show Music;
|
||||||
export 'src/registry/keys/sound_effect.dart' show SoundEffect;
|
export 'src/registry/keys/sfx_key.dart' show SoundEffect;
|
||||||
export 'src/registry/modules/entity_asset_module.dart'
|
export 'src/registry/modules/entity_asset_module.dart'
|
||||||
show EntityAssetModule, EntityAssetDefinition;
|
show EntityAssetModule, EntityAssetDefinition;
|
||||||
export 'src/registry/modules/hud_module.dart' show HudModule, HudAssetRef;
|
export 'src/registry/modules/hud_module.dart' show HudModule, HudAssetRef;
|
||||||
|
|||||||
Reference in New Issue
Block a user