Refactor entity, HUD, menu, music, and SFX modules for improved readability and consistency in code formatting

Signed-off-by: Hans Kokx <hans.d.kokx@gmail.com>
This commit is contained in:
2026-03-19 13:46:00 +01:00
parent fcda0f9ff4
commit 6e53da7095
13 changed files with 253 additions and 241 deletions

View File

@@ -23,31 +23,31 @@ class RetailHudModule extends HudModule {
]; ];
static final Map<HudKey, int> _indices = { static final Map<HudKey, int> _indices = {
HudKey.statusBar : 83, HudKey.statusBar: 83,
// Digits — '0' is index 96; subsequent digits follow sequentially. // Digits — '0' is index 96; subsequent digits follow sequentially.
HudKey.digit0 : 96, HudKey.digit0: 96,
HudKey.digit1 : 97, HudKey.digit1: 97,
HudKey.digit2 : 98, HudKey.digit2: 98,
HudKey.digit3 : 99, HudKey.digit3: 99,
HudKey.digit4 : 100, HudKey.digit4: 100,
HudKey.digit5 : 101, HudKey.digit5: 101,
HudKey.digit6 : 102, HudKey.digit6: 102,
HudKey.digit7 : 103, HudKey.digit7: 103,
HudKey.digit8 : 104, HudKey.digit8: 104,
HudKey.digit9 : 105, HudKey.digit9: 105,
// BJ face bands (each band's base; 3 animated variants follow). // BJ face bands (each band's base; 3 animated variants follow).
HudKey.faceHealthy : 106, HudKey.faceHealthy: 106,
HudKey.faceScratched : 109, HudKey.faceScratched: 109,
HudKey.faceHurt : 112, HudKey.faceHurt: 112,
HudKey.faceWounded : 115, HudKey.faceWounded: 115,
HudKey.faceBadlyWounded : 118, HudKey.faceBadlyWounded: 118,
HudKey.faceDying : 121, HudKey.faceDying: 121,
HudKey.faceNearDeath : 124, HudKey.faceNearDeath: 124,
HudKey.faceDead : 127, HudKey.faceDead: 127,
// Weapon icons. // Weapon icons.
HudKey.pistolIcon : 89, HudKey.pistolIcon: 89,
HudKey.machineGunIcon : 90, HudKey.machineGunIcon: 90,
HudKey.chainGunIcon : 91, HudKey.chainGunIcon: 91,
}; };
@override @override

View File

