mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-06-11 07:18:11 -05:00
Add support for loading sound assets from iw4 zones
This commit is contained in:
@ -17,7 +17,7 @@
|
||||
//#include "Game/IW4/XAssets/gfxlightdef/gfxlightdef_load_db.h"
|
||||
//#include "Game/IW4/XAssets/gfxworld/gfxworld_load_db.h"
|
||||
//#include "Game/IW4/XAssets/leaderboarddef/leaderboarddef_load_db.h"
|
||||
//#include "Game/IW4/XAssets/loadedsound/loadedsound_load_db.h"
|
||||
#include "Game/IW4/XAssets/loadedsound/loadedsound_load_db.h"
|
||||
//#include "Game/IW4/XAssets/localizeentry/localizeentry_load_db.h"
|
||||
//#include "Game/IW4/XAssets/mapents/mapents_load_db.h"
|
||||
#include "Game/IW4/XAssets/material/material_load_db.h"
|
||||
@ -30,8 +30,8 @@
|
||||
#include "Game/IW4/XAssets/physcollmap/physcollmap_load_db.h"
|
||||
#include "Game/IW4/XAssets/physpreset/physpreset_load_db.h"
|
||||
#include "Game/IW4/XAssets/rawfile/rawfile_load_db.h"
|
||||
//#include "Game/IW4/XAssets/snd_alias_list_t/snd_alias_list_t_load_db.h"
|
||||
//#include "Game/IW4/XAssets/sndcurve/sndcurve_load_db.h"
|
||||
#include "Game/IW4/XAssets/snd_alias_list_t/snd_alias_list_t_load_db.h"
|
||||
#include "Game/IW4/XAssets/sndcurve/sndcurve_load_db.h"
|
||||
//#include "Game/IW4/XAssets/snddriverglobals/snddriverglobals_load_db.h"
|
||||
#include "Game/IW4/XAssets/stringtable/stringtable_load_db.h"
|
||||
//#include "Game/IW4/XAssets/structureddatadefset/structureddatadefset_load_db.h"
|
||||
@ -110,9 +110,9 @@ void ContentLoaderIW4::LoadXAsset(const bool atStreamStart)
|
||||
LOAD_ASSET(ASSET_TYPE_VERTEXDECL, MaterialVertexDeclaration, vertexDecl);
|
||||
LOAD_ASSET(ASSET_TYPE_TECHNIQUE_SET, MaterialTechniqueSet, techniqueSet);
|
||||
LOAD_ASSET(ASSET_TYPE_IMAGE, GfxImage, image);
|
||||
// LOAD_ASSET(ASSET_TYPE_SOUND, snd_alias_list_t, sound);
|
||||
// LOAD_ASSET(ASSET_TYPE_SOUND_CURVE, SndCurve, sndCurve);
|
||||
// LOAD_ASSET(ASSET_TYPE_LOADED_SOUND, LoadedSound, loadSnd);
|
||||
LOAD_ASSET(ASSET_TYPE_SOUND, snd_alias_list_t, sound);
|
||||
LOAD_ASSET(ASSET_TYPE_SOUND_CURVE, SndCurve, sndCurve);
|
||||
LOAD_ASSET(ASSET_TYPE_LOADED_SOUND, LoadedSound, loadSnd);
|
||||
// LOAD_ASSET(ASSET_TYPE_CLIPMAP_SP, clipMap_t, clipMap);
|
||||
// LOAD_ASSET(ASSET_TYPE_CLIPMAP_MP, clipMap_t, clipMap);
|
||||
// LOAD_ASSET(ASSET_TYPE_COMWORLD, ComWorld, comWorld);
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
@ -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;
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user