[ITracer] Add tracer writing support
This commit is contained in:
parent
8d4fa4c7ac
commit
59ef8edbe2
@ -576,8 +576,9 @@ namespace Components
|
||||
AssetHandler::RegisterInterface(new Assets::ISndCurve());
|
||||
AssetHandler::RegisterInterface(new Assets::IMaterial());
|
||||
AssetHandler::RegisterInterface(new Assets::IMenuList());
|
||||
AssetHandler::RegisterInterface(new Assets::IclipMap_t());
|
||||
AssetHandler::RegisterInterface(new Assets::ImenuDef_t());
|
||||
AssetHandler::RegisterInterface(new Assets::IclipMap_t());
|
||||
AssetHandler::RegisterInterface(new Assets::ITracerDef());
|
||||
AssetHandler::RegisterInterface(new Assets::IPhysPreset());
|
||||
AssetHandler::RegisterInterface(new Assets::IXAnimParts());
|
||||
AssetHandler::RegisterInterface(new Assets::IFxEffectDef());
|
||||
|
@ -91,8 +91,9 @@ namespace Components
|
||||
#include "AssetInterfaces/IMaterial.hpp"
|
||||
#include "AssetInterfaces/ISndCurve.hpp"
|
||||
#include "AssetInterfaces/IMenuList.hpp"
|
||||
#include "AssetInterfaces/ImenuDef_t.hpp"
|
||||
#include "AssetInterfaces/IclipMap_t.hpp"
|
||||
#include "AssetInterfaces/ImenuDef_t.hpp"
|
||||
#include "AssetInterfaces/ITracerDef.hpp"
|
||||
#include "AssetInterfaces/IPhysPreset.hpp"
|
||||
#include "AssetInterfaces/IXAnimParts.hpp"
|
||||
#include "AssetInterfaces/IFxEffectDef.hpp"
|
||||
|
44
src/Components/Modules/AssetInterfaces/ITracerDef.cpp
Normal file
44
src/Components/Modules/AssetInterfaces/ITracerDef.cpp
Normal file
@ -0,0 +1,44 @@
|
||||
#include "STDInclude.hpp"
|
||||
|
||||
namespace Assets
|
||||
{
|
||||
void ITracerDef::load(Game::XAssetHeader* header, const std::string& name, Components::ZoneBuilder::Zone* builder)
|
||||
{
|
||||
return; // don't load from filesystem right now
|
||||
}
|
||||
|
||||
void ITracerDef::mark(Game::XAssetHeader header, Components::ZoneBuilder::Zone* builder)
|
||||
{
|
||||
Game::TracerDef* asset = header.tracerDef;
|
||||
|
||||
if (asset->material)
|
||||
{
|
||||
builder->loadAsset(Game::XAssetType::ASSET_TYPE_MATERIAL, asset->material);
|
||||
}
|
||||
}
|
||||
|
||||
void ITracerDef::save(Game::XAssetHeader header, Components::ZoneBuilder::Zone* builder)
|
||||
{
|
||||
AssertSize(Game::TracerDef, 0x70);
|
||||
|
||||
Utils::Stream* buffer = builder->getBuffer();
|
||||
Game::TracerDef* asset = header.tracerDef;
|
||||
Game::TracerDef* dest = buffer->dest<Game::TracerDef>();
|
||||
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);
|
||||
}
|
||||
|
||||
if (asset->material)
|
||||
{
|
||||
dest->material = builder->saveSubAsset(Game::XAssetType::ASSET_TYPE_MATERIAL, asset->material).material;
|
||||
}
|
||||
|
||||
buffer->popBlock();
|
||||
}
|
||||
}
|
14
src/Components/Modules/AssetInterfaces/ITracerDef.hpp
Normal file
14
src/Components/Modules/AssetInterfaces/ITracerDef.hpp
Normal file
@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
namespace Assets
|
||||
{
|
||||
class ITracerDef : public Components::AssetHandler::IAsset
|
||||
{
|
||||
public:
|
||||
virtual Game::XAssetType getType() override { return Game::XAssetType::ASSET_TYPE_TRACER; };
|
||||
|
||||
virtual void save(Game::XAssetHeader header, Components::ZoneBuilder::Zone* builder) override;
|
||||
virtual void mark(Game::XAssetHeader header, Components::ZoneBuilder::Zone* builder) override;
|
||||
virtual void load(Game::XAssetHeader* header, const std::string& name, Components::ZoneBuilder::Zone* builder) override;
|
||||
};
|
||||
}
|
@ -1,7 +1,5 @@
|
||||
#include "STDInclude.hpp"
|
||||
|
||||
#define IW4X_MODEL_VERSION 5
|
||||
|
||||
namespace Assets
|
||||
{
|
||||
void IWeapon::load(Game::XAssetHeader* header, const std::string& name, Components::ZoneBuilder::Zone* builder)
|
||||
@ -12,12 +10,8 @@ namespace Assets
|
||||
// let the function see temporary assets when calling DB_FindXAssetHeader during the loading function
|
||||
// otherwise it fails to link things properly
|
||||
Components::AssetHandler::ExposeTemporaryAssets(true);
|
||||
IWeapon::CurrentBuilder = builder;
|
||||
|
||||
header->data = Game::BG_LoadWeaponDef_LoadObj(name.data());
|
||||
|
||||
Components::AssetHandler::ExposeTemporaryAssets(false);
|
||||
IWeapon::CurrentBuilder = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@ -116,8 +110,7 @@ namespace Assets
|
||||
|
||||
if (asset->weapDef->tracerType)
|
||||
{
|
||||
//builder->loadAsset(Game::XAssetType::ASSET_TYPE_TRACER, asset->weapDef->tracerType);
|
||||
asset->weapDef->tracerType = NULL;
|
||||
builder->loadAsset(Game::XAssetType::ASSET_TYPE_TRACER, asset->weapDef->tracerType);
|
||||
}
|
||||
|
||||
// don't write effects for now
|
||||
@ -271,6 +264,7 @@ namespace Assets
|
||||
Game::snd_alias_list_t ** allSoundsDest = &dest->pickupSound;
|
||||
for (int i = 0; i < 47; i++) {
|
||||
if (!allSounds[i]) continue;
|
||||
buffer->align(Utils::Stream::ALIGN_4);
|
||||
buffer->saveMax(sizeof(Game::snd_alias_list_t*));
|
||||
buffer->saveString(allSounds[i]->aliasName);
|
||||
Utils::Stream::ClearPointer(&allSoundsDest[i]);
|
||||
@ -314,6 +308,7 @@ namespace Assets
|
||||
|
||||
if (def->worldModel)
|
||||
{
|
||||
buffer->align(Utils::Stream::ALIGN_4);
|
||||
Game::XModel** pointerTable = buffer->dest<Game::XModel*>();
|
||||
buffer->saveMax(16 * sizeof(Game::XModel*));
|
||||
for (int i = 0; i < 16; i++)
|
||||
|
@ -1110,7 +1110,7 @@ namespace Components
|
||||
Command::Add("verifyzone", [](Command::Params* params)
|
||||
{
|
||||
if (params->length() < 2) return;
|
||||
|
||||
/*
|
||||
Utils::Hook(0x4AE9C2, [] {
|
||||
Game::WeaponCompleteDef** varPtr = (Game::WeaponCompleteDef**)0x112A9F4;
|
||||
Game::WeaponCompleteDef* var = *varPtr;
|
||||
@ -1125,7 +1125,7 @@ namespace Components
|
||||
OutputDebugStringA("");
|
||||
Utils::Hook::Call<void()>(0x4D1D60)(); // DB_PopStreamPos
|
||||
}, HOOK_JUMP).install()->quick();
|
||||
|
||||
*/
|
||||
|
||||
std::string zone = params->get(1);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user