import 'package:wolf_3d_dart/src/registry/keys/sfx_key.dart';
import 'package:wolf_3d_dart/src/registry/modules/sfx_module.dart';

/// Built-in digitized SFX slot mapping for Spear of Destiny demo/shareware.
///
/// Slots follow the original SPEAR/SPEARDEMO DigiMap table in `WL_MAIN.C`.
/// Only sounds present in the SDM digitized table are mapped.
class SpearDemoSfxModule extends SfxModule {
  const SpearDemoSfxModule();

  static final Map<SoundEffect, int> _slots = {
    SoundEffect.openDoor: 3,
    SoundEffect.closeDoor: 2,
    SoundEffect.pushWall: 13,

    SoundEffect.pistolFire: 5,
    SoundEffect.machineGunFire: 4,
    SoundEffect.chainGunFire: 6,
    SoundEffect.enemyFire: 17,

    SoundEffect.getChainGun: 38,

    SoundEffect.guardHalt: 0,
    SoundEffect.ssAlert: 7,
    SoundEffect.deathScream1: 10,
    SoundEffect.deathScream2: 11,
    SoundEffect.deathScream3: 23,
    SoundEffect.ssDeath: 28,

    SoundEffect.bossActive: 8,
    SoundEffect.hansGrosseDeath: 24,

    SoundEffect.levelComplete: 22,
  };

  @override
  SoundAssetRef? resolve(SoundEffect key) {
    final slot = _slots[key];
    return slot == null ? null : SoundAssetRef(slot);
  }
}
