forked from mirror/openmw-tes3mp
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
1.1 KiB
C++
50 lines
1.1 KiB
C++
#include "loadsoun.hpp"
|
|
|
|
#include "esmreader.hpp"
|
|
#include "esmwriter.hpp"
|
|
#include "defs.hpp"
|
|
|
|
namespace ESM
|
|
{
|
|
unsigned int Sound::sRecordId = REC_SOUN;
|
|
|
|
void Sound::load(ESMReader &esm)
|
|
{
|
|
bool hasData = false;
|
|
while (esm.hasMoreSubs())
|
|
{
|
|
esm.getSubName();
|
|
uint32_t name = esm.retSubName().val;
|
|
switch (name)
|
|
{
|
|
case ESM::FourCC<'F','N','A','M'>::value:
|
|
mSound = esm.getHString();
|
|
break;
|
|
case ESM::FourCC<'D','A','T','A'>::value:
|
|
esm.getHT(mData, 3);
|
|
hasData = true;
|
|
break;
|
|
default:
|
|
esm.fail("Unknown subrecord");
|
|
}
|
|
}
|
|
if (!hasData)
|
|
esm.fail("Missing DATA");
|
|
}
|
|
|
|
void Sound::save(ESMWriter &esm) const
|
|
{
|
|
esm.writeHNOCString("FNAM", mSound);
|
|
esm.writeHNT("DATA", mData, 3);
|
|
}
|
|
|
|
void Sound::blank()
|
|
{
|
|
mSound.clear();
|
|
|
|
mData.mVolume = 128;
|
|
mData.mMinRange = 0;
|
|
mData.mMaxRange = 255;
|
|
}
|
|
}
|