2025-08-03 01:16 CEST

spring: develop 50cfb7ea Diff ] Back to Repository ]
Author Committer Branch Timestamp Parent
KDR_11k KDR_11k develop 2007-12-09 23:04:44 develop 4ad337ad
Changeset * committed Lurker's playsound patch, closing Mantis 0000690

Original patch description:
1) Adds a new get call, PLAY_SOUND, to play a sound that can be heard only by allies, enemy, in los, etc.
2) changes get health to allow a unit ID to be passed
3) adds a call to create() at the end of ReloadCOB

GET PLAY_SOUND(sound number, volume, who hears the sound, where to play the sound)

To set up sounds to use with GET PLAY_SOUND, put a function like this near the top of your bos:
Sounds()
{
    play-sound ("movement", 10);
    play-sound ("pew", 10);
    play-sound ("reporting", 10);
}
The sound number is based on the order the sounds appear, staring from 0. To call the songs by name, add #defines like this:
Sounds()
{
    play-sound ("movement", 10);
    #define movement 0
    play-sound ("pew", 10);
    #define pew 1
    play-sound ("reporting", 10);
    #define reporting 2
}

To actually call the sound, you use a line such as this:
    GET PLAY_SOUND (pew, 655360);

1) sound number - as above

2) volume - similar to the volume for play-sound, more affecting the distance where it is audible than actual volume
        - given as a float multiplied by 65536

3) who hears the sound
    0 = anyone with the unit in ALOS
    1 = anyone with the unit in LOS
    2 = anyone with the unit in ALOS or radar
    3 = anyone with the unit in LOS or radar
    4 = everyone
    5 = the unit's allies
    6 = the unit's team
    7 = the unit's enemies

4) where to play the sound
        - if 0, the sound is played from the unit's position
        - if 1, the sound is played directly from the speakers, the same way unit replies are

git-svn-id: https://spring.clan-sy.com/svn/spring/trunk@4974 37977431-3df6-0310-b722-df95706aa16b
mod - rts/Game/Game.cpp Diff ] File ]
mod - rts/Sim/Units/COB/CobInstance.cpp Diff ] File ]