[ZoneBuilder] Add LoadedSound interface
This commit is contained in:
parent
1b12886229
commit
3551d0c0eb
@ -393,6 +393,7 @@ namespace Components
|
|||||||
AssetHandler::RegisterInterface(new Assets::IPhysPreset());
|
AssetHandler::RegisterInterface(new Assets::IPhysPreset());
|
||||||
AssetHandler::RegisterInterface(new Assets::IXAnimParts());
|
AssetHandler::RegisterInterface(new Assets::IXAnimParts());
|
||||||
AssetHandler::RegisterInterface(new Assets::IFxEffectDef());
|
AssetHandler::RegisterInterface(new Assets::IFxEffectDef());
|
||||||
|
AssetHandler::RegisterInterface(new Assets::ILoadedSound());
|
||||||
AssetHandler::RegisterInterface(new Assets::IPhysCollmap());
|
AssetHandler::RegisterInterface(new Assets::IPhysCollmap());
|
||||||
AssetHandler::RegisterInterface(new Assets::IStringTable());
|
AssetHandler::RegisterInterface(new Assets::IStringTable());
|
||||||
//AssetHandler::RegisterInterface(new Assets::IXModelSurfs());
|
//AssetHandler::RegisterInterface(new Assets::IXModelSurfs());
|
||||||
|
@ -77,6 +77,7 @@ namespace Components
|
|||||||
#include "AssetInterfaces\IPhysPreset.hpp"
|
#include "AssetInterfaces\IPhysPreset.hpp"
|
||||||
#include "AssetInterfaces\IXAnimParts.hpp"
|
#include "AssetInterfaces\IXAnimParts.hpp"
|
||||||
#include "AssetInterfaces\IFxEffectDef.hpp"
|
#include "AssetInterfaces\IFxEffectDef.hpp"
|
||||||
|
#include "AssetInterfaces\ILoadedSound.hpp"
|
||||||
#include "AssetInterfaces\IPhysCollmap.hpp"
|
#include "AssetInterfaces\IPhysCollmap.hpp"
|
||||||
#include "AssetInterfaces\IStringTable.hpp"
|
#include "AssetInterfaces\IStringTable.hpp"
|
||||||
#include "AssetInterfaces\IXModelSurfs.hpp"
|
#include "AssetInterfaces\IXModelSurfs.hpp"
|
||||||
|
45
src/Components/Modules/AssetInterfaces/ILoadedSound.cpp
Normal file
45
src/Components/Modules/AssetInterfaces/ILoadedSound.cpp
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
#include <STDInclude.hpp>
|
||||||
|
|
||||||
|
namespace Assets
|
||||||
|
{
|
||||||
|
void ILoadedSound::save(Game::XAssetHeader header, Components::ZoneBuilder::Zone* builder)
|
||||||
|
{
|
||||||
|
AssertSize(Game::LoadedSound, 44);
|
||||||
|
|
||||||
|
Utils::Stream* buffer = builder->getBuffer();
|
||||||
|
Game::LoadedSound* asset = header.sound;
|
||||||
|
Game::LoadedSound* dest = buffer->dest<Game::LoadedSound>();
|
||||||
|
buffer->save(asset);
|
||||||
|
|
||||||
|
buffer->pushBlock(Game::XFILE_BLOCK_VIRTUAL);
|
||||||
|
|
||||||
|
if (asset->name)
|
||||||
|
{
|
||||||
|
buffer->saveString(builder->getAssetName(this->getType(), asset->name));
|
||||||
|
Utils::Stream::ClearPointer(&dest->name);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
buffer->pushBlock(Game::XFILE_BLOCK_TEMP);
|
||||||
|
|
||||||
|
if (asset->mssSound.data)
|
||||||
|
{
|
||||||
|
if (builder->hasPointer(asset->mssSound.data))
|
||||||
|
{
|
||||||
|
dest->mssSound.data = builder->getPointer(asset->mssSound.data);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
builder->storePointer(asset->mssSound.data);
|
||||||
|
|
||||||
|
buffer->saveArray(asset->mssSound.data, asset->mssSound.size);
|
||||||
|
Utils::Stream::ClearPointer(&dest->mssSound.data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
buffer->popBlock();
|
||||||
|
}
|
||||||
|
|
||||||
|
buffer->popBlock();
|
||||||
|
}
|
||||||
|
}
|
10
src/Components/Modules/AssetInterfaces/ILoadedSound.hpp
Normal file
10
src/Components/Modules/AssetInterfaces/ILoadedSound.hpp
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
namespace Assets
|
||||||
|
{
|
||||||
|
class ILoadedSound : public Components::AssetHandler::IAsset
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual Game::XAssetType getType() override { return Game::XAssetType::ASSET_TYPE_LOADED_SOUND; };
|
||||||
|
|
||||||
|
virtual void save(Game::XAssetHeader header, Components::ZoneBuilder::Zone* builder) override;
|
||||||
|
};
|
||||||
|
}
|
@ -514,6 +514,9 @@ namespace Components
|
|||||||
// Don't create default assets
|
// Don't create default assets
|
||||||
Utils::Hook::Set<BYTE>(0x407BAA, 0xEB);
|
Utils::Hook::Set<BYTE>(0x407BAA, 0xEB);
|
||||||
|
|
||||||
|
// Don't load sounds
|
||||||
|
Utils::Hook::Set<BYTE>(0x334D41, 0xC3);
|
||||||
|
|
||||||
// Don't display errors when assets are missing (we might manually build those)
|
// Don't display errors when assets are missing (we might manually build those)
|
||||||
Utils::Hook::Nop(0x5BB3F2, 5);
|
Utils::Hook::Nop(0x5BB3F2, 5);
|
||||||
Utils::Hook::Nop(0x5BB422, 5);
|
Utils::Hook::Nop(0x5BB422, 5);
|
||||||
|
@ -1215,14 +1215,26 @@ namespace Game
|
|||||||
char * compressedData;
|
char * compressedData;
|
||||||
};
|
};
|
||||||
|
|
||||||
#pragma pack(push, 4)
|
|
||||||
struct SndCurve
|
struct SndCurve
|
||||||
{
|
{
|
||||||
const char *filename;
|
const char *filename;
|
||||||
unsigned __int16 knotCount;
|
unsigned __int16 knotCount;
|
||||||
vec2_t knots[16];
|
vec2_t knots[16];
|
||||||
};
|
};
|
||||||
#pragma pack(pop)
|
|
||||||
|
struct MssSound
|
||||||
|
{
|
||||||
|
char unknown1[8];
|
||||||
|
int size;
|
||||||
|
char unknown2[22];
|
||||||
|
char *data; // size = soundSize
|
||||||
|
};
|
||||||
|
|
||||||
|
struct LoadedSound
|
||||||
|
{
|
||||||
|
const char *name;
|
||||||
|
MssSound mssSound;
|
||||||
|
};
|
||||||
|
|
||||||
struct FontEntry
|
struct FontEntry
|
||||||
{
|
{
|
||||||
@ -2898,6 +2910,7 @@ namespace Game
|
|||||||
VehicleDef* vehicle;
|
VehicleDef* vehicle;
|
||||||
GfxWorld* gfxMap;
|
GfxWorld* gfxMap;
|
||||||
SndCurve* sndCurve;
|
SndCurve* sndCurve;
|
||||||
|
LoadedSound* sound;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct XAsset
|
struct XAsset
|
||||||
|
Loading…
Reference in New Issue
Block a user