This is also how I'd like to see it, and I'm almost done coding it. There's one problem left: I can't get sounds to play at half the volume.Sean Mirrsen wrote:(...) unit replies that are always full volume when on screen, and half volume when off screen, just as it was in TA. (Check this post for the quote)
Full volume is no problem; you just use the CSound::PlaySound(int id) function. But I can't figure out how to get exactly half the volume with the CSound::PlaySound(int id,const float3& p,float volume) function. The volume float doesn't behave as I would expect (0=no volume, 1=full volume). But no, it gets multiplied with strange numbers and divides the volume you end up with ... sigh ... I'm sure it's logical and all, but I just don't get it.
Any info on how it behaves and how to get the "half volume thing" working is appreciated.
As a sidenote I might poll what unit sounds should be played at what volume. Imho greater audibility of important sounds leads to greater playability.
According to UnitDef.h there are 10 unit sounds:
Code: Select all
struct SoundStruct {
GuiSound select;
GuiSound ok;
GuiSound arrived;
GuiSound build;
GuiSound repair;
GuiSound working;
GuiSound underattack;
GuiSound cant;
GuiSound activate;
GuiSound deactivate;
};