Add support for loading sound assets from iw4 zones

This commit is contained in:
Jan
2020-09-08 12:11:16 +02:00
parent 79848b4631
commit d35560ccd7
8 changed files with 246 additions and 37 deletions

View File

@ -0,0 +1,22 @@
#include "loadedsound_actions.h"
using namespace IW4;
Actions_LoadedSound::Actions_LoadedSound(Zone* zone)
: AssetLoadingActions(zone)
{
}
void Actions_LoadedSound::SetSoundData(MssSound* sound) const
{
if (sound->info.data_len > 0)
{
char* tempData = sound->data;
sound->data = static_cast<char*>(m_zone->GetMemory()->Alloc(sound->info.data_len));
memcpy(sound->data, tempData, sound->info.data_len);
}
else
{
sound->data = nullptr;
}
}

View File

@ -0,0 +1,15 @@
#pragma once
#include "Loading/AssetLoadingActions.h"
#include "Game/IW4/IW4.h"
namespace IW4
{
class Actions_LoadedSound final : public AssetLoadingActions
{
public:
explicit Actions_LoadedSound(Zone* zone);
void SetSoundData(MssSound* sound) const;
};
}