@@ -23,31 +23,31 @@ class RetailMenuPicModule extends MenuPicModule {
static final Map<MenuPicKey, int> _indices = { static final Map<MenuPicKey, int> _indices = {
// --- Full-screen art --- // --- Full-screen art ---
MenuPicKey.title : 84, MenuPicKey.title: 84,
MenuPicKey.credits : 86, MenuPicKey.credits: 86,
MenuPicKey.pg13 : 85, MenuPicKey.pg13: 85,
// --- Control-panel chrome --- // --- Control-panel chrome ---
MenuPicKey.controlBackground : 23, // C_CONTROLPIC MenuPicKey.controlBackground: 23, // C_CONTROLPIC
MenuPicKey.footer : 15, // C_MOUSELBACKPIC (footer art) MenuPicKey.footer: 15, // C_MOUSELBACKPIC (footer art)
MenuPicKey.heading : 3, // H_TOPWINDOWPIC MenuPicKey.heading: 3, // H_TOPWINDOWPIC
MenuPicKey.optionsLabel : 7, // C_OPTIONSPIC MenuPicKey.optionsLabel: 7, // C_OPTIONSPIC
// --- Cursor / markers --- // --- Cursor / markers ---
MenuPicKey.cursorActive : 8, // C_CURSOR1PIC MenuPicKey.cursorActive: 8, // C_CURSOR1PIC
MenuPicKey.cursorInactive : 9, // C_CURSOR2PIC MenuPicKey.cursorInactive: 9, // C_CURSOR2PIC
MenuPicKey.markerSelected : 11, // C_SELECTEDPIC MenuPicKey.markerSelected: 11, // C_SELECTEDPIC
MenuPicKey.markerUnselected : 10, // C_NOTSELECTEDPIC MenuPicKey.markerUnselected: 10, // C_NOTSELECTEDPIC
// --- Episode selection --- // --- Episode selection ---
MenuPicKey.episode1 : 27, MenuPicKey.episode1: 27,
MenuPicKey.episode2 : 28, MenuPicKey.episode2: 28,
MenuPicKey.episode3 : 29, MenuPicKey.episode3: 29,
MenuPicKey.episode4 : 30, MenuPicKey.episode4: 30,
MenuPicKey.episode5 : 31, MenuPicKey.episode5: 31,
MenuPicKey.episode6 : 32, MenuPicKey.episode6: 32,
// --- Difficulty selection --- // --- Difficulty selection ---
MenuPicKey.difficultyBaby : 16, // C_BABYMODEPIC MenuPicKey.difficultyBaby: 16, // C_BABYMODEPIC
MenuPicKey.difficultyEasy : 17, // C_EASYPIC MenuPicKey.difficultyEasy: 17, // C_EASYPIC
MenuPicKey.difficultyNormal : 18, // C_NORMALPIC MenuPicKey.difficultyNormal: 18, // C_NORMALPIC
MenuPicKey.difficultyHard : 19, // C_HARDPIC MenuPicKey.difficultyHard: 19, // C_HARDPIC
}; };
@override @override

View File

@@ -11,52 +11,52 @@ class RetailSfxModule extends SfxModule {
static final Map<SfxKey, int> _slots = { static final Map<SfxKey, int> _slots = {
// --- Doors & Environment --- // --- Doors & Environment ---
SfxKey.openDoor : WolfSound.openDoor, SfxKey.openDoor: WolfSound.openDoor,
SfxKey.closeDoor : WolfSound.closeDoor, SfxKey.closeDoor: WolfSound.closeDoor,
SfxKey.pushWall : WolfSound.pushWall, SfxKey.pushWall: WolfSound.pushWall,
// --- Weapons --- // --- Weapons ---
SfxKey.knifeAttack : WolfSound.knifeAttack, SfxKey.knifeAttack: WolfSound.knifeAttack,
SfxKey.pistolFire : WolfSound.pistolFire, SfxKey.pistolFire: WolfSound.pistolFire,
SfxKey.machineGunFire : WolfSound.machineGunFire, SfxKey.machineGunFire: WolfSound.machineGunFire,
SfxKey.chainGunFire : WolfSound.gatlingFire, SfxKey.chainGunFire: WolfSound.gatlingFire,
SfxKey.enemyFire : WolfSound.naziFire, SfxKey.enemyFire: WolfSound.naziFire,
// --- Pickups --- // --- Pickups ---
SfxKey.getMachineGun : WolfSound.getMachineGun, SfxKey.getMachineGun: WolfSound.getMachineGun,
SfxKey.getAmmo : WolfSound.getAmmo, SfxKey.getAmmo: WolfSound.getAmmo,
SfxKey.getChainGun : WolfSound.getGatling, SfxKey.getChainGun: WolfSound.getGatling,
SfxKey.healthSmall : WolfSound.healthSmall, SfxKey.healthSmall: WolfSound.healthSmall,
SfxKey.healthLarge : WolfSound.healthLarge, SfxKey.healthLarge: WolfSound.healthLarge,
SfxKey.treasure1 : WolfSound.treasure1, SfxKey.treasure1: WolfSound.treasure1,
SfxKey.treasure2 : WolfSound.treasure2, SfxKey.treasure2: WolfSound.treasure2,
SfxKey.treasure3 : WolfSound.treasure3, SfxKey.treasure3: WolfSound.treasure3,
SfxKey.treasure4 : WolfSound.treasure4, SfxKey.treasure4: WolfSound.treasure4,
SfxKey.extraLife : WolfSound.extraLife, SfxKey.extraLife: WolfSound.extraLife,
// --- Standard Enemies --- // --- Standard Enemies ---
SfxKey.guardHalt : WolfSound.guardHalt, SfxKey.guardHalt: WolfSound.guardHalt,
SfxKey.dogBark : WolfSound.dogBark, SfxKey.dogBark: WolfSound.dogBark,
SfxKey.dogDeath : WolfSound.dogDeath, SfxKey.dogDeath: WolfSound.dogDeath,
SfxKey.dogAttack : WolfSound.dogAttack, SfxKey.dogAttack: WolfSound.dogAttack,
SfxKey.deathScream1 : WolfSound.deathScream1, SfxKey.deathScream1: WolfSound.deathScream1,
SfxKey.deathScream2 : WolfSound.deathScream2, SfxKey.deathScream2: WolfSound.deathScream2,
SfxKey.deathScream3 : WolfSound.deathScream3, SfxKey.deathScream3: WolfSound.deathScream3,
SfxKey.ssAlert : WolfSound.ssSchutzstaffel, SfxKey.ssAlert: WolfSound.ssSchutzstaffel,
SfxKey.ssDeath : WolfSound.ssMeinGott, SfxKey.ssDeath: WolfSound.ssMeinGott,
// --- Bosses --- // --- Bosses ---
SfxKey.bossActive : WolfSound.bossActive, SfxKey.bossActive: WolfSound.bossActive,
SfxKey.hansGrosseDeath : WolfSound.mutti, SfxKey.hansGrosseDeath: WolfSound.mutti,
SfxKey.schabbs : WolfSound.schabbsHas, SfxKey.schabbs: WolfSound.schabbsHas,
SfxKey.schabbsDeath : WolfSound.eva, SfxKey.schabbsDeath: WolfSound.eva,
SfxKey.hitlerGreeting : WolfSound.gutenTag, SfxKey.hitlerGreeting: WolfSound.gutenTag,
SfxKey.hitlerDeath : WolfSound.scheist, SfxKey.hitlerDeath: WolfSound.scheist,
SfxKey.mechaSteps : WolfSound.mechSteps, SfxKey.mechaSteps: WolfSound.mechSteps,
SfxKey.ottoAlert : WolfSound.spion, SfxKey.ottoAlert: WolfSound.spion,
SfxKey.gretelDeath : WolfSound.neinSoVass, SfxKey.gretelDeath: WolfSound.neinSoVass,
// --- UI & Progression --- // --- UI & Progression ---
SfxKey.levelComplete : WolfSound.levelDone, SfxKey.levelComplete: WolfSound.levelDone,
SfxKey.endBonus1 : WolfSound.endBonus1, SfxKey.endBonus1: WolfSound.endBonus1,
SfxKey.endBonus2 : WolfSound.endBonus2, SfxKey.endBonus2: WolfSound.endBonus2,
SfxKey.noBonus : WolfSound.noBonus, SfxKey.noBonus: WolfSound.noBonus,
SfxKey.percent100 : WolfSound.percent100, SfxKey.percent100: WolfSound.percent100,
}; };
@override @override

View File

@@ -19,27 +19,27 @@ class SharewareMenuPicModule extends MenuPicModule {
// Retail-baseline indices (same layout as RetailMenuPicModule). // Retail-baseline indices (same layout as RetailMenuPicModule).
static final Map<MenuPicKey, int> _retailBaseline = { static final Map<MenuPicKey, int> _retailBaseline = {
MenuPicKey.title : 84, MenuPicKey.title: 84,
MenuPicKey.credits : 86, MenuPicKey.credits: 86,
MenuPicKey.pg13 : 85, MenuPicKey.pg13: 85,
MenuPicKey.controlBackground : 23, MenuPicKey.controlBackground: 23,
MenuPicKey.footer : 15, MenuPicKey.footer: 15,
MenuPicKey.heading : 3, MenuPicKey.heading: 3,
MenuPicKey.optionsLabel : 7, MenuPicKey.optionsLabel: 7,
MenuPicKey.cursorActive : 8, MenuPicKey.cursorActive: 8,
MenuPicKey.cursorInactive : 9, MenuPicKey.cursorInactive: 9,
MenuPicKey.markerSelected : 11, MenuPicKey.markerSelected: 11,
MenuPicKey.markerUnselected : 10, MenuPicKey.markerUnselected: 10,
MenuPicKey.episode1 : 27, MenuPicKey.episode1: 27,
MenuPicKey.episode2 : 28, MenuPicKey.episode2: 28,
MenuPicKey.episode3 : 29, MenuPicKey.episode3: 29,
MenuPicKey.episode4 : 30, MenuPicKey.episode4: 30,
MenuPicKey.episode5 : 31, MenuPicKey.episode5: 31,
MenuPicKey.episode6 : 32, MenuPicKey.episode6: 32,
MenuPicKey.difficultyBaby : 16, MenuPicKey.difficultyBaby: 16,
MenuPicKey.difficultyEasy : 17, MenuPicKey.difficultyEasy: 17,
MenuPicKey.difficultyNormal : 18, MenuPicKey.difficultyNormal: 18,
MenuPicKey.difficultyHard : 19, MenuPicKey.difficultyHard: 19,
}; };
// Landmark constant: STATUSBARPIC in retail picture-table coords. // Landmark constant: STATUSBARPIC in retail picture-table coords.
@@ -95,7 +95,8 @@ class SharewareMenuPicModule extends MenuPicModule {
MenuPicKey.episode5, MenuPicKey.episode5,
MenuPicKey.episode6, MenuPicKey.episode6,
]; ];
if (episodeIndex >= 0 && episodeIndex < keys.length) return keys[episodeIndex]; if (episodeIndex >= 0 && episodeIndex < keys.length)
return keys[episodeIndex];
return MenuPicKey.episode1; return MenuPicKey.episode1;
} }

