Skip to content

Improve overlay tools

Veeq7 requested to merge overlay_tools into dev

This should allow easier Audiovisuals

Allows for smart immediate mode overlay setting: bw::set_unit_overlay(unit, overlay, false/true) instead of having to do complex if trees with bw::add_unit_overlay and bw::remove_unit_overlay.

Also as last optional argument for all those 3 functions, we know have a settings param.

bw::set_unit_overlay(unit, ImageId::SomeOverlay, false/true); // Usually instead of false/true we would pass a bool that says if a behavior is `active`

bw::set_unit_overlay(unit, ImageId::SomeOverlay, false/true, {
    .underlay = true,
    .add_sound = SoundId::SomeSound,
    .remove_sound = {SoundId::SomeRandomSound1, SoundId::SomeRandomSound3},
});

(keep in mind that those .vars are individually optional, so you can skip the ones you don't care about)

See examples where I edited Ancile code a bit.

Now all overlay functions accept an ImageSet, which basically allows you to either pass ImageId::SpecificId or {ImageId::SmallestSizeOverlay, ImageId::LargestSizeOverlay} and it will be handled automagically. As long as SmallestSize is first and LargestSize is second it will matchup with the visual size, the internal handling will calculate which overlay to use for each unit, even for reverse order enums that we sometimes have. XLarge is also automatic (will fallback on Large).

Same goes for sounds in the settings struct (add_sound, remove_sound) and for brand new bw::play_sound(unit/pos, sound); bw::play_sound_local(unit/pos, sound); where you can pass SoundId::OnlyOneSound or {SoundId::Sound1, SoundId::Sound2} and it will randomize automagically. Also as added bonus it's generic over unit and pos, so don't have to think which helper to call. With min_volume as optional param.

Edited by Veeq7

Merge request reports

Loading