TribesReplay/base/scripts/clientAudio.cs

432 lines
10 KiB
C#
Raw Normal View History

2017-07-17 22:51:48 -04:00
//--------------------------------------------------------------------------
//
//
//
//--------------------------------------------------------------------------
// ordered list of providers
$AudioProviders[0, name] = "Creative Labs EAX 2 (TM)";
$AudioProviders[0, isHardware] = true;
$AudioProviders[0, enableEnvironment] = true;
$AudioProviders[1, name] = "Creative Labs EAX (TM)";
$AudioProviders[1, isHardware] = true;
$AudioProviders[1, enableEnvironment] = true;
$AudioProviders[2, name] = "DirectSound3D Hardware Support";
$AudioProviders[2, isHardware] = true;
$AudioProviders[2, enableEvironment] = false;
$AudioProviders[3, name] = "Miles Fast 2D Positional Audio";
$AudioProviders[3, isHardware] = false;
$AudioProviders[3, enableEvironment] = false;
// defaults
$Audio::defaultDriver = "miles";
$Audio::innerFalloffScale = "1.0";
$Audio::dynamicMemorySize = (1 << 20);
function audioIsHardwareProvider(%provider)
{
for(%i = 0; $AudioProviders[%i, name] !$= ""; %i++)
if(%provider $= $AudioProviders[%i, name])
return($AudioProviders[%i, isHardware]);
return(false);
}
function audioIsEnvironmentProvider(%provider)
{
for(%i = 0; $AudioProviders[%i, name] !$= ""; %i++)
if(%provider $= $AudioProviders[%i, name])
return($AudioProviders[%i, enableEnvironment]);
return(false);
}
function audioUpdateProvider(%provider)
{
// check if should be using hardware settings by default
alxDisableOuterFalloffs(false);
for(%i = 0; $AudioProviders[%i, name] !$= ""; %i++)
{
if(%provider $= $AudioProviders[%i, name])
{
// hardware
if($AudioProviders[%i, isHardware])
{
alxDisableOuterFalloffs(true);
alxSetInnerFalloffScale($Audio::innerFalloffScale);
}
// environment
%enable = $pref::Audio::environmentEnabled && audioIsEnvironmentProvider(%provider);
alxEnableEnvironmental(%enable);
break;
}
}
}
function initAudio()
{
$Audio::originalProvider = alxGetContexti(ALC_PROVIDER);
%providerName = alxGetContextstr(ALC_PROVIDER_NAME, $Audio::originalProvider);
audioUpdateProvider(%providerName);
// voice?
if($pref::Audio::enableVoiceCapture)
$Audio::captureInitialized = alxCaptureInit();
// Set volume based on prefs:
alxListenerf( AL_GAIN_LINEAR, $pref::Audio::masterVolume );
alxContexti( ALC_BUFFER_DYNAMIC_MEMORY_SIZE, $Audio::dynamicMemorySize );
alxSetChannelVolume( $EffectAudioType, $pref::Audio::effectsVolume );
alxSetChannelVolume( $VoiceAudioType, $pref::Audio::voiceVolume );
alxSetChannelVolume( $ChatAudioType, $pref::Audio::radioVolume );
alxSetChannelVolume( $MusicAudioType, $pref::Audio::musicVolume );
alxSetChannelVolume( $GuiAudioType, $pref::Audio::guiVolume );
alxSetChannelVolume( $RadioAudioType, $pref::Audio::radioVolume );
alxSetCaptureGainScale( $pref::Audio::captureGainScale );
v23115 (05/30/01): - (bug fix) Fixed an authentication hole that allowed arbitrary IP connections to a LAN server. The policy now is: LAN servers will disallow any connections from IP addresses that do not match the Class B network address of the server (or match one of them, in a multihomed server). So if your server's address is 12.13.14.15, clients from 12.13.*.* will be considered, but clients from 12.12.*.* will be immediately rejected. In addition, a LAN server will only allow 4 unique Class C ids at any one time. This should be sufficiently lenient for even the largest LAN parties, but should eliminate the auth hole. - (bug fix) Fixed a server crash on mission change when the last human player leaves the game in mid cycle. - (bug fix) Fixed a bug that could reset your Shape Detail setting to max - (bug fix) Client join message name correction - (bug fix) All known in-game Chat HUD bugs are fixed (partial lines from paging up/down and resize issues, etc.). - (bug fix) Infinite missile lock-on sound bug is fixed. Dead. Finito. No more. Pushing up the daisies. - (bug fix) Stitched up a hole associated with one of the base shapes. Small fry compared to the memory leaks. - (bug fix) Found a particle crash issue and plugged it up good. - (bug fix) Fixed a shield impact internal compile error that was crunching frame rate. - (bug fix) Turns out we tweaked it so inventory stations were counting as turrets for turret placement purposes. D'oh. Fixed. - (bug fix) A rare crash that occurred with the Radeon VE card has been resolved. - (bug fix) Fixed a crash that could occur when a flare grenade was released when inside a force field. - (bug fix) Deployable turrets (spider and spike) and Deployable inv stations now do damage in their explosion when they are destroyed. - (optimization) The following missions were refined in order to optimize framerate: Alcatraz Caldera Flashpoint Gauntlet IceBound Insalubria Overreach Respite Sirocco - (optimization) Adjusted the LOD of the logo projectors found in CnH missions. - (optimization) Changed object shield shapes from the form-fitting forcefields into a less poly-intensive dome effect. Also gave shields a lower memory profile. - (optimization) Changed the way the clouds' planes are clipped. Sky's the limit, right? - (optimization) Missile sound script calls moved from script into code for faster processing. - (memory leak) Fixed a large memory leak. This plus the other leaks mentioned here should finally put the nail in the coffin on the "degrading server performance" issue. - (memory leak) Fixed a memory leak associated with the pretty lightning effects on maps like Casern Cavite.memory leaks: - (memory leak) Fixed a memory leak in our fancy text list control and the gui text list. - (memory leak) Fixed a memory leak involving memory use and resource allocation. - (improvement) Targeting laser prediction should be better now. - (improvement) You can specify a server's IP address manually at the join screen - (improvement) You can now specify "-password <pw>" on the command line to join a server that requires a password. - (improvement) Heavy armors are tougher against snipers. You now require four headshots or five body shots to kill a Juggernaut with a laser rifle. - (improvement) Footspeed of all armors increased slightly, as well as a minor boost to jetpack performance. Some improvements made to air resistance for mediums and heavy armors (very subtle). - (improvement) The jetpack effect was reverted back to the old effect (by popular demand). - (improvement) A Chat HUD message has been added that is displayed whenever you try to deploy a mine, but your team's maximum number of mines has already been deployed. Previously, the mine would just blow up and not explain why it detonated. Now, it still blows up, but tells you why it happened. - (improvement) Polished up the health meter on the HUD so when you're still alive, it displays a visible sliver of positive health. - (improvement) Made framerate and gameplay changes to Caldera. The attackers' base has been moved farther from the defenders, and the switch has been put in one of the upper chambers, while the stations are located separately from the generators. The changes should fix a serious defensive advantage. - (improvement) After you buy a vehicle, you now fade into the driver's seat if your armor and pack make you an eligible pilot/driver. - (improvement) Added a "rogue" mine message so that if you are killed by a mine laid by someone who has left the building, the death message is more accurate. - (improvement) Increased speed of belly turret projectiles so that it is more effective in general (especially for air defense). - (improvement) Modified name tags of vehicles when you place your reticle over them. Names are now more consistent and descriptive. - (improvement) Missile and AA turrets now have a longer maximum range (you'll still need to deploy sensors to get this added range, but they can fire farther if you do). They also react more quickly to available targets. - (community) The "compose email", "forum post", and "news submission" windows are now resizable and movable.
2017-07-17 23:20:27 -04:00
// cap the codec levels
if( $platform $= "linux" )
{
$pref::Audio::encodingLevel = -1;
$pref::Audio::decodingMask = 0;
}
if( $pref::Audio::encodingLevel > 2)
$pref::Audio::encodingLevel = 2;
$pref::Audio::decodingMask &= 7;
2017-07-17 22:51:48 -04:00
}
if($Audio::initialized)
initAudio();
//--------------------------------------------------------------------------
// MP3-Music player
new ScriptObject(MusicPlayer)
{
class = MP3Audio;
currentTrack = "";
repeat = true;
};
function MP3Audio::stop(%this)
{
alxStopMusic();
}
function getRandomTrack()
{
%val = mFloor(getRandom(0, 4));
switch(%val)
{
case 0:
return "lush";
case 1:
return "volcanic";
case 2:
return "badlands";
case 3:
return "ice";
case 4:
return "desert";
}
}
function MP3Audio::play(%this)
{
if(%this.currentTrack $= "")
%this.currentTrack = getRandomTrack();
%this.playTrack(%this.currentTrack);
}
function MP3Audio::playTrack(%this, %trackName)
{
%this.currentTrack = %trackName;
if($pref::Audio::musicEnabled)
alxPlayMusic("base\\music\\" @ %trackName @ ".mp3");
}
function finishedMusicStream(%stopped)
{
if(%stopped $= "true")
return;
if(MusicPlayer.repeat)
MusicPlayer.playTrack(MusicPlayer.currentTrack);
}
function clientCmdPlayMusic(%trackname)
{
if(%trackname !$= "")
MusicPlayer.playTrack(%trackName);
}
function clientCmdStopMusic()
{
MusicPlayer.stop();
}
//--------------------------------------
// Audio Profiles
//
new AudioDescription(AudioGui)
{
volume = 1.0;
isLooping= false;
is3D = false;
type = $GuiAudioType;
};
new AudioDescription(AudioChat)
{
volume = 1.0;
isLooping= false;
is3D = false;
type = $ChatAudioType;
};
new AudioDescription(AudioGuiLoop)
{
volume = 1.0;
isLooping= true;
is3D = false;
type = $GuiAudioType;
};
new AudioProfile(sButtonDown)
{
filename = "gui/buttonDown.wav";
description = "audioGui";
preload = true;
};
new AudioProfile(sButtonOver)
{
filename = "gui/buttonOver.wav";
description = "audioGui";
preload = true;
};
new AudioProfile(sGotMail)
{
filename = "gui/youvegotmail.wav";
description = "audioGui";
preload = true;
};
new AudioProfile(sLaunchMenuOpen)
{
filename = "gui/launchMenuOpen.wav";
description = "audioGui";
preload = true;
};
new AudioProfile(sLaunchMenuOver)
{
filename = "gui/buttonOver.wav";
description = "audioGui";
preload = true;
};
new AudioProfile(VoteForSound)
{
filename = "gui/buttonOver.wav";
description = "audioGui";
preload = true;
};
new AudioProfile(VoteAgainstSound)
{
filename = "gui/buttonOver.wav";
description = "audioGui";
preload = true;
};
new AudioProfile(TaskAcceptedSound)
{
filename = "fx/misc/command_accept.wav";
description = "audioGui";
preload = true;
};
new AudioProfile(TaskDeclinedSound)
{
filename = "fx/misc/command_deny.wav";
description = "audioGui";
preload = true;
};
new AudioProfile(TaskCompletedSound)
{
filename = "fx/misc/command_complete.wav";
description = "audioGui";
preload = true;
};
v22228 (04/06/01): * Fixed a problem that could have caused texture leaking in the interiors * Fixed an AI problem in Training 2 * Chinese "simplified" keyboard supported * Korean keyboard supported * A bug where infinite ammo could be gained by tossing the ammo was prevented. * Fixed a problem in Training 2 where a waypoint wouldn't update properly. * Thundersword and Havoc hold steady now when players try to jump in so they don't invert and detonate. * CD is now required in the drive for on-line play. * Scoring has been fixed so that it isn't blanked any longer if the admin changes the time limit during a game. * Active server queries will be cancelled now when you join a game (loads game faster now). * If standing in an inventory station when it is destroyed you no longer permanently lose weapons. * Fixed two issues that *could* cause crashes. * Fixed a problem where the bombardier could create a permanent targeting laser. * Cleaned up Chat text to remove programming characters. * Fixed "highlight text with my nick" option so it saves preference to file correctly. * Made MPB able to climb hills more easily and reduced damage from impact with the ground. * Added button to stop server queries in progress on "JOIN" screen. * Observers can now only chat with other observers (no one else can hear them). * Made deployable inv stations have smaller trigger so they don't "suck you in" from so far away. * Bots will now claim switches in CnH more accurately. * Added a "max distance" ring for sensors on the commander map so players can more accurately assess how well they placed the sensor in relation to how much area it is actually sensing. * Added a "ding" sound when you have filled up a text buffer so that you know why your text isn't showing up. * Fixed Chat HUD so that page up/page down works better. * Fixed a situation where Heavies could end up being permanently cloaked. * The MPBs on the "Alcatraz" map now deploy correctly (Siege map). * The "edited post" date stamp now works correctly. * If you jump into a vehicle while zoomed in, the zoom will reset correctly therafter now. * The Score Screen (F2) is now available while in a vehicle. * You can now vote to kick observers, if desired. * The ELF turret is fixed so it no longer fires at players when destroyed (an intermittent bug) * Some console spam associated with the Wildcat has been removed. * There was a situation where a player could die twice if he fell out of bounds. That has been resolved. * Screen resolution information should update properly now when restarting the application. * The camera should no longer be able to dip below terrain when in third person mode.
2017-07-17 23:05:21 -04:00
new AudioProfile(InputDeniedSound)
{
filename = "fx/misc/diagnostic_beep.wav";
description = "audioGui";
preload = true;
};
2017-07-17 22:51:48 -04:00
//--------------------------------------------------------------------------
//-------------------------------------- Shapebase lock/homing tones...
new AudioDescription(AudioLockTones)
{
volume = 1.0;
isLooping= true;
is3D = false;
type = $EffectAudioType;
};
new AudioProfile(sSearchingTone)
// Sound that the FIRER hears when SEEKING a "hot" target
{
filename = "fx/weapons/missile_firer_search.wav";
description = "audioLockTones";
preload = true;
};
new AudioProfile(sLockedTone)
// Sound that the FIRER hears when a "hot" target is LOCKED
{
filename = "fx/weapons/missile_firer_lock.wav";
description = "audioLockTones";
preload = true;
};
new AudioProfile(sMissileLockWarningTone)
// Sound that the TARGET hears when a LOCK has been achieved
{
filename = "fx/weapons/missile_target_lock.wav";
description = "audioLockTones";
preload = true;
};
new AudioProfile(sMissileHomingWarningTone)
// Sound that the TARGET hears when a missile has been locked onto the target and is IN THE AIR
{
filename = "fx/weapons/missile_target_inbound.wav";
description = "audioLockTones";
preload = true;
};
//--------------------------------------------------------------------------
new AudioProfile(HudInventoryHumSound)
{
filename = "gui/inventory_hum.wav";
description = "AudioGuiLoop";
preload = true;
};
new AudioProfile(HudInventoryActivateSound)
{
filename = "gui/inventory_on.wav";
description = "AudioGui";
preload = true;
};
new AudioProfile(HudInventoryDeactivateSound)
{
filename = "gui/inventory_off.wav";
description = "AudioGui";
preload = true;
};
new AudioProfile(CommandMapHumSound)
{
filename = "gui/command_hum.wav";
description = "AudioGuiLoop";
preload = true;
};
new AudioProfile(CommandMapActivateSound)
{
filename = "gui/command_on.wav";
description = "AudioGui";
preload = true;
};
new AudioProfile(CommandMapDeactivateSound)
{
filename = "gui/command_off.wav";
description = "AudioGui";
preload = true;
};
new AudioProfile(ShellScreenHumSound)
{
filename = "gui/shell_hum.wav";
description = "AudioGuiLoop";
preload = true;
};
new AudioProfile(LoadingScreenSound)
{
filename = "gui/loading_hum.wav";
description = "AudioGuiLoop";
preload = true;
};
new AudioProfile(VotePassSound)
{
filename = "fx/misc/vote_passes.wav";
description = "AudioGui";
preload = true;
};
new AudioProfile(VoteNotPassSound)
{
filename = "fx/misc/vote_fails.wav";
description = "AudioGui";
preload = true;
};
new AudioProfile(AdminForceSound)
{
filename = "fx/misc/bounty_completed.wav";
description = "AudioGui";
preload = true;
};
new AudioProfile(VoteInitiatedSound)
{
filename = "fx/misc/vote_initiated.wav";
description = "AudioGui";
preload = true;
};
// Tinman - not being used anymore...
// new AudioProfile(OutOfBoundsSound)
// {
// filename = "gui/vote_nopass.wav";
// description = "AudioGuiLoop";
// preload = true;
// };
new AudioProfile(BountyBellSound)
{
filename = "fx/misc/bounty_bonus.wav";
description = "AudioGui";
preload = true;
};
new AudioProfile(SiegeSwitchSides)
{
filename = "fx/misc/siege_switching.wav";
description = "AudioGui";
preload = true;
};
new AudioProfile(ObjectiveCompleted)
{
filename = "fx/misc/bounty_bonus.wav";
description = "AudioGui";
preload = true;
};