|
||
|
|
#1 (permalink) |
|
Forum Expert
|
I've been toying with the UO SDK lately, and since I was missing some features I've decided to code them.
Changelog: Updated: - Animation class now supports the ML exapnsion. New features: - ASCII text export. - Sound export. Suggestions & bug reports strongly appreciated. Thanks to rsmiller21 for suggestions on sounds.
__________________
Last edited by arul; 12-31-2006 at 05:27 PM. |
|
|
|
|
|
#4 (permalink) |
|
Forum Novice
|
I have been working on a program dealing with the new Ultima.dll here and wanted to post a few code snippets.
Playing the sound: Code:
publicstaticvoid PlaySound(MemoryStream ms)
{
System.Media.SoundPlayer sp = new System.Media.SoundPlayer();
sp.Stream = ms;
sp.Play();
}
Code:
publicstaticstring GetSoundName(int soundID)
{
if (soundID < 0) { returnnull; }
m_Index.BaseStream.Seek((long)(soundID * 12), SeekOrigin.Begin);
int offset = m_Index.ReadInt32();
int length = m_Index.ReadInt32();
int extra = m_Index.ReadInt32();
if ((offset < 0) || (length <= 0))
{
if (!m_Translations.TryGetValue(soundID, out soundID)) { returnnull; }
m_Index.BaseStream.Seek((long)(soundID * 12), SeekOrigin.Begin);
offset = m_Index.ReadInt32();
length = m_Index.ReadInt32();
extra = m_Index.ReadInt32();
}
if ((offset < 0) || (length <= 0)) { returnnull; }
byte[] buffer = newbyte[40];
m_Stream.Seek((long)(offset), SeekOrigin.Begin);
m_Stream.Read(buffer, 0, 40);
return System.Text.Encoding.UTF8.GetString(buffer);
}
__________________
This is a bad signature.
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|