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/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';
|
||||
|
||||
/// 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/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';
|
||||
|
||||
/// Built-in sound-slot resolver backed directly by [SoundEffect] metadata.
|
||||
|
||||
@@ -1,39 +1,25 @@
|
||||
/// Extensible typed key for entity asset definitions (enemies, bosses, etc.).
|
||||
///
|
||||
/// 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;
|
||||
|
||||
/// Typed key for entity asset definitions (enemies, bosses, etc.).
|
||||
enum EntityKey {
|
||||
// --- Standard Enemies ---
|
||||
static const guard = EntityKey('guard');
|
||||
static const dog = EntityKey('dog');
|
||||
static const ss = EntityKey('ss');
|
||||
static const mutant = EntityKey('mutant');
|
||||
static const officer = EntityKey('officer');
|
||||
guard('guard'),
|
||||
dog('dog'),
|
||||
ss('ss'),
|
||||
mutant('mutant'),
|
||||
officer('officer'),
|
||||
|
||||
// --- Bosses (Wolf3D) ---
|
||||
static const hansGrosse = EntityKey('hansGrosse');
|
||||
static const drSchabbs = EntityKey('drSchabbs');
|
||||
static const hitler = EntityKey('hitler');
|
||||
static const mechaHitler = EntityKey('mechaHitler');
|
||||
static const ottoGiftmacher = EntityKey('ottoGiftmacher');
|
||||
static const gretelGrosse = EntityKey('gretelGrosse');
|
||||
hansGrosse('hansGrosse'),
|
||||
drSchabbs('drSchabbs'),
|
||||
hitler('hitler'),
|
||||
mechaHitler('mechaHitler'),
|
||||
ottoGiftmacher('ottoGiftmacher'),
|
||||
gretelGrosse('gretelGrosse')
|
||||
;
|
||||
|
||||
const EntityKey(this.id);
|
||||
|
||||
final String id;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => other is EntityKey && other._id == _id;
|
||||
|
||||
@override
|
||||
int get hashCode => _id.hashCode;
|
||||
|
||||
@override
|
||||
String toString() => 'EntityKey($_id)';
|
||||
String toString() => 'EntityKey($id)';
|
||||
}
|
||||
|
||||
@@ -1,54 +1,40 @@
|
||||
/// Extensible typed key for HUD image elements.
|
||||
///
|
||||
/// 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;
|
||||
|
||||
/// Typed key for HUD image elements.
|
||||
enum HudKey {
|
||||
// --- Layout ---
|
||||
static const statusBar = HudKey('statusBar');
|
||||
statusBar('statusBar'),
|
||||
|
||||
// --- Score/Floor/Lives/Ammo digits (0-9 for each counter) ---
|
||||
static const digit0 = HudKey('digit0');
|
||||
static const digit1 = HudKey('digit1');
|
||||
static const digit2 = HudKey('digit2');
|
||||
static const digit3 = HudKey('digit3');
|
||||
static const digit4 = HudKey('digit4');
|
||||
static const digit5 = HudKey('digit5');
|
||||
static const digit6 = HudKey('digit6');
|
||||
static const digit7 = HudKey('digit7');
|
||||
static const digit8 = HudKey('digit8');
|
||||
static const digit9 = HudKey('digit9');
|
||||
digit0('digit0'),
|
||||
digit1('digit1'),
|
||||
digit2('digit2'),
|
||||
digit3('digit3'),
|
||||
digit4('digit4'),
|
||||
digit5('digit5'),
|
||||
digit6('digit6'),
|
||||
digit7('digit7'),
|
||||
digit8('digit8'),
|
||||
digit9('digit9'),
|
||||
|
||||
// --- BJ face health bands (each maps to the base of 3 animated frames) ---
|
||||
static const faceHealthy = HudKey('faceHealthy'); // health 85–100
|
||||
static const faceScratched = HudKey('faceScratched'); // health 69–84
|
||||
static const faceHurt = HudKey('faceHurt'); // health 53–68
|
||||
static const faceWounded = HudKey('faceWounded'); // health 37–52
|
||||
static const faceBadlyWounded = HudKey('faceBadlyWounded'); // health 21–36
|
||||
static const faceDying = HudKey('faceDying'); // health 5–20
|
||||
static const faceNearDeath = HudKey('faceNearDeath'); // health 1–4
|
||||
static const faceDead = HudKey('faceDead'); // health ≤ 0
|
||||
faceHealthy('faceHealthy'), // health 85-100
|
||||
faceScratched('faceScratched'), // health 69-84
|
||||
faceHurt('faceHurt'), // health 53-68
|
||||
faceWounded('faceWounded'), // health 37-52
|
||||
faceBadlyWounded('faceBadlyWounded'), // health 21-36
|
||||
faceDying('faceDying'), // health 5-20
|
||||
faceNearDeath('faceNearDeath'), // health 1-4
|
||||
faceDead('faceDead'), // health <= 0
|
||||
|
||||
// --- Weapon icons ---
|
||||
static const pistolIcon = HudKey('pistolIcon');
|
||||
static const machineGunIcon = HudKey('machineGunIcon');
|
||||
static const chainGunIcon = HudKey('chainGunIcon');
|
||||
pistolIcon('pistolIcon'),
|
||||
machineGunIcon('machineGunIcon'),
|
||||
chainGunIcon('chainGunIcon')
|
||||
;
|
||||
|
||||
const HudKey(this.id);
|
||||
|
||||
final String id;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => other is HudKey && other._id == _id;
|
||||
|
||||
@override
|
||||
int get hashCode => _id.hashCode;
|
||||
|
||||
@override
|
||||
String toString() => 'HudKey($_id)';
|
||||
String toString() => 'HudKey($id)';
|
||||
}
|
||||
|
||||
@@ -1,55 +1,41 @@
|
||||
/// Extensible typed key for menu VGA picture elements.
|
||||
///
|
||||
/// 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;
|
||||
|
||||
/// Typed key for menu VGA picture elements.
|
||||
enum MenuPicKey {
|
||||
// --- Full-screen art ---
|
||||
static const title = MenuPicKey('title');
|
||||
static const credits = MenuPicKey('credits');
|
||||
static const pg13 = MenuPicKey('pg13');
|
||||
title('title'),
|
||||
credits('credits'),
|
||||
pg13('pg13'),
|
||||
|
||||
// --- Control-panel chrome ---
|
||||
static const controlBackground = MenuPicKey('controlBackground');
|
||||
static const footer = MenuPicKey('footer');
|
||||
static const heading = MenuPicKey('heading');
|
||||
static const optionsLabel = MenuPicKey('optionsLabel');
|
||||
controlBackground('controlBackground'),
|
||||
footer('footer'),
|
||||
heading('heading'),
|
||||
optionsLabel('optionsLabel'),
|
||||
|
||||
// --- Cursor / selection markers ---
|
||||
static const cursorActive = MenuPicKey('cursorActive');
|
||||
static const cursorInactive = MenuPicKey('cursorInactive');
|
||||
static const markerSelected = MenuPicKey('markerSelected');
|
||||
static const markerUnselected = MenuPicKey('markerUnselected');
|
||||
cursorActive('cursorActive'),
|
||||
cursorInactive('cursorInactive'),
|
||||
markerSelected('markerSelected'),
|
||||
markerUnselected('markerUnselected'),
|
||||
|
||||
// --- Episode selection ---
|
||||
static const episode1 = MenuPicKey('episode1');
|
||||
static const episode2 = MenuPicKey('episode2');
|
||||
static const episode3 = MenuPicKey('episode3');
|
||||
static const episode4 = MenuPicKey('episode4');
|
||||
static const episode5 = MenuPicKey('episode5');
|
||||
static const episode6 = MenuPicKey('episode6');
|
||||
episode1('episode1'),
|
||||
episode2('episode2'),
|
||||
episode3('episode3'),
|
||||
episode4('episode4'),
|
||||
episode5('episode5'),
|
||||
episode6('episode6'),
|
||||
|
||||
// --- Difficulty selection ---
|
||||
static const difficultyBaby = MenuPicKey('difficultyBaby');
|
||||
static const difficultyEasy = MenuPicKey('difficultyEasy');
|
||||
static const difficultyNormal = MenuPicKey('difficultyNormal');
|
||||
static const difficultyHard = MenuPicKey('difficultyHard');
|
||||
difficultyBaby('difficultyBaby'),
|
||||
difficultyEasy('difficultyEasy'),
|
||||
difficultyNormal('difficultyNormal'),
|
||||
difficultyHard('difficultyHard')
|
||||
;
|
||||
|
||||
const MenuPicKey(this.id);
|
||||
|
||||
final String id;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => other is MenuPicKey && other._id == _id;
|
||||
|
||||
@override
|
||||
int get hashCode => _id.hashCode;
|
||||
|
||||
@override
|
||||
String toString() => 'MenuPicKey($_id)';
|
||||
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
|
||||
/// [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
|
||||
/// [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/hud_key.dart' show HudKey;
|
||||
export 'src/registry/keys/menu_pic_key.dart' show MenuPicKey;
|
||||
export 'src/registry/keys/music.dart' show Music;
|
||||
export 'src/registry/keys/sound_effect.dart' show SoundEffect;
|
||||
export 'src/registry/keys/music_key.dart' show Music;
|
||||
export 'src/registry/keys/sfx_key.dart' show SoundEffect;
|
||||
export 'src/registry/modules/entity_asset_module.dart'
|
||||
show EntityAssetModule, EntityAssetDefinition;
|
||||
export 'src/registry/modules/hud_module.dart' show HudModule, HudAssetRef;
|
||||
|
||||
Reference in New Issue
Block a user