uh, some of that was supposed to happen LAST commit
This commit is contained in:
60
OpenRa.Game/Sound.cs
Normal file
60
OpenRa.Game/Sound.cs
Normal file
@@ -0,0 +1,60 @@
|
||||
using IjwFramework.Collections;
|
||||
using IrrKlang;
|
||||
using OpenRa.FileFormats;
|
||||
using OpenRa.Game.GameRules;
|
||||
|
||||
namespace OpenRa.Game
|
||||
{
|
||||
static class Sound
|
||||
{
|
||||
static ISoundEngine soundEngine;
|
||||
static Cache<string, ISoundSource> sounds;
|
||||
|
||||
static ISoundSource LoadSound(string filename)
|
||||
{
|
||||
var data = AudLoader.LoadSound(FileSystem.Open(filename));
|
||||
return soundEngine.AddSoundSourceFromPCMData(data, filename,
|
||||
new AudioFormat()
|
||||
{
|
||||
ChannelCount = 1,
|
||||
FrameCount = data.Length / 2,
|
||||
Format = SampleFormat.Signed16Bit,
|
||||
SampleRate = 22050
|
||||
});
|
||||
}
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
soundEngine = new ISoundEngine();
|
||||
sounds = new Cache<string, ISoundSource>(LoadSound);
|
||||
}
|
||||
|
||||
public static void Play(string name)
|
||||
{
|
||||
var sound = sounds[name];
|
||||
// todo: positioning
|
||||
soundEngine.Play2D(sound, false /* loop */, false, false);
|
||||
}
|
||||
|
||||
public static void PlayVoice(string phrase, Actor voicedUnit)
|
||||
{
|
||||
if (voicedUnit == null) return;
|
||||
|
||||
var mi = voicedUnit.unitInfo as MobileInfo;
|
||||
if (mi == null) return;
|
||||
|
||||
var vi = Rules.VoiceInfo[mi.Voice];
|
||||
|
||||
var clip = vi.Pools.Value[phrase].GetNext();
|
||||
if (clip == null)
|
||||
return;
|
||||
|
||||
var variants = (voicedUnit.Owner.Race == Race.Soviet)
|
||||
? vi.SovietVariants : vi.AlliedVariants;
|
||||
|
||||
var variant = variants[voicedUnit.ActorID % variants.Length];
|
||||
|
||||
Play(clip + variant);
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
artsrc/bits.psd
Normal file
BIN
artsrc/bits.psd
Normal file
Binary file not shown.
BIN
interior.pal
BIN
interior.pal
Binary file not shown.
15
makedist.cmd
Normal file
15
makedist.cmd
Normal file
@@ -0,0 +1,15 @@
|
||||
rmdir /s /q ..\openra-bin
|
||||
mkdir ..\openra-bin
|
||||
copy *.mix ..\openra-bin\
|
||||
copy *.ini ..\openra-bin\
|
||||
copy *.rem ..\openra-bin\
|
||||
copy *.til ..\openra-bin\
|
||||
copy INSTALL ..\openra-bin\
|
||||
copy LICENSE ..\openra-bin\
|
||||
copy *.fx ..\openra-bin\
|
||||
copy *.xml ..\openra-bin\
|
||||
copy specialbin.png ..\openra-bin\
|
||||
copy OpenRA.Server\bin\debug\OpenRA.Server ..\openra-bin\
|
||||
copy SequenceEditor\bin\x86\debug\SequenceEditor.exe ..\openra-bin\
|
||||
copy OpenRA.Game\bin\x86\debug\*.dll ..\openra-bin\
|
||||
copy OpenRA.Game\bin\x86\debug\OpenRa.Game.exe ..\openra-bin\
|
||||
Reference in New Issue
Block a user