Function SetAmbientNightSound
| 2716 | function SetAmbientNightSound takes string inLabel returns nothing |
| 2717 | local real ToD |
| 2718 | |
| 2719 | // Stop old sound, if necessary
|
| 2720 | if (bj_nightAmbientSound != null) then |
| 2721 | call StopSound(bj_nightAmbientSound, true, true) |
| 2722 | endif
|
| 2723 | |
| 2724 | // Create new sound
|
| 2725 | set bj_nightAmbientSound = CreateMIDISound(inLabel, 20, 20) |
| 2726 | |
| 2727 | // Start the sound if necessary, based on current time
|
| 2728 | set ToD = GetTimeOfDay() |
| 2729 | if (ToD < bj_TOD_DAWN or ToD >= bj_TOD_DUSK) then |
| 2730 | call StartSound(bj_nightAmbientSound) |
| 2731 | endif
|
| 2732 | endfunction
|