View File

@@ -10,7 +10,16 @@ class SharewareMusicModule extends MusicModule {
// Original WL_INTER.C shareware music table (Episode 1 only). // Original WL_INTER.C shareware music table (Episode 1 only).
static const List<int> _levelMap = [ static const List<int> _levelMap = [
2, 3, 4, 5, 2, 3, 4, 5, 6, 7, 2,
3,
4,
5,
2,
3,
4,
5,
6,
7,
]; ];
static final Map<MusicKey, int> _named = { static final Map<MusicKey, int> _named = {

View File

@@ -27,6 +27,10 @@ export 'src/data_types/wolf_level.dart' show WolfLevel;
export 'src/data_types/wolfenstein_data.dart' show WolfensteinData; export 'src/data_types/wolfenstein_data.dart' show WolfensteinData;
// Registry public surface // Registry public surface
export 'src/registry/asset_registry.dart' show AssetRegistry; export 'src/registry/asset_registry.dart' show AssetRegistry;
export 'src/registry/built_in/retail_asset_registry.dart'
show RetailAssetRegistry;
export 'src/registry/built_in/shareware_asset_registry.dart'
show SharewareAssetRegistry;
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;
@@ -40,9 +44,7 @@ export 'src/registry/modules/menu_pic_module.dart'
export 'src/registry/modules/music_module.dart' show MusicModule, MusicRoute; export 'src/registry/modules/music_module.dart' show MusicModule, MusicRoute;
export 'src/registry/modules/sfx_module.dart' show SfxModule, SoundAssetRef; export 'src/registry/modules/sfx_module.dart' show SfxModule, SoundAssetRef;
export 'src/registry/registry_resolver.dart' export 'src/registry/registry_resolver.dart'
show AssetRegistryResolver, BuiltInAssetRegistryResolver, show
AssetRegistryResolver,
BuiltInAssetRegistryResolver,
RegistrySelectionContext; RegistrySelectionContext;
export 'src/registry/built_in/retail_asset_registry.dart'
show RetailAssetRegistry;
export 'src/registry/built_in/shareware_asset_registry.dart'
show SharewareAssetRegistry;