# Changelog

All notable changes to DeathSound are documented here.

---

## [1.0.8] - 2026-05-29

### Added
- New emote images added to the Images folder
- Random Emote mode: shows a random image from the list on each death, never repeating the same one twice in a row
- Random checkbox in the Emote tab next to the image dropdown (same pattern as Sound tab)
- **Test button** for emotes: previews the selected emote image for 6 seconds without dying — respects Random and Popup Anchor mode
- Clicking the test button while a preview is active restarts the 6 second timer
- **PNG support** for emote images — `.png` is now the recommended format (smaller files, alpha channel, universally compatible)
- `.tga` files continue to work as legacy format

### Fixed
- `testTimer` moved to module level — prevents handle loss if the panel were ever rebuilt
- `UIDropDownMenu_Initialize` in the Sound tab now reads `DEATHSOUND_SOUND_LIST` fresh on each open instead of using a stale cached reference

### Changed
- `UpdateRandomMode` extracted as a named function instead of duplicated inline code
- `UpdateImageList.bat` now scans for both `.png` and `.tga` files (PNG first)
- `ImageList.lua` and `Images/README.txt` updated to reflect PNG as primary format

---

## [1.0.7] - 2026-05-28

### Added
- Options panel: two tabs — **Sound** and **Emote** — for a cleaner layout
- Emote tab: option to anchor the overlay to the left of the **Release Spirit** popup (automatically sized to match the popup height)
- When popup anchor is active, manual size/lock/reset controls are disabled automatically
- Active tab is highlighted in cyan, inactive tab in gray

### Fixed
- `HideOverlay` function had inverted lock condition and was never called — removed, replaced with direct `overlayFrame:Hide()`
- `AnchorToPopup` was recreated on every `ShowOverlay` call — extracted to module-level function
- `UpdatePopupMode` forward declaration removed — function now defined after all widgets it references
- `OVERLAY_DEFAULTS` were applied twice (in `ADDON_LOADED` and `BuildOverlaySection`) — kept only the necessary safety check in `BuildOverlaySection`
- Duplicate `resetBtn:SetScript` bug removed (was set twice with identical handlers)

### Changed
- Options panel split into **Sound** and **Emote** tabs
- Overlay size input is now a free-text EditBox (32–128 px, clamped on confirm) instead of fixed buttons
- `DeathSound_BuildOverlaySection` no longer takes an anchor frame argument — receives `imageFrame` directly

---

## [1.0.6] - 2026-05-27

### Added
- **Death Overlay** — displays a custom `.tga` image on screen when your character dies
- `Images\` subfolder for overlay image files (recommended: 256×256 or 512×512 px, alpha channel supported)
- `ImageList.lua` manifest for registering images (same pattern as SoundList.lua)
- `UpdateImageList.bat` — scans `Images\` and writes `ImageList.lua` automatically
- Image dropdown in options panel to select the active overlay image
- Four fixed size buttons (32×32, 64×64, 96×96, 128×128) to set overlay size
- Lock / Unlock button — unlocks the overlay for drag-to-move in edit mode
- Reset Position button to re-center the overlay on screen
- Overlay position, size and lock state saved in `DeathSoundDB`
- Overlay respects the global enable toggle — hidden when DeathSound is disabled
- ElvUI skin support for all new overlay option elements
- Localization for all new overlay strings (EN/DE)

### Fixed
- German locale: inconsistent umlaut substitutions cleaned up throughout (ä, ö, ü now used correctly everywhere)
- Overlay section alignment in options panel — all elements now flush left with the rest of the panel

### Changed
- Overlay size is controlled exclusively via the four fixed size buttons — no freeform resizing

---

## [1.0.5] - 2026-05-22

### Added
- New sound files added to the Sounds folder

### Fixed
- `buildOptionsPanel` was declared twice as a forward declaration — duplicate removed
- `UpdateModeUI` was called in `randomCB:OnClick` before it existed in scope — fixed via inner forward declaration inside `buildOptionsPanel`
- `StopCurrentSound` extracted as a dedicated function to avoid duplicated stop logic across all three play paths

### Changed
- `UpdateDropdownText` / `UpdateDropdownTextLocal` pattern replaced with `dropdownRef` — a module-level reference to the dropdown frame, used directly in `PlaySelectedSound` via `UIDropDownMenu_SetText`
- `UpdateModeUI` moved to after all widgets are defined, ensuring all upvalues are valid at call time

---

## [1.0.4] - 2026-05-20

### Added
- Random sound mode: plays a random sound from the list on each death, never repeating the same sound twice in a row
- Random checkbox in the options panel next to the Test button

### Fixed
- Random mode checkbox did not correctly update all UI elements on toggle — now calls `UpdateModeUI()` consistently
- Dropdown text did not refresh after a random pick — now shows which sound was last played
- `UpdateModeUI` used a single ambiguous alpha variable for two different purposes — split into `fileDimmed` and `ddDimmed` for clarity

---

## [1.0.3] - 2026-05-20

### Fixed
- `buildOptionsPanel` was incorrectly declared as a global function — now properly local via forward declaration
- Pressing Escape in the Sound ID EditBox restored the wrong value — snapshot is now saved on focus gained
- Dropdown overlay remained clickable when Custom File mode was disabled
- `OnHide` panel callback used an unnecessary global `_G` lookup — replaced with closure

### Changed
- `ddLabel`, `idLabel` and `idHint` are now correctly dimmed when switching modes

---

## [1.0.2] - 2026-05-20

### Added
- WoW Sound ID mode: play any in-game sound by entering its ID from Wowhead
- New sound files added to the Sounds folder
- New locale keys for Sound ID section (EN/DE)

### Changed
- Test buttons no longer show ">>" prefix — cleaner look
- Options panel now has two sections: Custom File and WoW Sound ID
- Both modes are mutually exclusive and toggle each other off automatically

---

## [1.0.1] - 2026-05-19

### Added
- New sound files added to the Sounds folder

### Changed
- All included sound files converted to `.ogg` format

---

## [1.0.0] - 2026-05-19

### Added
- Initial release
- Plays a custom sound via the Master audio channel on character death
- In-game options panel (ESC → Options → AddOns → DeathSound)
- Sound dropdown selector with live test button
- `UpdateSoundList.bat` — auto-generates `SoundList.lua` from the Sounds folder
- ElvUI skin — automatically applied when ElvUI is active
- Debounce: sound plays exactly once per death regardless of how often the game fires the death event
- Slash commands: `/deathsound`, `/deathsound test`, `/deathsound on/off`, `/ds`
- Localization: English and German