Big fixes and big memory leak refactor (linux only for now)

This commit is contained in:
Jack Andersen 2018-05-19 20:14:57 -10:00
parent 5f03362149
commit f60af632b3
84 changed files with 849 additions and 689 deletions

View File

@ -28,7 +28,7 @@ void InitializeBadging(specter::ViewResources& viewRes)
if (uncompress(texels.get(), &destSz, URDE_BADGE + pos, URDE_BADGE_SZ - pos) != Z_OK)
Log.report(logvisor::Fatal, "unable to decompress badge");
viewRes.m_factory->commitTransaction([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
viewRes.m_factory->BooCommitTransaction([&](boo::IGraphicsDataFactory::Context& ctx)
{
specter::IconAtlas<1, 1> atlas;

View File

@ -28,7 +28,7 @@ void InitializeIcons(specter::ViewResources& viewRes)
if (uncompress(texels.get(), &destSz, URDE_ICONS + pos, URDE_ICONS_SZ - pos) != Z_OK)
Log.report(logvisor::Fatal, "unable to decompress icons");
viewRes.m_factory->commitTransaction([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
viewRes.m_factory->BooCommitTransaction([&](boo::IGraphicsDataFactory::Context& ctx)
{
g_IconAtlas.initializeAtlas(ctx.newStaticTexture(width, height, mips,
boo::TextureFormat::RGBA8,

View File

@ -252,7 +252,7 @@ void CNESEmulator::InitializeEmulator()
//mainLoopRuns *= ppuLinesTotal;
mainLoopPos = mainLoopRuns;
CGraphics::CommitResources([this](boo::IGraphicsDataFactory::Context& ctx)
CGraphicsCommitResources([this](boo::IGraphicsDataFactory::Context& ctx)
{
// Nearest-neighbor FTW!
m_texture = ctx.newDynamicTexture(VISIBLE_DOTS, linesToDraw,

View File

@ -295,8 +295,8 @@ void CNESShader::Initialize()
if (!CGraphics::g_BooFactory)
return;
CGraphics::CommitResources(
[&](boo::IGraphicsDataFactory::Context& ctx) -> bool
CGraphicsCommitResources(
[&](boo::IGraphicsDataFactory::Context& ctx)
{
switch (ctx.platform())
{

View File

@ -1607,7 +1607,8 @@ void CAutoMapper::Draw(const CStateManager& mgr, const zeus::CTransform& xf, flo
alpha *= mapAlpha;
zeus::CColor modColor = g_tweakAutoMapper->GetMiniMapSamusModColor();
modColor.a *= alpha;
CModelFlags flags(5, 0, 3 | 8 | 1, modColor);
CModelFlags flags(5, 0, 8 | 1, modColor); /* Depth GEqual */
flags.m_extendedShader = EExtendedShader::DepthGEqualNoZWrite;
x30_miniMapSamus->Draw(flags);
}
if (IsInMapperState(EAutoMapperState::MapScreen))

View File

@ -54,7 +54,7 @@ void CMapArea::PostConstruct()
m_surfaces.back().PostConstruct(x44_buf.get(), index);
}
CGraphics::CommitResources([this, &index](boo::IGraphicsDataFactory::Context& ctx)
CGraphicsCommitResources([this, &index](boo::IGraphicsDataFactory::Context& ctx)
{
m_vbo = ctx.newStaticBuffer(boo::BufferUse::Vertex, m_verts.data(), 16, m_verts.size());
m_ibo = ctx.newStaticBuffer(boo::BufferUse::Index, index.data(), 4, index.size());
@ -84,7 +84,8 @@ void CMapArea::PostConstruct()
u32 count = r.readUint32Big();
r.seek(count);
r.seekAlign4();
linePrims.emplace_back(ctx, CLineRenderer::EPrimitiveMode::LineStrip, count, nullptr, false);
linePrims.emplace_back(ctx, CLineRenderer::EPrimitiveMode::LineStrip, count,
nullptr, false, false, true);
}
}
}

View File

@ -294,7 +294,7 @@ void CMappableObject::ReadAutoMapperTweaks(const ITweakAutoMapper& tweaks)
doorVerts[6].assign(.2f * -center.z, center.y, 0.f);
doorVerts[7].assign(.2f * -center.z, center.y, 2.f * center.x);
CGraphics::CommitResources([](boo::IGraphicsDataFactory::Context& ctx)
CGraphicsCommitResources([](boo::IGraphicsDataFactory::Context& ctx)
{
g_doorVbo = ctx.newStaticBuffer(boo::BufferUse::Vertex, skDoorVerts, 16, 8);
g_doorIbo = ctx.newStaticBuffer(boo::BufferUse::Index, DoorIndices, 4, 24);

View File

@ -74,7 +74,7 @@ private:
CLineRenderer m_outline;
DoorSurface(boo::IGraphicsDataFactory::Context& ctx)
: m_surface(ctx, g_doorVbo, g_doorIbo),
m_outline(ctx, CLineRenderer::EPrimitiveMode::LineLoop, 5, nullptr, false)
m_outline(ctx, CLineRenderer::EPrimitiveMode::LineLoop, 5, nullptr, false, false, true)
{}
};
std::experimental::optional<DoorSurface> m_doorSurface;

View File

@ -9,6 +9,11 @@ CSimplePool::CSimplePool(IFactory& factory)
: x18_factory(factory), x1c_paramXfer(new TObjOwnerParam<IObjectStore*>(this))
{}
CSimplePool::~CSimplePool()
{
assert(x8_resources.empty() && "Dangling CSimplePool resources detected");
}
CToken CSimplePool::GetObj(const SObjectTag& tag, const CVParamTransfer& paramXfer)
{
if (!tag)

View File

@ -21,6 +21,7 @@ protected:
CVParamTransfer x1c_paramXfer;
public:
CSimplePool(IFactory& factory);
~CSimplePool();
CToken GetObj(const SObjectTag&, const CVParamTransfer&);
CToken GetObj(const SObjectTag&);
CToken GetObj(std::string_view);

View File

@ -217,6 +217,25 @@ CStateManager::CStateManager(const std::weak_ptr<CRelayTracker>& relayTracker,
CStateManager::~CStateManager()
{
x88c_rumbleManager->HardStopAll();
x880_envFxManager->Cleanup();
x900_activeRandom = &x8fc_random;
ClearGraveyard();
for (auto it = x808_objLists[0]->begin() ; it != x808_objLists[0]->end() ;)
{
CEntity* ent = *it;
++it;
if (ent == x84c_player.get())
continue;
ent->AcceptScriptMsg(EScriptObjectMessage::Deleted, kInvalidUniqueId, *this);
RemoveObject(ent->GetUniqueId());
std::default_delete<CEntity>()(ent);
}
ClearGraveyard();
x84c_player->AcceptScriptMsg(EScriptObjectMessage::Deleted, kInvalidUniqueId, *this);
RemoveObject(x84c_player->GetUniqueId());
x84c_player.reset();
CCollisionPrimitive::Uninitialize();
g_StateManager = nullptr;
}
@ -2207,7 +2226,6 @@ void CStateManager::ClearGraveyard()
{
CEntity* ent = GetAllObjectList().GetValidObjectById(id);
RemoveObject(id);
if (ent)
std::default_delete<CEntity>()(ent);
}
x854_objectGraveyard.clear();

View File

@ -53,12 +53,9 @@ class CObjectReference
/** Synchronous object-fetch, guaranteed to return complete object on-demand, blocking build if not ready */
IObj* GetObject();
const SObjectTag& GetObjectTag() const
{
return x4_objTag;
}
public:
const SObjectTag& GetObjectTag() const { return x4_objTag; }
~CObjectReference();
};

View File

@ -712,7 +712,7 @@ CBooRenderer::CBooRenderer(IObjectStore& store, IFactory& resFac)
m_staticEntropy = store.GetObj("RandomStaticEntropy");
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
CGraphicsCommitResources([&](boo::IGraphicsDataFactory::Context& ctx)
{
GenerateFogVolumeRampTex(ctx);
GenerateSphereRampTex(ctx);

View File

@ -334,10 +334,17 @@ public:
return g_BooPlatformName;
}
static void CommitResources(const boo::FactoryCommitFunc& commitFunc)
static void CommitResources(const boo::FactoryCommitFunc& commitFunc __BooTraceArgs)
{
g_BooFactory->commitTransaction(commitFunc);
g_BooFactory->commitTransaction(commitFunc __BooTraceArgsUse);
}
#ifndef NDEBUG
#define CGraphicsCommitResources(...) CGraphics::CommitResources(__VA_ARGS__, __FILE__, __LINE__)
#else
#define CGraphicsCommitResources(...) CGraphics::CommitResources(__VA_ARGS__)
#endif
static void SetShaderDataBinding(const boo::ObjToken<boo::IShaderDataBinding>& binding)
{
g_BooMainCommandQueue->setShaderDataBinding(binding);

View File

@ -25,7 +25,7 @@ hecl::UniformBufferPool<CLineRenderer::SDrawUniform> CLineRenderer::s_uniformPoo
CLineRenderer::CLineRenderer(boo::IGraphicsDataFactory::Context& ctx,
EPrimitiveMode mode, u32 maxVerts,
const boo::ObjToken<boo::ITexture>& texture,
bool additive, bool zTest)
bool additive, bool zTest, bool zGEqual)
: m_mode(mode), m_maxVerts(maxVerts)
{
if (maxVerts < 2)
@ -56,12 +56,12 @@ CLineRenderer::CLineRenderer(boo::IGraphicsDataFactory::Context& ctx,
m_uniformBuf = s_uniformPool.allocateBlock(CGraphics::g_BooFactory);
CLineRendererShaders::BuildShaderDataBinding(ctx, *this, texture, additive, zTest);
CLineRendererShaders::BuildShaderDataBinding(ctx, *this, texture, additive, zTest, zGEqual);
}
CLineRenderer::CLineRenderer(EPrimitiveMode mode, u32 maxVerts,
const boo::ObjToken<boo::ITexture>& texture,
bool additive, bool zTest)
bool additive, bool zTest, bool zGEqual)
: m_mode(mode), m_maxVerts(maxVerts)
{
if (maxVerts < 2)
@ -92,9 +92,9 @@ CLineRenderer::CLineRenderer(EPrimitiveMode mode, u32 maxVerts,
m_uniformBuf = s_uniformPool.allocateBlock(CGraphics::g_BooFactory);
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx)
CGraphicsCommitResources([&](boo::IGraphicsDataFactory::Context& ctx)
{
CLineRendererShaders::BuildShaderDataBinding(ctx, *this, texture, additive, zTest);
CLineRendererShaders::BuildShaderDataBinding(ctx, *this, texture, additive, zTest, zGEqual);
return true;
});
}

View File

@ -74,9 +74,9 @@ public:
CLineRenderer(boo::IGraphicsDataFactory::Context& ctx,
EPrimitiveMode mode, u32 maxVerts, const boo::ObjToken<boo::ITexture>& texture,
bool additive, bool zTest = false);
bool additive, bool zTest = false, bool zGEqual = false);
CLineRenderer(EPrimitiveMode mode, u32 maxVerts, const boo::ObjToken<boo::ITexture>& texture,
bool additive, bool zTest = false);
bool additive, bool zTest = false, bool zGEqual = false);
CLineRenderer(CLineRenderer&&) = default;
void Reset();

View File

@ -271,6 +271,8 @@ public:
static void SetDummyTextures(bool b) { g_DummyTextures = b; }
static void SetRenderModelBlack(bool b) { g_RenderModelBlack = b; }
static void AssertAllFreed();
};
class CModel
@ -285,8 +287,8 @@ class CModel
std::vector<CBooSurface> x8_surfaces;
std::vector<SShader> x18_matSets;
std::unique_ptr<CBooModel> x28_modelInst;
CModel* x30_next = nullptr;
CModel* x34_prev = nullptr;
//CModel* x30_next = nullptr;
//CModel* x34_prev = nullptr;
int x38_lastFrame;
/* urde addition: boo! */

View File

@ -19,6 +19,11 @@ bool CBooModel::g_DrawingOccluders = false;
static CBooModel* g_FirstModel = nullptr;
void CBooModel::AssertAllFreed()
{
assert(g_FirstModel == nullptr && "Dangling CBooModels detected");
}
void CBooModel::ClearModelUniformCounters()
{
for (CBooModel* model = g_FirstModel ; model ; model = model->m_next)
@ -281,7 +286,7 @@ CBooModel::ModelInstance* CBooModel::PushNewModelInstance(int sharedLayoutBuf)
m_instances.emplace_back();
ModelInstance& newInst = m_instances.back();
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx)
CGraphicsCommitResources([&](boo::IGraphicsDataFactory::Context& ctx)
{
/* Build geometry uniform buffer if shared not available */
boo::ObjToken<boo::IGraphicsBufferD> geomUniformBuf;
@ -1275,7 +1280,7 @@ CModel::CModel(std::unique_ptr<u8[]>&& in, u32 /* dataLen */, IObjectStore* stor
matSet.BuildShaders(m_hmdlMeta);
}
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
CGraphicsCommitResources([&](boo::IGraphicsDataFactory::Context& ctx)
{
/* Index buffer is always static */
if (m_hmdlMeta.indexCount)

View File

@ -198,7 +198,7 @@ static const char* TexNames[] = {"texY", "texU", "texV"};
void CMoviePlayer::Initialize()
{
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
CGraphicsCommitResources([&](boo::IGraphicsDataFactory::Context& ctx)
{
if (!ctx.bindingNeedsVertexFormat())
{
@ -426,7 +426,7 @@ CMoviePlayer::CMoviePlayer(const char* path, float preLoadSeconds, bool loop, bo
xa0_bufferQueue.reserve(xf0_preLoadFrames);
/* All set for GPU resources */
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
CGraphicsCommitResources([&](boo::IGraphicsDataFactory::Context& ctx)
{
m_blockBuf = ctx.newDynamicBuffer(boo::BufferUse::Uniform, sizeof(m_viewVertBlock), 1);
m_vertBuf = ctx.newDynamicBuffer(boo::BufferUse::Vertex, sizeof(specter::View::TexShaderVert), 4);

View File

@ -14,7 +14,7 @@ CRainSplashGenerator::CRainSplashGenerator(const zeus::CVector3f& scale, u32 max
x48_24 = false;
x48_25_raining = true;
x0_rainSplashes.reserve(maxSplashes);
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx)
CGraphicsCommitResources([&](boo::IGraphicsDataFactory::Context& ctx)
{
for (int i=0 ; i<maxSplashes ; ++i)
x0_rainSplashes.emplace_back(ctx);

View File

@ -112,7 +112,7 @@ void CTexture::BuildI4FromGCN(CInputStream& in)
h /= 2;
}
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
CGraphicsCommitResources([&](boo::IGraphicsDataFactory::Context& ctx)
{
m_booTex = ctx.newStaticTexture(x4_w, x6_h, x8_mips, boo::TextureFormat::RGBA8,
boo::TextureClampMode::Repeat, buf.get(), texelCount * 4).get();
@ -160,7 +160,7 @@ void CTexture::BuildI8FromGCN(CInputStream& in)
h /= 2;
}
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
CGraphicsCommitResources([&](boo::IGraphicsDataFactory::Context& ctx)
{
m_booTex = ctx.newStaticTexture(x4_w, x6_h, x8_mips, boo::TextureFormat::RGBA8,
boo::TextureClampMode::Repeat, buf.get(), texelCount * 4).get();
@ -209,7 +209,7 @@ void CTexture::BuildIA4FromGCN(CInputStream& in)
h /= 2;
}
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
CGraphicsCommitResources([&](boo::IGraphicsDataFactory::Context& ctx)
{
m_booTex = ctx.newStaticTexture(x4_w, x6_h, x8_mips, boo::TextureFormat::RGBA8,
boo::TextureClampMode::Repeat, buf.get(), texelCount * 4).get();
@ -258,7 +258,7 @@ void CTexture::BuildIA8FromGCN(CInputStream& in)
h /= 2;
}
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
CGraphicsCommitResources([&](boo::IGraphicsDataFactory::Context& ctx)
{
m_booTex = ctx.newStaticTexture(x4_w, x6_h, x8_mips, boo::TextureFormat::RGBA8,
boo::TextureClampMode::Repeat, buf.get(), texelCount * 4).get();
@ -366,7 +366,7 @@ void CTexture::BuildC4FromGCN(CInputStream& in)
h /= 2;
}
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
CGraphicsCommitResources([&](boo::IGraphicsDataFactory::Context& ctx)
{
m_booTex = ctx.newStaticTexture(x4_w, x6_h, x8_mips, boo::TextureFormat::RGBA8,
boo::TextureClampMode::Repeat, buf.get(), texelCount * 4).get();
@ -410,7 +410,7 @@ void CTexture::BuildC8FromGCN(CInputStream& in)
h /= 2;
}
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
CGraphicsCommitResources([&](boo::IGraphicsDataFactory::Context& ctx)
{
m_booTex = ctx.newStaticTexture(x4_w, x6_h, x8_mips, boo::TextureFormat::RGBA8,
boo::TextureClampMode::Repeat, buf.get(), texelCount * 4).get();
@ -462,7 +462,7 @@ void CTexture::BuildRGB565FromGCN(CInputStream& in)
h /= 2;
}
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
CGraphicsCommitResources([&](boo::IGraphicsDataFactory::Context& ctx)
{
m_booTex = ctx.newStaticTexture(x4_w, x6_h, x8_mips, boo::TextureFormat::RGBA8,
boo::TextureClampMode::Repeat, buf.get(), texelCount * 4).get();
@ -519,7 +519,7 @@ void CTexture::BuildRGB5A3FromGCN(CInputStream& in)
h /= 2;
}
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
CGraphicsCommitResources([&](boo::IGraphicsDataFactory::Context& ctx)
{
m_booTex = ctx.newStaticTexture(x4_w, x6_h, x8_mips, boo::TextureFormat::RGBA8,
boo::TextureClampMode::Repeat, buf.get(), texelCount * 4).get();
@ -576,7 +576,7 @@ void CTexture::BuildRGBA8FromGCN(CInputStream& in)
h /= 2;
}
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
CGraphicsCommitResources([&](boo::IGraphicsDataFactory::Context& ctx)
{
m_booTex = ctx.newStaticTexture(x4_w, x6_h, x8_mips, boo::TextureFormat::RGBA8,
boo::TextureClampMode::Repeat, buf.get(), texelCount * 4).get();
@ -640,7 +640,7 @@ void CTexture::BuildDXT1FromGCN(CInputStream& in)
h /= 2;
}
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
CGraphicsCommitResources([&](boo::IGraphicsDataFactory::Context& ctx)
{
m_booTex = ctx.newStaticTexture(x4_w, x6_h, x8_mips, boo::TextureFormat::DXT1,
boo::TextureClampMode::Repeat, buf.get(), blockCount * 8).get();
@ -656,7 +656,7 @@ void CTexture::BuildRGBA8(const void* data, size_t length)
Log.report(logvisor::Fatal, "insufficient TXTR length (%" PRISize "/%" PRISize ")",
length, expectedSize);
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
CGraphicsCommitResources([&](boo::IGraphicsDataFactory::Context& ctx)
{
m_booTex = ctx.newStaticTexture(x4_w, x6_h, x8_mips, boo::TextureFormat::RGBA8,
boo::TextureClampMode::Repeat, data, expectedSize).get();
@ -671,7 +671,7 @@ void CTexture::BuildC8(const void* data, size_t length)
Log.report(logvisor::Fatal, "insufficient TXTR length (%" PRISize "/%" PRISize ")",
length, texelCount);
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
CGraphicsCommitResources([&](boo::IGraphicsDataFactory::Context& ctx)
{
uint32_t nentries = hecl::SBig(*reinterpret_cast<const uint32_t*>(data));
const u8* paletteTexels = reinterpret_cast<const u8*>(data) + 4;
@ -778,7 +778,7 @@ void CTexture::BuildC8Font(const void* data, EFontType ftype)
h /= 2;
}
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
CGraphicsCommitResources([&](boo::IGraphicsDataFactory::Context& ctx)
{
m_booTex = ctx.newStaticArrayTexture(x4_w, x6_h, layerCount, x8_mips, boo::TextureFormat::RGBA8,
boo::TextureClampMode::Repeat, buf.get(), texelCount * layerCount * 4).get();
@ -788,7 +788,7 @@ void CTexture::BuildC8Font(const void* data, EFontType ftype)
void CTexture::BuildDXT1(const void* data, size_t length)
{
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
CGraphicsCommitResources([&](boo::IGraphicsDataFactory::Context& ctx)
{
m_booTex = ctx.newStaticTexture(x4_w, x6_h, x8_mips, boo::TextureFormat::DXT1,
boo::TextureClampMode::Repeat, data, length).get();

View File

@ -6,7 +6,7 @@ namespace urde
CAABoxShader::CAABoxShader(bool zOnly)
: m_zOnly(zOnly)
{
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx)
CGraphicsCommitResources([&](boo::IGraphicsDataFactory::Context& ctx)
{
m_vbo = ctx.newDynamicBuffer(boo::BufferUse::Vertex, sizeof(zeus::CVector3f), 34);
m_uniBuf = ctx.newDynamicBuffer(boo::BufferUse::Uniform, sizeof(Uniform), 1);

View File

@ -5,7 +5,7 @@ namespace urde
CCameraBlurFilter::CCameraBlurFilter()
{
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
CGraphicsCommitResources([&](boo::IGraphicsDataFactory::Context& ctx)
{
m_vbo = ctx.newDynamicBuffer(boo::BufferUse::Vertex, 32, 4);
m_uniBuf = ctx.newDynamicBuffer(boo::BufferUse::Uniform, sizeof(Uniform), 1);

View File

@ -5,7 +5,7 @@ namespace urde
CColoredQuadFilter::CColoredQuadFilter(EFilterType type)
{
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
CGraphicsCommitResources([&](boo::IGraphicsDataFactory::Context& ctx)
{
struct Vert
{

View File

@ -21,7 +21,7 @@ void CEnergyBarShader::draw(const zeus::CColor& color0, const std::vector<Vertex
{
m_maxVerts = totalVerts;
m_tex = tex;
CGraphics::CommitResources([this](boo::IGraphicsDataFactory::Context& ctx)
CGraphicsCommitResources([this](boo::IGraphicsDataFactory::Context& ctx)
{
m_vbo = ctx.newDynamicBuffer(boo::BufferUse::Vertex, sizeof(Vertex), m_maxVerts);
for (int i=0 ; i<3 ; ++i)

View File

@ -99,7 +99,7 @@ boo::ObjToken<boo::IShaderPipeline> CFluidPlaneShader::Cache::GetOrBuildShader(c
if (CGraphics::g_BooFactory == nullptr)
return nullptr;
CGraphics::CommitResources(
CGraphicsCommitResources(
[&](boo::IGraphicsDataFactory::Context& ctx)
{
switch (ctx.platform())
@ -148,7 +148,7 @@ void CFluidPlaneShader::Cache::Clear()
void CFluidPlaneShader::PrepareBinding(const boo::ObjToken<boo::IShaderPipeline>& pipeline, u32 maxVertCount, bool door)
{
CGraphics::CommitResources(
CGraphicsCommitResources(
[&](boo::IGraphicsDataFactory::Context& ctx)
{
m_vbo = ctx.newDynamicBuffer(boo::BufferUse::Vertex, sizeof(Vertex), maxVertCount);

View File

@ -5,7 +5,7 @@ namespace urde
CFogVolumeFilter::CFogVolumeFilter()
{
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
CGraphicsCommitResources([&](boo::IGraphicsDataFactory::Context& ctx)
{
struct Vert
{

View File

@ -6,7 +6,7 @@ namespace urde
void CFogVolumePlaneShader::CommitResources(size_t capacity)
{
m_vertCapacity = capacity;
CGraphics::CommitResources([this, capacity](boo::IGraphicsDataFactory::Context& ctx)
CGraphicsCommitResources([this, capacity](boo::IGraphicsDataFactory::Context& ctx)
{
m_vbo = ctx.newDynamicBuffer(boo::BufferUse::Vertex, sizeof(zeus::CVector4f), capacity);
TShader<CFogVolumePlaneShader>::BuildShaderDataBinding(ctx, *this);

View File

@ -15,6 +15,8 @@ boo::ObjToken<boo::IShaderPipeline> CLineRendererShaders::m_texAdditiveZ;
boo::ObjToken<boo::IShaderPipeline> CLineRendererShaders::m_noTexAlphaZ;
boo::ObjToken<boo::IShaderPipeline> CLineRendererShaders::m_noTexAdditiveZ;
boo::ObjToken<boo::IShaderPipeline> CLineRendererShaders::m_noTexAlphaZGEqual;
boo::ObjToken<boo::IVertexFormat> CLineRendererShaders::m_texVtxFmt;
boo::ObjToken<boo::IVertexFormat> CLineRendererShaders::m_noTexVtxFmt;
@ -25,8 +27,8 @@ void CLineRendererShaders::Initialize()
if (!CGraphics::g_BooFactory)
return;
CGraphics::CommitResources(
[&](boo::IGraphicsDataFactory::Context& ctx) -> bool
CGraphicsCommitResources(
[&](boo::IGraphicsDataFactory::Context& ctx)
{
switch (ctx.platform())
{
@ -67,6 +69,7 @@ void CLineRendererShaders::Shutdown()
m_texAdditiveZ.reset();
m_noTexAlphaZ.reset();
m_noTexAdditiveZ.reset();
m_noTexAlphaZGEqual.reset();
m_texVtxFmt.reset();
m_noTexVtxFmt.reset();
}
@ -74,10 +77,15 @@ void CLineRendererShaders::Shutdown()
void CLineRendererShaders::BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
CLineRenderer& renderer,
const boo::ObjToken<boo::ITexture>& texture,
bool additive, bool zTest)
bool additive, bool zTest, bool zGEqual)
{
boo::ObjToken<boo::IShaderPipeline> pipeline;
if (zTest)
if (zGEqual)
{
pipeline = m_noTexAlphaZGEqual;
}
else if (zTest)
{
if (texture)
{

View File

@ -36,6 +36,8 @@ private:
static boo::ObjToken<boo::IShaderPipeline> m_noTexAlphaZ;
static boo::ObjToken<boo::IShaderPipeline> m_noTexAdditiveZ;
static boo::ObjToken<boo::IShaderPipeline> m_noTexAlphaZGEqual;
static boo::ObjToken<boo::IVertexFormat> m_texVtxFmt;
static boo::ObjToken<boo::IVertexFormat> m_noTexVtxFmt;
@ -58,7 +60,8 @@ public:
static void Initialize();
static void Shutdown();
static void BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx, CLineRenderer& renderer,
const boo::ObjToken<boo::ITexture>& texture, bool additive, bool zTest);
const boo::ObjToken<boo::ITexture>& texture, bool additive, bool zTest,
bool zGEqual);
};
}

View File

@ -177,6 +177,11 @@ CLineRendererShaders::IDataBindingFactory* CLineRendererShaders::Initialize(boo:
boo::Primitive::TriStrips, boo::ZTest::LEqual,
false, true, false, boo::CullMode::None);
m_noTexAlphaZGEqual = ctx.newShaderPipeline(VS_GLSL_NOTEX, FS_GLSL_NOTEX, 0, nullptr, 1, UniNames,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, boo::ZTest::GEqual,
false, true, false, boo::CullMode::None);
return new struct OGLLineDataBindingFactory;
}
@ -269,6 +274,11 @@ CLineRendererShaders::IDataBindingFactory* CLineRendererShaders::Initialize(boo:
boo::Primitive::TriStrips, boo::ZTest::LEqual,
false, true, false, boo::CullMode::None);
m_noTexAlphaZGEqual = ctx.newShaderPipeline(VS_GLSL_NOTEX, FS_GLSL_NOTEX, m_noTexVtxFmt,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, boo::ZTest::GEqual,
false, true, false, boo::CullMode::None);
return new struct VulkanLineDataBindingFactory;
}
#endif

View File

@ -182,6 +182,12 @@ CLineRendererShaders::IDataBindingFactory* CLineRendererShaders::Initialize(boo:
boo::Primitive::TriStrips, boo::ZTest::LEqual,
false, true, false, boo::CullMode::None);
m_noTexAlphaZGEqual = ctx.newShaderPipeline(VS_HLSL_NOTEX, FS_HLSL_NOTEX, nullptr, nullptr,
nullptr, m_noTexVtxFmt,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, boo::ZTest::GEqual,
false, true, false, boo::CullMode::None);
return new struct HLSLLineDataBindingFactory;
}

View File

@ -190,6 +190,11 @@ CLineRendererShaders::IDataBindingFactory* CLineRendererShaders::Initialize(boo:
boo::Primitive::TriStrips, boo::ZTest::LEqual,
false, true, false, boo::CullMode::None);
m_noTexAlphaZGEqual = ctx.newShaderPipeline(VS_METAL_NOTEX, FS_METAL_NOTEX, nullptr, nullptr, m_noTexVtxFmt,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, boo::ZTest::GEqual,
false, true, false, boo::CullMode::None);
return new struct MetalLineDataBindingFactory;
}

View File

@ -91,7 +91,7 @@ CMapSurfaceShader::Initialize(boo::GLDataFactory::Context& ctx)
const char* uniNames[] = {"MapSurfaceUniform"};
s_Pipeline = ctx.newShaderPipeline(VS, FS, 0, nullptr, 1, uniNames,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, boo::ZTest::None, false, true,
boo::Primitive::TriStrips, boo::ZTest::GEqual, false, true,
false, boo::CullMode::Backface);
return new CMapSurfaceShaderGLDataBindingFactory;
}
@ -113,7 +113,7 @@ CMapSurfaceShader::Initialize(boo::VulkanDataFactory::Context& ctx)
s_VtxFmt = ctx.newVertexFormat(1, VtxVmt);
s_Pipeline = ctx.newShaderPipeline(VS, FS, s_VtxFmt, boo::BlendFactor::SrcAlpha,
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips,
boo::ZTest::None, false, true, false, boo::CullMode::Backface);
boo::ZTest::GEqual, false, true, false, boo::CullMode::Backface);
return new CMapSurfaceShaderVulkanDataBindingFactory;
}

View File

@ -32,7 +32,8 @@ enum EExtendedShader : uint8_t
ForcedAlphaNoZWrite,
ForcedAdditiveNoZWrite,
ForcedAlphaNoCullNoZWrite,
ForcedAdditiveNoCullNoZWrite
ForcedAdditiveNoCullNoZWrite,
DepthGEqualNoZWrite
};
class CModelShaders

View File

@ -295,6 +295,12 @@ CModelShaders::GetShaderExtensionsGLSL(boo::IGraphicsDataFactory::Platform plat)
hecl::Backend::BlendFactor::One, hecl::Backend::ZTest::Original,
hecl::Backend::CullMode::None, true, false, true);
/* Depth GEqual no Z-write */
ext.registerExtensionSlot({LightingGLSL, "LightingFunc"}, {MainPostGLSL, "MainPostFunc"},
3, BlockNames, 0, nullptr, hecl::Backend::BlendFactor::Original,
hecl::Backend::BlendFactor::Original, hecl::Backend::ZTest::GEqual,
hecl::Backend::CullMode::Backface, true, false, true);
return ext;
}

View File

@ -275,6 +275,12 @@ CModelShaders::GetShaderExtensionsHLSL(boo::IGraphicsDataFactory::Platform plat)
hecl::Backend::BlendFactor::One, hecl::Backend::ZTest::Original,
hecl::Backend::CullMode::None, true, false, true);
/* Depth GEqual no Z-write */
ext.registerExtensionSlot({LightingHLSL, "LightingFunc"}, {MainPostHLSL, "MainPostFunc"},
0, nullptr, 0, nullptr, hecl::Backend::BlendFactor::Original,
hecl::Backend::BlendFactor::Original, hecl::Backend::ZTest::GEqual,
hecl::Backend::CullMode::Backface, true, false, true);
return ext;
}

View File

@ -285,6 +285,12 @@ CModelShaders::GetShaderExtensionsMetal(boo::IGraphicsDataFactory::Platform plat
hecl::Backend::BlendFactor::One, hecl::Backend::ZTest::Original,
hecl::Backend::CullMode::None, true, false, true);
/* Depth GEqual no Z-write */
ext.registerExtensionSlot({LightingMetal, "LightingFunc"}, {MainPostMetal, "MainPostFunc"},
1, BlockNames, 0, nullptr, hecl::Backend::BlendFactor::Original,
hecl::Backend::BlendFactor::Original, hecl::Backend::ZTest::GEqual,
hecl::Backend::CullMode::Backface, true, false, true);
return ext;
}

View File

@ -10,7 +10,7 @@ void CPhazonSuitFilter::drawBlurPasses(float radius, const CTexture* indTex)
if (!m_dataBind || indTex != m_indTex)
{
m_indTex = indTex;
CGraphics::CommitResources([this](boo::IGraphicsDataFactory::Context& ctx)
CGraphicsCommitResources([this](boo::IGraphicsDataFactory::Context& ctx)
{
m_uniBufBlurX = ctx.newDynamicBuffer(boo::BufferUse::Uniform, sizeof(zeus::CVector4f), 1);
m_uniBufBlurY = ctx.newDynamicBuffer(boo::BufferUse::Uniform, sizeof(zeus::CVector4f), 1);

View File

@ -12,7 +12,7 @@ void CRadarPaintShader::draw(const std::vector<Instance>& instances, const CText
{
m_maxInsts = instances.size();
m_tex = tex;
CGraphics::CommitResources([this](boo::IGraphicsDataFactory::Context& ctx)
CGraphicsCommitResources([this](boo::IGraphicsDataFactory::Context& ctx)
{
m_vbo = ctx.newDynamicBuffer(boo::BufferUse::Vertex, sizeof(Instance), m_maxInsts);
m_uniBuf = ctx.newDynamicBuffer(boo::BufferUse::Uniform, sizeof(zeus::CMatrix4f), 1);

View File

@ -9,7 +9,7 @@ namespace urde
CRandomStaticFilter::CRandomStaticFilter(EFilterType type, bool cookieCutter)
: m_cookieCutter(cookieCutter)
{
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
CGraphicsCommitResources([&](boo::IGraphicsDataFactory::Context& ctx)
{
struct Vert
{

View File

@ -6,7 +6,7 @@ namespace urde
CScanLinesFilter::CScanLinesFilter(EFilterType type, bool even)
: m_even(even)
{
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
CGraphicsCommitResources([&](boo::IGraphicsDataFactory::Context& ctx)
{
m_uniBuf = ctx.newDynamicBuffer(boo::BufferUse::Uniform, sizeof(Uniform), 1);
m_dataBind = TMultiBlendShader<CScanLinesFilter>::BuildShaderDataBinding(ctx, type, *this);

View File

@ -33,7 +33,7 @@ void CSpaceWarpFilter::GenerateWarpRampTex(boo::IGraphicsDataFactory::Context& c
CSpaceWarpFilter::CSpaceWarpFilter()
{
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
CGraphicsCommitResources([&](boo::IGraphicsDataFactory::Context& ctx)
{
GenerateWarpRampTex(ctx);
struct Vert

View File

@ -15,7 +15,7 @@ CTexturedQuadFilter::CTexturedQuadFilter(EFilterType type, const boo::ObjToken<b
{
m_flipRect = CGraphics::g_BooFactory->platform() == boo::IGraphicsDataFactory::Platform::Vulkan;
tex->setClampMode(boo::TextureClampMode::ClampToEdge);
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
CGraphicsCommitResources([&](boo::IGraphicsDataFactory::Context& ctx)
{
m_vbo = ctx.newDynamicBuffer(boo::BufferUse::Vertex, 32, 16);
m_uniBuf = ctx.newDynamicBuffer(boo::BufferUse::Uniform, sizeof(Uniform), 1);
@ -157,7 +157,7 @@ URDE_SPECIALIZE_MULTI_BLEND_SHADER(CTexturedQuadFilter)
CTexturedQuadFilterAlpha::CTexturedQuadFilterAlpha(EFilterType type, const boo::ObjToken<boo::ITexture>& tex)
: CTexturedQuadFilter(tex)
{
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
CGraphicsCommitResources([&](boo::IGraphicsDataFactory::Context& ctx)
{
m_vbo = ctx.newDynamicBuffer(boo::BufferUse::Vertex, 32, 4);
m_uniBuf = ctx.newDynamicBuffer(boo::BufferUse::Uniform, sizeof(Uniform), 1);

View File

@ -6,7 +6,7 @@ namespace urde
CThermalColdFilter::CThermalColdFilter()
{
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
CGraphicsCommitResources([&](boo::IGraphicsDataFactory::Context& ctx)
{
m_shiftTex = ctx.newDynamicTexture(8, 4, boo::TextureFormat::RGBA8, boo::TextureClampMode::Repeat);

View File

@ -6,7 +6,7 @@ namespace urde
CThermalHotFilter::CThermalHotFilter()
{
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
CGraphicsCommitResources([&](boo::IGraphicsDataFactory::Context& ctx)
{
struct Vert
{

View File

@ -6,7 +6,7 @@ namespace urde
CWorldShadowShader::CWorldShadowShader(u32 w, u32 h)
: m_w(w), m_h(h)
{
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx)
CGraphicsCommitResources([&](boo::IGraphicsDataFactory::Context& ctx)
{
m_vbo = ctx.newDynamicBuffer(boo::BufferUse::Vertex, 16, 4);
m_uniBuf = ctx.newDynamicBuffer(boo::BufferUse::Uniform, sizeof(Uniform), 1);

View File

@ -9,7 +9,7 @@ namespace urde
CXRayBlurFilter::CXRayBlurFilter(TLockedToken<CTexture>& tex)
: m_paletteTex(tex), m_booTex(tex->GetPaletteTexture())
{
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
CGraphicsCommitResources([&](boo::IGraphicsDataFactory::Context& ctx)
{
struct Vert
{

View File

@ -29,8 +29,8 @@ public:
if (!CGraphics::g_BooFactory)
return;
CGraphics::CommitResources(
[&](boo::IGraphicsDataFactory::Context& ctx) -> bool
CGraphicsCommitResources(
[&](boo::IGraphicsDataFactory::Context& ctx)
{
switch (ctx.platform())
{

View File

@ -28,8 +28,8 @@ public:
if (!CGraphics::g_BooFactory)
return;
CGraphics::CommitResources(
[&](boo::IGraphicsDataFactory::Context& ctx) -> bool
CGraphicsCommitResources(
[&](boo::IGraphicsDataFactory::Context& ctx)
{
switch (ctx.platform())
{

View File

@ -55,7 +55,7 @@ CCompoundTargetReticle::CCompoundTargetReticle(const CStateManager& mgr)
CCompoundTargetReticle::SScanReticuleRenderer::SScanReticuleRenderer()
{
CGraphics::CommitResources([this](boo::IGraphicsDataFactory::Context& ctx)
CGraphicsCommitResources([this](boo::IGraphicsDataFactory::Context& ctx)
{
for (int i=0 ; i<2 ; ++i)
{

View File

@ -54,7 +54,7 @@ void CTextRenderBuffer::CommitResources()
for (BooFontCharacters& chs : m_fontCharacters)
chs.m_font->GetTexture();
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
CGraphicsCommitResources([&](boo::IGraphicsDataFactory::Context& ctx)
{
m_uniBuf = CTextSupportShader::s_Uniforms.allocateBlock(CGraphics::g_BooFactory);
auto uBufInfo = m_uniBuf.getBufferInfo();

View File

@ -20,6 +20,7 @@ public:
return;
x0_rumbleGenerator.Stop(id, EIOPort::Zero);
}
void HardStopAll() { x0_rumbleGenerator.HardStopAll(); }
s16 Rumble(CStateManager& mgr, const zeus::CVector3f& pos, ERumbleFxId fx, float dist, ERumblePriority priority);
s16 Rumble(CStateManager& mgr, ERumbleFxId fx, float gain, ERumblePriority priority);
};

View File

@ -2006,7 +2006,7 @@ CFrontEndUI::CFrontEndUI()
m->ResetGameState();
g_GameState->SetCurrentWorldId(g_ResFactory->TranslateOriginalToNew(g_DefaultWorldTag.id));
g_GameState->CurrentWorldState().SetAreaId(0);
g_GameState->CurrentWorldState().SetAreaId(1);
g_GameState->GameOptions().ResetToDefaults();
g_GameState->WriteBackupBuf();

View File

@ -319,6 +319,8 @@ CMFGameLoader::CMFGameLoader() : CMFGameLoaderBase("CMFGameLoader")
}
}
CMFGameLoader::~CMFGameLoader() {}
static const char* LoadDepPAKs[] =
{
"TestAnim",

View File

@ -83,6 +83,7 @@ class CMFGameLoader : public CMFGameLoaderBase
public:
CMFGameLoader();
~CMFGameLoader();
EMessageReturn OnMessage(const CArchitectureMessage& msg, CArchitectureQueue& queue);
void Draw() const;
};

View File

@ -785,6 +785,7 @@ void CMain::Shutdown()
CNESShader::Shutdown();
CGraphics::ShutdownBoo();
ShutdownDiscord();
CBooModel::AssertAllFreed();
}
boo::IWindow* CMain::GetMainWindow() const

View File

@ -29,8 +29,9 @@ class CCEConstant : public CColorElement
std::unique_ptr<CRealElement> xc_c;
std::unique_ptr<CRealElement> x10_d;
public:
CCEConstant(CRealElement* a, CRealElement* b, CRealElement* c, CRealElement* d)
: x4_a(a), x8_b(b), xc_c(c), x10_d(d) {}
CCEConstant(std::unique_ptr<CRealElement>&& a, std::unique_ptr<CRealElement>&& b,
std::unique_ptr<CRealElement>&& c, std::unique_ptr<CRealElement>&& d)
: x4_a(std::move(a)), x8_b(std::move(b)), xc_c(std::move(c)), x10_d(std::move(d)) {}
bool GetValue(int frame, zeus::CColor& colorOut) const;
};
@ -49,8 +50,9 @@ class CCETimeChain : public CColorElement
std::unique_ptr<CColorElement> x8_b;
std::unique_ptr<CIntElement> xc_swFrame;
public:
CCETimeChain(CColorElement* a, CColorElement* b, CIntElement* c)
: x4_a(a), x8_b(b), xc_swFrame(c) {}
CCETimeChain(std::unique_ptr<CColorElement>&& a, std::unique_ptr<CColorElement>&& b,
std::unique_ptr<CIntElement>&& c)
: x4_a(std::move(a)), x8_b(std::move(b)), xc_swFrame(std::move(c)) {}
bool GetValue(int frame, zeus::CColor& colorOut) const;
};
@ -61,8 +63,9 @@ class CCEFadeEnd : public CColorElement
std::unique_ptr<CRealElement> xc_startFrame;
std::unique_ptr<CRealElement> x10_endFrame;
public:
CCEFadeEnd(CColorElement* a, CColorElement* b, CRealElement* c, CRealElement* d)
: x4_a(a), x8_b(b), xc_startFrame(c), x10_endFrame(d) {}
CCEFadeEnd(std::unique_ptr<CColorElement>&& a, std::unique_ptr<CColorElement>&& b,
std::unique_ptr<CRealElement>&& c, std::unique_ptr<CRealElement>&& d)
: x4_a(std::move(a)), x8_b(std::move(b)), xc_startFrame(std::move(c)), x10_endFrame(std::move(d)) {}
bool GetValue(int frame, zeus::CColor& colorOut) const;
};
@ -72,8 +75,9 @@ class CCEFade : public CColorElement
std::unique_ptr<CColorElement> x8_b;
std::unique_ptr<CRealElement> xc_endFrame;
public:
CCEFade(CColorElement* a, CColorElement* b, CRealElement* c)
: x4_a(a), x8_b(b), xc_endFrame(c) {}
CCEFade(std::unique_ptr<CColorElement>&& a, std::unique_ptr<CColorElement>&& b,
std::unique_ptr<CRealElement>&& c)
: x4_a(std::move(a)), x8_b(std::move(b)), xc_endFrame(std::move(c)) {}
bool GetValue(int frame, zeus::CColor& colorOut) const;
};
@ -84,8 +88,9 @@ class CCEPulse : public CColorElement
std::unique_ptr<CColorElement> xc_aVal;
std::unique_ptr<CColorElement> x10_bVal;
public:
CCEPulse(CIntElement* a, CIntElement* b, CColorElement* c, CColorElement* d)
: x4_aDuration(a), x8_bDuration(b), xc_aVal(c), x10_bVal(d) {}
CCEPulse(std::unique_ptr<CIntElement>&& a, std::unique_ptr<CIntElement>&& b,
std::unique_ptr<CColorElement>&& c, std::unique_ptr<CColorElement>&& d)
: x4_aDuration(std::move(a)), x8_bDuration(std::move(b)), xc_aVal(std::move(c)), x10_bVal(std::move(d)) {}
bool GetValue(int frame, zeus::CColor& colorOut) const;
};

View File

@ -32,7 +32,7 @@ CDecal::CDecal(const TToken<CDecalDescription>& desc, const zeus::CTransform& xf
else
x5c_29_modelInvalid = true;
CGraphics::CommitResources([this](boo::IGraphicsDataFactory::Context& ctx)
CGraphicsCommitResources([this](boo::IGraphicsDataFactory::Context& ctx)
{
for (int i=0 ; i<2 ; ++i)
{

View File

@ -67,19 +67,19 @@ bool CDecalDataFactory::CreateDPSM(CDecalDescription* desc, CInputStream& in, CS
desc->x38_DMDL = CPF::GetModel(in, resPool);
break;
case SBIG('DLFT'):
desc->x48_DLFT.reset(CPF::GetIntElement(in));
desc->x48_DLFT = CPF::GetIntElement(in);
break;
case SBIG('DMOP'):
desc->x4c_DMOP.reset(CPF::GetVectorElement(in));
desc->x4c_DMOP = CPF::GetVectorElement(in);
break;
case SBIG('DMRT'):
desc->x50_DMRT.reset(CPF::GetVectorElement(in));
desc->x50_DMRT = CPF::GetVectorElement(in);
break;
case SBIG('DMSC'):
desc->x54_DMSC.reset(CPF::GetVectorElement(in));
desc->x54_DMSC = CPF::GetVectorElement(in);
break;
case SBIG('DMCL'):
desc->x58_DMCL.reset(CPF::GetColorElement(in));
desc->x58_DMCL = CPF::GetColorElement(in);
break;
case SBIG('DMAB'):
desc->x5c_24_DMAB = CPF::GetBool(in);
@ -106,27 +106,27 @@ void CDecalDataFactory::GetQuadDecalInfo(CInputStream& in, CSimplePool* resPool,
{
case SBIG('1LFT'):
case SBIG('2LFT'):
quad.x0_LFT.reset(CPF::GetIntElement(in));
quad.x0_LFT = CPF::GetIntElement(in);
break;
case SBIG('1SZE'):
case SBIG('2SZE'):
quad.x4_SZE.reset(CPF::GetRealElement(in));
quad.x4_SZE = CPF::GetRealElement(in);
break;
case SBIG('1ROT'):
case SBIG('2ROT'):
quad.x8_ROT.reset(CPF::GetRealElement(in));
quad.x8_ROT = CPF::GetRealElement(in);
break;
case SBIG('1OFF'):
case SBIG('2OFF'):
quad.xc_OFF.reset(CPF::GetVectorElement(in));
quad.xc_OFF = CPF::GetVectorElement(in);
break;
case SBIG('1CLR'):
case SBIG('2CLR'):
quad.x10_CLR.reset(CPF::GetColorElement(in));
quad.x10_CLR = CPF::GetColorElement(in);
break;
case SBIG('1TEX'):
case SBIG('2TEX'):
quad.x14_TEX.reset(CPF::GetTextureElement(in, resPool));
quad.x14_TEX = CPF::GetTextureElement(in, resPool);
break;
case SBIG('1ADD'):
case SBIG('2ADD'):

View File

@ -234,7 +234,7 @@ CElementGen::CElementGen(const TToken<CGenDescription>& gen,
size_t maxInsts = x26c_30_MBLR ? (m_maxMBSP * x90_MAXP) : x90_MAXP;
maxInsts = (maxInsts == 0 ? 256 : maxInsts);
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
CGraphicsCommitResources([&](boo::IGraphicsDataFactory::Context& ctx)
{
if (!x26c_31_LINE)
{

View File

@ -13,8 +13,8 @@ class CEESimpleEmitter : public CEmitterElement
std::unique_ptr<CVectorElement> x4_loc;
std::unique_ptr<CVectorElement> x8_vec;
public:
CEESimpleEmitter(CVectorElement* a, CVectorElement* b)
: x4_loc(a), x8_vec(b) {}
CEESimpleEmitter(std::unique_ptr<CVectorElement>&& a, std::unique_ptr<CVectorElement>&& b)
: x4_loc(std::move(a)), x8_vec(std::move(b)) {}
bool GetValue(int frame, zeus::CVector3f& pPos, zeus::CVector3f& pVel) const;
};
@ -24,8 +24,9 @@ class CVESphere : public CEmitterElement
std::unique_ptr<CRealElement> x8_sphereRadius;
std::unique_ptr<CRealElement> xc_velocityMag;
public:
CVESphere(CVectorElement* a, CRealElement* b, CRealElement* c)
: x4_sphereOrigin(a), x8_sphereRadius(b), xc_velocityMag(c) {}
CVESphere(std::unique_ptr<CVectorElement>&& a, std::unique_ptr<CRealElement>&& b,
std::unique_ptr<CRealElement>&& c)
: x4_sphereOrigin(std::move(a)), x8_sphereRadius(std::move(b)), xc_velocityMag(std::move(c)) {}
bool GetValue(int frame, zeus::CVector3f& pPos, zeus::CVector3f& pVel) const;
};
@ -39,9 +40,13 @@ class CVEAngleSphere : public CEmitterElement
std::unique_ptr<CRealElement> x18_angleXRange;
std::unique_ptr<CRealElement> x1c_angleYRange;
public:
CVEAngleSphere(CVectorElement* a, CRealElement* b, CRealElement* c, CRealElement* d,
CRealElement* e, CRealElement* f, CRealElement* g)
: x4_sphereOrigin(a), x8_sphereRadius(b), xc_velocityMag(c), x10_angleXBias(d), x14_angleYBias(e), x18_angleXRange(f), x1c_angleYRange(g) {}
CVEAngleSphere(std::unique_ptr<CVectorElement>&& a, std::unique_ptr<CRealElement>&& b,
std::unique_ptr<CRealElement>&& c, std::unique_ptr<CRealElement>&& d,
std::unique_ptr<CRealElement>&& e, std::unique_ptr<CRealElement>&& f,
std::unique_ptr<CRealElement>&& g)
: x4_sphereOrigin(std::move(a)), x8_sphereRadius(std::move(b)), xc_velocityMag(std::move(c)),
x10_angleXBias(std::move(d)), x14_angleYBias(std::move(e)), x18_angleXRange(std::move(f)),
x1c_angleYRange(std::move(g)) {}
bool GetValue(int frame, zeus::CVector3f& pPos, zeus::CVector3f& pVel) const;
};

View File

@ -27,8 +27,8 @@ class CIEDeath : public CIntElement
std::unique_ptr<CIntElement> x4_a;
std::unique_ptr<CIntElement> x8_b;
public:
CIEDeath(CIntElement* a, CIntElement* b)
: x4_a(a), x8_b(b) {}
CIEDeath(std::unique_ptr<CIntElement>&& a, std::unique_ptr<CIntElement>&& b)
: x4_a(std::move(a)), x8_b(std::move(b)) {}
bool GetValue(int frame, int& valOut) const;
};
@ -38,8 +38,8 @@ class CIEClamp : public CIntElement
std::unique_ptr<CIntElement> x8_max;
std::unique_ptr<CIntElement> xc_val;
public:
CIEClamp(CIntElement* a, CIntElement* b, CIntElement* c)
: x4_min(a), x8_max(b), xc_val(c) {}
CIEClamp(std::unique_ptr<CIntElement>&& a, std::unique_ptr<CIntElement>&& b, std::unique_ptr<CIntElement>&& c)
: x4_min(std::move(a)), x8_max(std::move(b)), xc_val(std::move(c)) {}
bool GetValue(int frame, int& valOut) const;
};
@ -49,8 +49,8 @@ class CIETimeChain : public CIntElement
std::unique_ptr<CIntElement> x8_b;
std::unique_ptr<CIntElement> xc_swFrame;
public:
CIETimeChain(CIntElement* a, CIntElement* b, CIntElement* c)
: x4_a(a), x8_b(b), xc_swFrame(c) {}
CIETimeChain(std::unique_ptr<CIntElement>&& a, std::unique_ptr<CIntElement>&& b, std::unique_ptr<CIntElement>&& c)
: x4_a(std::move(a)), x8_b(std::move(b)), xc_swFrame(std::move(c)) {}
bool GetValue(int frame, int& valOut) const;
};
@ -59,8 +59,8 @@ class CIEAdd : public CIntElement
std::unique_ptr<CIntElement> x4_a;
std::unique_ptr<CIntElement> x8_b;
public:
CIEAdd(CIntElement* a, CIntElement* b)
: x4_a(a), x8_b(b) {}
CIEAdd(std::unique_ptr<CIntElement>&& a, std::unique_ptr<CIntElement>&& b)
: x4_a(std::move(a)), x8_b(std::move(b)) {}
bool GetValue(int frame, int& valOut) const;
};
@ -76,8 +76,8 @@ class CIEImpulse : public CIntElement
{
std::unique_ptr<CIntElement> x4_a;
public:
CIEImpulse(CIntElement* a)
: x4_a(a) {}
CIEImpulse(std::unique_ptr<CIntElement>&& a)
: x4_a(std::move(a)) {}
bool GetValue(int frame, int& valOut) const;
};
@ -85,8 +85,8 @@ class CIELifetimePercent : public CIntElement
{
std::unique_ptr<CIntElement> x4_percentVal;
public:
CIELifetimePercent(CIntElement* a)
: x4_percentVal(a) {}
CIELifetimePercent(std::unique_ptr<CIntElement>&& a)
: x4_percentVal(std::move(a)) {}
bool GetValue(int frame, int& valOut) const;
};
@ -95,8 +95,8 @@ class CIEInitialRandom : public CIntElement
std::unique_ptr<CIntElement> x4_a;
std::unique_ptr<CIntElement> x8_b;
public:
CIEInitialRandom(CIntElement* a, CIntElement* b)
: x4_a(a), x8_b(b) {}
CIEInitialRandom(std::unique_ptr<CIntElement>&& a, std::unique_ptr<CIntElement>&& b)
: x4_a(std::move(a)), x8_b(std::move(b)) {}
bool GetValue(int frame, int& valOut) const;
};
@ -107,8 +107,9 @@ class CIEPulse : public CIntElement
std::unique_ptr<CIntElement> xc_aVal;
std::unique_ptr<CIntElement> x10_bVal;
public:
CIEPulse(CIntElement* a, CIntElement* b, CIntElement* c, CIntElement* d)
: x4_aDuration(a), x8_bDuration(b), xc_aVal(c), x10_bVal(d) {}
CIEPulse(std::unique_ptr<CIntElement>&& a, std::unique_ptr<CIntElement>&& b,
std::unique_ptr<CIntElement>&& c, std::unique_ptr<CIntElement>&& d)
: x4_aDuration(std::move(a)), x8_bDuration(std::move(b)), xc_aVal(std::move(c)), x10_bVal(std::move(d)) {}
bool GetValue(int frame, int& valOut) const;
};
@ -117,8 +118,8 @@ class CIEMultiply : public CIntElement
std::unique_ptr<CIntElement> x4_a;
std::unique_ptr<CIntElement> x8_b;
public:
CIEMultiply(CIntElement* a, CIntElement* b)
: x4_a(a), x8_b(b) {}
CIEMultiply(std::unique_ptr<CIntElement>&& a, std::unique_ptr<CIntElement>&& b)
: x4_a(std::move(a)), x8_b(std::move(b)) {}
bool GetValue(int frame, int& valOut) const;
};
@ -130,8 +131,9 @@ class CIESampleAndHold : public CIntElement
std::unique_ptr<CIntElement> x10_waitFramesMax;
int x14_holdVal;
public:
CIESampleAndHold(CIntElement* a, CIntElement* b, CIntElement* c)
: x4_sampleSource(a), xc_waitFramesMin(b), x10_waitFramesMax(c) {}
CIESampleAndHold(std::unique_ptr<CIntElement>&& a, std::unique_ptr<CIntElement>&& b,
std::unique_ptr<CIntElement>&& c)
: x4_sampleSource(std::move(a)), xc_waitFramesMin(std::move(b)), x10_waitFramesMax(std::move(c)) {}
bool GetValue(int frame, int& valOut) const;
};
@ -140,8 +142,8 @@ class CIERandom : public CIntElement
std::unique_ptr<CIntElement> x4_min;
std::unique_ptr<CIntElement> x8_max;
public:
CIERandom(CIntElement* a, CIntElement* b)
: x4_min(a), x8_max(b) {}
CIERandom(std::unique_ptr<CIntElement>&& a, std::unique_ptr<CIntElement>&& b)
: x4_min(std::move(a)), x8_max(std::move(b)) {}
bool GetValue(int frame, int& valOut) const;
};
@ -149,8 +151,8 @@ class CIETimeScale : public CIntElement
{
std::unique_ptr<CRealElement> x4_a;
public:
CIETimeScale(CRealElement* a)
: x4_a(a) {}
CIETimeScale(std::unique_ptr<CRealElement>&& a)
: x4_a(std::move(a)) {}
bool GetValue(int frame, int& valOut) const;
};
@ -177,8 +179,8 @@ class CIEModulo : public CIntElement
std::unique_ptr<CIntElement> x4_a;
std::unique_ptr<CIntElement> x8_b;
public:
CIEModulo(CIntElement* a, CIntElement* b)
: x4_a(a), x8_b(b) {}
CIEModulo(std::unique_ptr<CIntElement>&& a, std::unique_ptr<CIntElement>&& b)
: x4_a(std::move(a)), x8_b(std::move(b)) {}
bool GetValue(int frame, int& valOut) const;
};
@ -187,8 +189,8 @@ class CIESubtract : public CIntElement
std::unique_ptr<CIntElement> x4_a;
std::unique_ptr<CIntElement> x8_b;
public:
CIESubtract(CIntElement* a, CIntElement* b)
: x4_a(a), x8_b(b) {}
CIESubtract(std::unique_ptr<CIntElement>&& a, std::unique_ptr<CIntElement>&& b)
: x4_a(std::move(a)), x8_b(std::move(b)) {}
bool GetValue(int frame, int& valOut) const;
};

View File

@ -99,8 +99,10 @@ bool CMVETimeChain::GetValue(int frame, zeus::CVector3f& pVel, zeus::CVector3f&
return x4_a->GetValue(frame, pVel, pPos);
}
CMVEBounce::CMVEBounce(CVectorElement* a, CVectorElement* b, CRealElement* c, CRealElement* d, bool f)
: x4_planePoint(a), x8_planeNormal(b), xc_friction(c), x10_restitution(d), x14_planePrecomputed(false), x15_dieOnPenetrate(f), x24_planeD(0.0)
CMVEBounce::CMVEBounce(std::unique_ptr<CVectorElement>&& a, std::unique_ptr<CVectorElement>&& b,
std::unique_ptr<CRealElement>&& c, std::unique_ptr<CRealElement>&& d, bool e)
: x4_planePoint(std::move(a)), x8_planeNormal(std::move(b)), xc_friction(std::move(c)),
x10_restitution(std::move(d)), x14_planePrecomputed(false), x15_dieOnPenetrate(e), x24_planeD(0.0)
{
if (x4_planePoint && x8_planeNormal && x4_planePoint->IsFastConstant() && x8_planeNormal->IsFastConstant())
{

View File

@ -16,8 +16,10 @@ class CMVEImplosion : public CModVectorElement
std::unique_ptr<CRealElement> x10_minMag;
bool x14_enableMinMag;
public:
CMVEImplosion(CVectorElement* a, CRealElement* b, CRealElement* c, CRealElement* d, bool e)
: x4_implPoint(a), x8_magScale(b), xc_maxMag(c), x10_minMag(d), x14_enableMinMag(e) {}
CMVEImplosion(std::unique_ptr<CVectorElement>&& a, std::unique_ptr<CRealElement>&& b,
std::unique_ptr<CRealElement>&& c, std::unique_ptr<CRealElement>&& d, bool e)
: x4_implPoint(std::move(a)), x8_magScale(std::move(b)), xc_maxMag(std::move(c)), x10_minMag(std::move(d)),
x14_enableMinMag(std::move(e)) {}
bool GetValue(int frame, zeus::CVector3f& pVel, zeus::CVector3f& pPos) const;
};
@ -29,8 +31,10 @@ class CMVEExponentialImplosion : public CModVectorElement
std::unique_ptr<CRealElement> x10_minMag;
bool x14_enableMinMag;
public:
CMVEExponentialImplosion(CVectorElement* a, CRealElement* b, CRealElement* c, CRealElement* d, bool e)
: x4_implPoint(a), x8_magScale(b), xc_maxMag(c), x10_minMag(d), x14_enableMinMag(e) {}
CMVEExponentialImplosion(std::unique_ptr<CVectorElement>&& a, std::unique_ptr<CRealElement>&& b,
std::unique_ptr<CRealElement>&& c, std::unique_ptr<CRealElement>&& d, bool e)
: x4_implPoint(std::move(a)), x8_magScale(std::move(b)), xc_maxMag(std::move(c)), x10_minMag(std::move(d)),
x14_enableMinMag(std::move(e)) {}
bool GetValue(int frame, zeus::CVector3f& pVel, zeus::CVector3f& pPos) const;
};
@ -42,8 +46,10 @@ class CMVELinearImplosion : public CModVectorElement
std::unique_ptr<CRealElement> x10_minMag;
bool x14_enableMinMag;
public:
CMVELinearImplosion(CVectorElement* a, CRealElement* b, CRealElement* c, CRealElement* d, bool e)
: x4_implPoint(a), x8_magScale(b), xc_maxMag(c), x10_minMag(d), x14_enableMinMag(e) {}
CMVELinearImplosion(std::unique_ptr<CVectorElement>&& a, std::unique_ptr<CRealElement>&& b,
std::unique_ptr<CRealElement>&& c, std::unique_ptr<CRealElement>&& d, bool e)
: x4_implPoint(std::move(a)), x8_magScale(std::move(b)), xc_maxMag(std::move(c)), x10_minMag(std::move(d)),
x14_enableMinMag(std::move(e)) {}
bool GetValue(int frame, zeus::CVector3f& pVel, zeus::CVector3f& pPos) const;
};
@ -53,8 +59,9 @@ class CMVETimeChain : public CModVectorElement
std::unique_ptr<CModVectorElement> x8_b;
std::unique_ptr<CIntElement> xc_swFrame;
public:
CMVETimeChain(CModVectorElement* a, CModVectorElement* b, CIntElement* c)
: x4_a(a), x8_b(b), xc_swFrame(c) {}
CMVETimeChain(std::unique_ptr<CModVectorElement>&& a, std::unique_ptr<CModVectorElement>&& b,
std::unique_ptr<CIntElement>&& c)
: x4_a(std::move(a)), x8_b(std::move(b)), xc_swFrame(std::move(c)) {}
bool GetValue(int frame, zeus::CVector3f& pVel, zeus::CVector3f& pPos) const;
};
@ -69,7 +76,8 @@ class CMVEBounce : public CModVectorElement
zeus::CVector3f x18_planeValidatedNormal;
float x24_planeD;
public:
CMVEBounce(CVectorElement* a, CVectorElement* b, CRealElement* c, CRealElement* d, bool e);
CMVEBounce(std::unique_ptr<CVectorElement>&& a, std::unique_ptr<CVectorElement>&& b,
std::unique_ptr<CRealElement>&& c, std::unique_ptr<CRealElement>&& d, bool e);
bool GetValue(int frame, zeus::CVector3f& pVel, zeus::CVector3f& pPos) const;
};
@ -79,8 +87,9 @@ class CMVEConstant : public CModVectorElement
std::unique_ptr<CRealElement> x8_y;
std::unique_ptr<CRealElement> xc_z;
public:
CMVEConstant(CRealElement* a, CRealElement* b, CRealElement* c)
: x4_x(a), x8_y(b), xc_z(c) {}
CMVEConstant(std::unique_ptr<CRealElement>&& a, std::unique_ptr<CRealElement>&& b,
std::unique_ptr<CRealElement>&& c)
: x4_x(std::move(a)), x8_y(std::move(b)), xc_z(std::move(c)) {}
bool GetValue(int frame, zeus::CVector3f& pVel, zeus::CVector3f& pPos) const;
};
@ -97,8 +106,8 @@ class CMVEGravity : public CModVectorElement
{
std::unique_ptr<CVectorElement> x4_a;
public:
CMVEGravity(CVectorElement* a)
: x4_a(a) {}
CMVEGravity(std::unique_ptr<CVectorElement>&& a)
: x4_a(std::move(a)) {}
bool GetValue(int frame, zeus::CVector3f& pVel, zeus::CVector3f& pPos) const;
};
@ -107,8 +116,8 @@ class CMVEExplode : public CModVectorElement
std::unique_ptr<CRealElement> x4_a;
std::unique_ptr<CRealElement> x8_b;
public:
CMVEExplode(CRealElement* a, CRealElement* b)
: x4_a(a), x8_b(b) {}
CMVEExplode(std::unique_ptr<CRealElement>&& a, std::unique_ptr<CRealElement>&& b)
: x4_a(std::move(a)), x8_b(std::move(b)) {}
bool GetValue(int frame, zeus::CVector3f& pVel, zeus::CVector3f& pPos) const;
};
@ -116,8 +125,8 @@ class CMVESetPosition : public CModVectorElement
{
std::unique_ptr<CVectorElement> x4_a;
public:
CMVESetPosition(CVectorElement* a)
: x4_a(a) {}
CMVESetPosition(std::unique_ptr<CVectorElement>&& a)
: x4_a(std::move(a)) {}
bool GetValue(int frame, zeus::CVector3f& pVel, zeus::CVector3f& pPos) const;
};
@ -128,8 +137,9 @@ class CMVEPulse : public CModVectorElement
std::unique_ptr<CModVectorElement> xc_aVal;
std::unique_ptr<CModVectorElement> x10_bVal;
public:
CMVEPulse(CIntElement* a, CIntElement* b, CModVectorElement* c, CModVectorElement* d)
: x4_aDuration(a), x8_bDuration(b), xc_aVal(c), x10_bVal(d) {}
CMVEPulse(std::unique_ptr<CIntElement>&& a, std::unique_ptr<CIntElement>&& b,
std::unique_ptr<CModVectorElement>&& c, std::unique_ptr<CModVectorElement>&& d)
: x4_aDuration(std::move(a)), x8_bDuration(std::move(b)), xc_aVal(std::move(c)), x10_bVal(std::move(d)) {}
bool GetValue(int frame, zeus::CVector3f& pVel, zeus::CVector3f& pPos) const;
};
@ -138,8 +148,8 @@ class CMVEWind : public CModVectorElement
std::unique_ptr<CVectorElement> x4_velocity;
std::unique_ptr<CRealElement> x8_factor;
public:
CMVEWind(CVectorElement* a, CRealElement* b)
: x4_velocity(a), x8_factor(b) {}
CMVEWind(std::unique_ptr<CVectorElement>&& a, std::unique_ptr<CRealElement>&& b)
: x4_velocity(std::move(a)), x8_factor(std::move(b)) {}
bool GetValue(int frame, zeus::CVector3f& pVel, zeus::CVector3f& pPos) const;
};
@ -150,8 +160,10 @@ class CMVESwirl : public CModVectorElement
std::unique_ptr<CRealElement> xc_targetRadius;
std::unique_ptr<CRealElement> x10_tangentialVelocity;
public:
CMVESwirl(CVectorElement* a, CVectorElement* b, CRealElement* c, CRealElement* d)
: x4_helixPoint(a), x8_curveBinormal(b), xc_targetRadius(c), x10_tangentialVelocity(d) {}
CMVESwirl(std::unique_ptr<CVectorElement>&& a, std::unique_ptr<CVectorElement>&& b,
std::unique_ptr<CRealElement>&& c, std::unique_ptr<CRealElement>&& d)
: x4_helixPoint(std::move(a)), x8_curveBinormal(std::move(b)),
xc_targetRadius(std::move(c)), x10_tangentialVelocity(std::move(d)) {}
bool GetValue(int frame, zeus::CVector3f& pVel, zeus::CVector3f& pPos) const;
};

File diff suppressed because it is too large Load Diff

View File

@ -80,13 +80,13 @@ class CParticleDataFactory
static SChildGeneratorDesc GetChildGeneratorDesc(CInputStream& in, CSimplePool* resPool, const std::vector<CAssetId>& tracker);
static SSwooshGeneratorDesc GetSwooshGeneratorDesc(CInputStream& in, CSimplePool* resPool);
static SElectricGeneratorDesc GetElectricGeneratorDesc(CInputStream& in, CSimplePool* resPool);
static CUVElement* GetTextureElement(CInputStream& in, CSimplePool* resPool);
static CColorElement* GetColorElement(CInputStream& in);
static CModVectorElement* GetModVectorElement(CInputStream& in);
static CEmitterElement* GetEmitterElement(CInputStream& in);
static CVectorElement* GetVectorElement(CInputStream& in);
static CRealElement* GetRealElement(CInputStream& in);
static CIntElement* GetIntElement(CInputStream& in);
static std::unique_ptr<CUVElement> GetTextureElement(CInputStream& in, CSimplePool* resPool);
static std::unique_ptr<CColorElement> GetColorElement(CInputStream& in);
static std::unique_ptr<CModVectorElement> GetModVectorElement(CInputStream& in);
static std::unique_ptr<CEmitterElement> GetEmitterElement(CInputStream& in);
static std::unique_ptr<CVectorElement> GetVectorElement(CInputStream& in);
static std::unique_ptr<CRealElement> GetRealElement(CInputStream& in);
static std::unique_ptr<CIntElement> GetIntElement(CInputStream& in);
static float GetReal(CInputStream& in);
static s32 GetInt(CInputStream& in);

View File

@ -43,52 +43,52 @@ bool CParticleElectricDataFactory::CreateELSM(CElectricDescription* desc, CInput
switch (clsId)
{
case SBIG('LIFE'):
desc->x0_LIFE.reset(CPF::GetIntElement(in));
desc->x0_LIFE = CPF::GetIntElement(in);
break;
case SBIG('SLIF'):
desc->x4_SLIF.reset(CPF::GetIntElement(in));
desc->x4_SLIF = CPF::GetIntElement(in);
break;
case SBIG('GRAT'):
desc->x8_GRAT.reset(CPF::GetRealElement(in));
desc->x8_GRAT = CPF::GetRealElement(in);
break;
case SBIG('SCNT'):
desc->xc_SCNT.reset(CPF::GetIntElement(in));
desc->xc_SCNT = CPF::GetIntElement(in);
break;
case SBIG('SSEG'):
desc->x10_SSEG.reset(CPF::GetIntElement(in));
desc->x10_SSEG = CPF::GetIntElement(in);
break;
case SBIG('COLR'):
desc->x14_COLR.reset(CPF::GetColorElement(in));
desc->x14_COLR = CPF::GetColorElement(in);
break;
case SBIG('IEMT'):
desc->x18_IEMT.reset(CPF::GetEmitterElement(in));
desc->x18_IEMT = CPF::GetEmitterElement(in);
break;
case SBIG('FEMT'):
desc->x1c_FEMT.reset(CPF::GetEmitterElement(in));
desc->x1c_FEMT = CPF::GetEmitterElement(in);
break;
case SBIG('AMPL'):
desc->x20_AMPL.reset(CPF::GetRealElement(in));
desc->x20_AMPL = CPF::GetRealElement(in);
break;
case SBIG('AMPD'):
desc->x24_AMPD.reset(CPF::GetRealElement(in));
desc->x24_AMPD = CPF::GetRealElement(in);
break;
case SBIG('LWD1'):
desc->x28_LWD1.reset(CPF::GetRealElement(in));
desc->x28_LWD1 = CPF::GetRealElement(in);
break;
case SBIG('LWD2'):
desc->x2c_LWD2.reset(CPF::GetRealElement(in));
desc->x2c_LWD2 = CPF::GetRealElement(in);
break;
case SBIG('LWD3'):
desc->x30_LWD3.reset(CPF::GetRealElement(in));
desc->x30_LWD3 = CPF::GetRealElement(in);
break;
case SBIG('LCL1'):
desc->x34_LCL1.reset(CPF::GetColorElement(in));
desc->x34_LCL1 = CPF::GetColorElement(in);
break;
case SBIG('LCL2'):
desc->x38_LCL2.reset(CPF::GetColorElement(in));
desc->x38_LCL2 = CPF::GetColorElement(in);
break;
case SBIG('LCL3'):
desc->x3c_LCL3.reset(CPF::GetColorElement(in));
desc->x3c_LCL3 = CPF::GetColorElement(in);
break;
case SBIG('SSWH'):
desc->x40_SSWH = CPF::GetSwooshGeneratorDesc(in, resPool);

View File

@ -69,7 +69,7 @@ CParticleSwoosh::CParticleSwoosh(const TToken<CSwooshDescription>& desc, int len
{
int maxVerts = x1b4_LENG * (x1b0_SPLN+1) * x1b8_SIDE * 4;
m_cachedVerts.reserve(maxVerts);
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
CGraphicsCommitResources([&](boo::IGraphicsDataFactory::Context& ctx)
{
m_vertBuf = ctx.newDynamicBuffer(boo::BufferUse::Vertex, sizeof(CParticleSwooshShaders::Vert), maxVerts);
m_uniformBuf = ctx.newDynamicBuffer(boo::BufferUse::Uniform, sizeof(zeus::CMatrix4f), 1);

View File

@ -41,55 +41,55 @@ bool CParticleSwooshDataFactory::CreateWPSM(CSwooshDescription* desc, CInputStre
switch (clsId)
{
case SBIG('PSLT'):
desc->x0_PSLT.reset(CPF::GetIntElement(in));
desc->x0_PSLT = CPF::GetIntElement(in);
break;
case SBIG('TIME'):
desc->x4_TIME.reset(CPF::GetRealElement(in));
desc->x4_TIME = CPF::GetRealElement(in);
break;
case SBIG('LRAD'):
desc->x8_LRAD.reset(CPF::GetRealElement(in));
desc->x8_LRAD = CPF::GetRealElement(in);
break;
case SBIG('RRAD'):
desc->xc_RRAD.reset(CPF::GetRealElement(in));
desc->xc_RRAD = CPF::GetRealElement(in);
break;
case SBIG('LENG'):
desc->x10_LENG.reset(CPF::GetIntElement(in));
desc->x10_LENG = CPF::GetIntElement(in);
break;
case SBIG('COLR'):
desc->x14_COLR.reset(CPF::GetColorElement(in));
desc->x14_COLR = CPF::GetColorElement(in);
break;
case SBIG('SIDE'):
desc->x18_SIDE.reset(CPF::GetIntElement(in));
desc->x18_SIDE = CPF::GetIntElement(in);
break;
case SBIG('IROT'):
desc->x1c_IROT.reset(CPF::GetRealElement(in));
desc->x1c_IROT = CPF::GetRealElement(in);
break;
case SBIG('ROTM'):
desc->x20_ROTM.reset(CPF::GetRealElement(in));
desc->x20_ROTM = CPF::GetRealElement(in);
break;
case SBIG('POFS'):
desc->x24_POFS.reset(CPF::GetVectorElement(in));
desc->x24_POFS = CPF::GetVectorElement(in);
break;
case SBIG('IVEL'):
desc->x28_IVEL.reset(CPF::GetVectorElement(in));
desc->x28_IVEL = CPF::GetVectorElement(in);
break;
case SBIG('NPOS'):
desc->x2c_NPOS.reset(CPF::GetVectorElement(in));
desc->x2c_NPOS = CPF::GetVectorElement(in);
break;
case SBIG('VELM'):
desc->x30_VELM.reset(CPF::GetModVectorElement(in));
desc->x30_VELM = CPF::GetModVectorElement(in);
break;
case SBIG('VLM2'):
desc->x34_VLM2.reset(CPF::GetModVectorElement(in));
desc->x34_VLM2 = CPF::GetModVectorElement(in);
break;
case SBIG('SPLN'):
desc->x38_SPLN.reset(CPF::GetIntElement(in));
desc->x38_SPLN = CPF::GetIntElement(in);
break;
case SBIG('TEXR'):
desc->x3c_TEXR.reset(CPF::GetTextureElement(in, resPool));
desc->x3c_TEXR = CPF::GetTextureElement(in, resPool);
break;
case SBIG('TSPN'):
desc->x40_TSPN.reset(CPF::GetIntElement(in));
desc->x40_TSPN = CPF::GetIntElement(in);
break;
case SBIG('LLRD'):
desc->x44_24_LLRD = CPF::GetBool(in);

View File

@ -43,34 +43,34 @@ bool CProjectileWeaponDataFactory::CreateWPSM(CWeaponDescription* desc, CInputSt
switch (clsId)
{
case SBIG('IORN'):
desc->x0_IORN.reset(CPF::GetVectorElement(in));
desc->x0_IORN = CPF::GetVectorElement(in);
break;
case SBIG('IVEC'):
desc->x4_IVEC.reset(CPF::GetVectorElement(in));
desc->x4_IVEC = CPF::GetVectorElement(in);
break;
case SBIG('PSOV'):
desc->x8_PSOV.reset(CPF::GetVectorElement(in));
desc->x8_PSOV = CPF::GetVectorElement(in);
break;
case SBIG('PSVM'):
desc->xc_PSVM.reset(CPF::GetModVectorElement(in));
desc->xc_PSVM = CPF::GetModVectorElement(in);
break;
case SBIG('VMD2'):
desc->x10_VMD2 = CPF::GetBool(in);
break;
case SBIG('PSLT'):
desc->x14_PSLT.reset(CPF::GetIntElement(in));
desc->x14_PSLT = CPF::GetIntElement(in);
break;
case SBIG('PSCL'):
desc->x18_PSCL.reset(CPF::GetVectorElement(in));
desc->x18_PSCL = CPF::GetVectorElement(in);
break;
case SBIG('PCOL'):
desc->x1c_PCOL.reset(CPF::GetColorElement(in));
desc->x1c_PCOL = CPF::GetColorElement(in);
break;
case SBIG('POFS'):
desc->x20_POFS.reset(CPF::GetVectorElement(in));
desc->x20_POFS = CPF::GetVectorElement(in);
break;
case SBIG('OFST'):
desc->x24_OFST.reset(CPF::GetVectorElement(in));
desc->x24_OFST = CPF::GetVectorElement(in);
break;
case SBIG('APSO'):
desc->x28_APSO = CPF::GetBool(in);
@ -94,7 +94,7 @@ bool CProjectileWeaponDataFactory::CreateWPSM(CWeaponDescription* desc, CInputSt
desc->x2e_AS13 = CPF::GetBool(in);
break;
case SBIG('TRAT'):
desc->x30_TRAT.reset(CPF::GetRealElement(in));
desc->x30_TRAT = CPF::GetRealElement(in);
break;
case SBIG('APSM'):
{
@ -151,10 +151,10 @@ bool CProjectileWeaponDataFactory::CreateWPSM(CWeaponDescription* desc, CInputSt
break;
}
case SBIG('RNGE'):
desc->xac_RNGE.reset(CPF::GetRealElement(in));
desc->xac_RNGE = CPF::GetRealElement(in);
break;
case SBIG('FOFF'):
desc->xb0_FOFF.reset(CPF::GetRealElement(in));
desc->xb0_FOFF = CPF::GetRealElement(in);
break;
default:
{

View File

@ -27,8 +27,8 @@ class CRELifetimeTween : public CRealElement
std::unique_ptr<CRealElement> x4_a;
std::unique_ptr<CRealElement> x8_b;
public:
CRELifetimeTween(CRealElement* a, CRealElement* b)
: x4_a(a), x8_b(b) {}
CRELifetimeTween(std::unique_ptr<CRealElement>&& a, std::unique_ptr<CRealElement>&& b)
: x4_a(std::move(a)), x8_b(std::move(b)) {}
bool GetValue(int frame, float& valOut) const;
};
@ -47,8 +47,8 @@ class CRETimeChain : public CRealElement
std::unique_ptr<CRealElement> x8_b;
std::unique_ptr<CIntElement> xc_swFrame;
public:
CRETimeChain(CRealElement* a, CRealElement* b, CIntElement* c)
: x4_a(a), x8_b(b), xc_swFrame(c) {}
CRETimeChain(std::unique_ptr<CRealElement>&& a, std::unique_ptr<CRealElement>&& b, std::unique_ptr<CIntElement>&& c)
: x4_a(std::move(a)), x8_b(std::move(b)), xc_swFrame(std::move(c)) {}
bool GetValue(int frame, float& valOut) const;
};
@ -57,8 +57,8 @@ class CREAdd : public CRealElement
std::unique_ptr<CRealElement> x4_a;
std::unique_ptr<CRealElement> x8_b;
public:
CREAdd(CRealElement* a, CRealElement* b)
: x4_a(a), x8_b(b) {}
CREAdd(std::unique_ptr<CRealElement>&& a, std::unique_ptr<CRealElement>&& b)
: x4_a(std::move(a)), x8_b(std::move(b)) {}
bool GetValue(int frame, float& valOut) const;
};
@ -68,8 +68,8 @@ class CREClamp : public CRealElement
std::unique_ptr<CRealElement> x8_max;
std::unique_ptr<CRealElement> xc_val;
public:
CREClamp(CRealElement* a, CRealElement* b, CRealElement* c)
: x4_min(a), x8_max(b), xc_val(c) {}
CREClamp(std::unique_ptr<CRealElement>&& a, std::unique_ptr<CRealElement>&& b, std::unique_ptr<CRealElement>&& c)
: x4_min(std::move(a)), x8_max(std::move(b)), xc_val(std::move(c)) {}
bool GetValue(int frame, float& valOut) const;
};
@ -78,8 +78,8 @@ class CREInitialRandom : public CRealElement
std::unique_ptr<CRealElement> x4_min;
std::unique_ptr<CRealElement> x8_max;
public:
CREInitialRandom(CRealElement* a, CRealElement* b)
: x4_min(a), x8_max(b) {}
CREInitialRandom(std::unique_ptr<CRealElement>&& a, std::unique_ptr<CRealElement>&& b)
: x4_min(std::move(a)), x8_max(std::move(b)) {}
bool GetValue(int frame, float& valOut) const;
bool IsConstant() const {return true;}
};
@ -89,8 +89,8 @@ class CRERandom : public CRealElement
std::unique_ptr<CRealElement> x4_min;
std::unique_ptr<CRealElement> x8_max;
public:
CRERandom(CRealElement* a, CRealElement* b)
: x4_min(a), x8_max(b) {}
CRERandom(std::unique_ptr<CRealElement>&& a, std::unique_ptr<CRealElement>&& b)
: x4_min(std::move(a)), x8_max(std::move(b)) {}
bool GetValue(int frame, float& valOut) const;
};
@ -99,8 +99,8 @@ class CREDotProduct : public CRealElement
std::unique_ptr<CVectorElement> x4_a;
std::unique_ptr<CVectorElement> x8_b;
public:
CREDotProduct(CVectorElement* a, CVectorElement* b)
: x4_a(a), x8_b(b) {}
CREDotProduct(std::unique_ptr<CVectorElement>&& a, std::unique_ptr<CVectorElement>&& b)
: x4_a(std::move(a)), x8_b(std::move(b)) {}
bool GetValue(int frame, float& valOut) const;
};
@ -109,8 +109,8 @@ class CREMultiply : public CRealElement
std::unique_ptr<CRealElement> x4_a;
std::unique_ptr<CRealElement> x8_b;
public:
CREMultiply(CRealElement* a, CRealElement* b)
: x4_a(a), x8_b(b) {}
CREMultiply(std::unique_ptr<CRealElement>&& a, std::unique_ptr<CRealElement>&& b)
: x4_a(std::move(a)), x8_b(std::move(b)) {}
bool GetValue(int frame, float& valOut) const;
};
@ -121,8 +121,9 @@ class CREPulse : public CRealElement
std::unique_ptr<CRealElement> xc_valA;
std::unique_ptr<CRealElement> x10_valB;
public:
CREPulse(CIntElement* a, CIntElement* b, CRealElement* c, CRealElement* d)
: x4_aDuration(a), x8_bDuration(b), xc_valA(c), x10_valB(d) {}
CREPulse(std::unique_ptr<CIntElement>&& a, std::unique_ptr<CIntElement>&& b,
std::unique_ptr<CRealElement>&& c, std::unique_ptr<CRealElement>&& d)
: x4_aDuration(std::move(a)), x8_bDuration(std::move(b)), xc_valA(std::move(c)), x10_valB(std::move(d)) {}
bool GetValue(int frame, float& valOut) const;
};
@ -130,8 +131,8 @@ class CRETimeScale : public CRealElement
{
std::unique_ptr<CRealElement> x4_a;
public:
CRETimeScale(CRealElement* a)
: x4_a(a) {}
CRETimeScale(std::unique_ptr<CRealElement>&& a)
: x4_a(std::move(a)) {}
bool GetValue(int frame, float& valOut) const;
};
@ -139,8 +140,8 @@ class CRELifetimePercent : public CRealElement
{
std::unique_ptr<CRealElement> x4_percentVal;
public:
CRELifetimePercent(CRealElement* a)
: x4_percentVal(a) {}
CRELifetimePercent(std::unique_ptr<CRealElement>&& a)
: x4_percentVal(std::move(a)) {}
bool GetValue(int frame, float& valOut) const;
};
@ -150,8 +151,9 @@ class CRESineWave : public CRealElement
std::unique_ptr<CRealElement> x8_linearFrame;
std::unique_ptr<CRealElement> xc_constantFrame;
public:
CRESineWave(CRealElement* a, CRealElement* b, CRealElement* c)
: x4_magnitude(a), x8_linearFrame(b), xc_constantFrame(c) {}
CRESineWave(std::unique_ptr<CRealElement>&& a, std::unique_ptr<CRealElement>&& b,
std::unique_ptr<CRealElement>&& c)
: x4_magnitude(std::move(a)), x8_linearFrame(std::move(b)), xc_constantFrame(std::move(c)) {}
bool GetValue(int frame, float& valOut) const;
};
@ -160,8 +162,8 @@ class CREInitialSwitch : public CRealElement
std::unique_ptr<CRealElement> x4_a;
std::unique_ptr<CRealElement> x8_b;
public:
CREInitialSwitch(CRealElement* a, CRealElement* b)
: x4_a(a), x8_b(b) {}
CREInitialSwitch(std::unique_ptr<CRealElement>&& a, std::unique_ptr<CRealElement>&& b)
: x4_a(std::move(a)), x8_b(std::move(b)) {}
bool GetValue(int frame, float& valOut) const;
};
@ -172,8 +174,9 @@ class CRECompareLessThan : public CRealElement
std::unique_ptr<CRealElement> xc_c;
std::unique_ptr<CRealElement> x10_d;
public:
CRECompareLessThan(CRealElement* a, CRealElement* b, CRealElement* c, CRealElement* d)
: x4_a(a), x8_b(b), xc_c(c), x10_d(d) {}
CRECompareLessThan(std::unique_ptr<CRealElement>&& a, std::unique_ptr<CRealElement>&& b,
std::unique_ptr<CRealElement>&& c, std::unique_ptr<CRealElement>&& d)
: x4_a(std::move(a)), x8_b(std::move(b)), xc_c(std::move(c)), x10_d(std::move(d)) {}
bool GetValue(int frame, float& valOut) const;
};
@ -184,8 +187,9 @@ class CRECompareEquals : public CRealElement
std::unique_ptr<CRealElement> xc_c;
std::unique_ptr<CRealElement> x10_d;
public:
CRECompareEquals(CRealElement* a, CRealElement* b, CRealElement* c, CRealElement* d)
: x4_a(a), x8_b(b), xc_c(c), x10_d(d) {}
CRECompareEquals(std::unique_ptr<CRealElement>&& a, std::unique_ptr<CRealElement>&& b,
std::unique_ptr<CRealElement>&& c, std::unique_ptr<CRealElement>&& d)
: x4_a(std::move(a)), x8_b(std::move(b)), xc_c(std::move(c)), x10_d(std::move(d)) {}
bool GetValue(int frame, float& valOut) const;
};
@ -254,8 +258,8 @@ class CRESubtract : public CRealElement
std::unique_ptr<CRealElement> x4_a;
std::unique_ptr<CRealElement> x8_b;
public:
CRESubtract(CRealElement* a, CRealElement* b)
: x4_a(a), x8_b(b) {}
CRESubtract(std::unique_ptr<CRealElement>&& a, std::unique_ptr<CRealElement>&& b)
: x4_a(std::move(a)), x8_b(std::move(b)) {}
bool GetValue(int frame, float& valOut) const;
};
@ -263,8 +267,8 @@ class CREVectorMagnitude : public CRealElement
{
std::unique_ptr<CVectorElement> x4_a;
public:
CREVectorMagnitude(CVectorElement* a)
: x4_a(a) {}
CREVectorMagnitude(std::unique_ptr<CVectorElement>&& a)
: x4_a(std::move(a)) {}
bool GetValue(int frame, float& valOut) const;
};
@ -272,8 +276,8 @@ class CREVectorXToReal : public CRealElement
{
std::unique_ptr<CVectorElement> x4_a;
public:
CREVectorXToReal(CVectorElement* a)
: x4_a(a) {}
CREVectorXToReal(std::unique_ptr<CVectorElement>&& a)
: x4_a(std::move(a)) {}
bool GetValue(int frame, float& valOut) const;
};
@ -281,8 +285,8 @@ class CREVectorYToReal : public CRealElement
{
std::unique_ptr<CVectorElement> x4_a;
public:
CREVectorYToReal(CVectorElement* a)
: x4_a(a) {}
CREVectorYToReal(std::unique_ptr<CVectorElement>&& a)
: x4_a(std::move(a)) {}
bool GetValue(int frame, float& valOut) const;
};
@ -290,8 +294,8 @@ class CREVectorZToReal : public CRealElement
{
std::unique_ptr<CVectorElement> x4_a;
public:
CREVectorZToReal(CVectorElement* a)
: x4_a(a) {}
CREVectorZToReal(std::unique_ptr<CVectorElement>&& a)
: x4_a(std::move(a)) {}
bool GetValue(int frame, float& valOut) const;
};
@ -299,8 +303,8 @@ class CRECEXT : public CRealElement
{
std::unique_ptr<CIntElement> x4_a;
public:
CRECEXT(CIntElement* a)
: x4_a(a) {}
CRECEXT(std::unique_ptr<CIntElement>&& a)
: x4_a(std::move(a)) {}
bool GetValue(int frame, float& valOut) const;
};
@ -309,8 +313,8 @@ class CREIntTimesReal : public CRealElement
std::unique_ptr<CIntElement> x4_a;
std::unique_ptr<CRealElement> x8_b;
public:
CREIntTimesReal(CIntElement* a, CRealElement* b)
: x4_a(a), x8_b(b) {}
CREIntTimesReal(std::unique_ptr<CIntElement>&& a, std::unique_ptr<CRealElement>&& b)
: x4_a(std::move(a)), x8_b(std::move(b)) {}
bool GetValue(int frame, float& valOut) const;
};
@ -322,8 +326,11 @@ class CREConstantRange : public CRealElement
std::unique_ptr<CRealElement> x10_inRange;
std::unique_ptr<CRealElement> x14_outOfRange;
public:
CREConstantRange(CRealElement* a, CRealElement* b, CRealElement* c, CRealElement* d, CRealElement* e)
: x4_val(a), x8_min(b), xc_max(c), x10_inRange(d), x14_outOfRange(e) {}
CREConstantRange(std::unique_ptr<CRealElement>&& a, std::unique_ptr<CRealElement>&& b,
std::unique_ptr<CRealElement>&& c, std::unique_ptr<CRealElement>&& d,
std::unique_ptr<CRealElement>&& e)
: x4_val(std::move(a)), x8_min(std::move(b)), xc_max(std::move(c)),
x10_inRange(std::move(d)), x14_outOfRange(std::move(e)) {}
bool GetValue(int frame, float& valOut) const;
};
@ -332,8 +339,8 @@ class CREGetComponentRed : public CRealElement
{
std::unique_ptr<CColorElement> x4_a;
public:
CREGetComponentRed(CColorElement* a)
: x4_a(a) {}
CREGetComponentRed(std::unique_ptr<CColorElement>&& a)
: x4_a(std::move(a)) {}
bool GetValue(int frame, float& valOut) const;
};
@ -342,8 +349,8 @@ class CREGetComponentGreen : public CRealElement
{
std::unique_ptr<CColorElement> x4_a;
public:
CREGetComponentGreen(CColorElement* a)
: x4_a(a) {}
CREGetComponentGreen(std::unique_ptr<CColorElement>&& a)
: x4_a(std::move(a)) {}
bool GetValue(int frame, float& valOut) const;
};
@ -352,8 +359,8 @@ class CREGetComponentBlue : public CRealElement
{
std::unique_ptr<CColorElement> x4_a;
public:
CREGetComponentBlue(CColorElement* a)
: x4_a(a) {}
CREGetComponentBlue(std::unique_ptr<CColorElement>&& a)
: x4_a(std::move(a)) {}
bool GetValue(int frame, float& valOut) const;
};
@ -362,8 +369,8 @@ class CREGetComponentAlpha : public CRealElement
{
std::unique_ptr<CColorElement> x4_a;
public:
CREGetComponentAlpha(CColorElement* a)
: x4_a(a) {}
CREGetComponentAlpha(std::unique_ptr<CColorElement>&& a)
: x4_a(std::move(a)) {}
bool GetValue(int frame, float& valOut) const;
};

View File

@ -5,18 +5,15 @@
namespace urde
{
CUVEAnimTexture::CUVEAnimTexture(TToken<CTexture>&& tex, CIntElement* a, CIntElement* b,
CIntElement* c, CIntElement* d, CIntElement* e, bool f)
: x4_tex(std::move(tex)), x24_loop(f), x28_cycleFrames(e)
CUVEAnimTexture::CUVEAnimTexture(TToken<CTexture>&& tex, std::unique_ptr<CIntElement>&& a,
std::unique_ptr<CIntElement>&& b, std::unique_ptr<CIntElement>&& c,
std::unique_ptr<CIntElement>&& d, std::unique_ptr<CIntElement>&& e, bool f)
: x4_tex(std::move(tex)), x24_loop(f), x28_cycleFrames(std::move(e))
{
a->GetValue(0, x10_tileW);
delete a;
b->GetValue(0, x14_tileH);
delete b;
c->GetValue(0, x18_strideW);
delete c;
d->GetValue(0, x1c_strideH);
delete d;
int width = x4_tex.GetObj()->GetWidth();
int height = x4_tex.GetObj()->GetHeight();

View File

@ -55,8 +55,9 @@ struct CUVEAnimTexture : public CUVElement
std::unique_ptr<CIntElement> x28_cycleFrames;
std::vector<SUVElementSet> x2c_uvElems;
public:
CUVEAnimTexture(TToken<CTexture>&& tex, CIntElement* a, CIntElement* b,
CIntElement* c, CIntElement* d, CIntElement* e, bool f);
CUVEAnimTexture(TToken<CTexture>&& tex, std::unique_ptr<CIntElement>&& a, std::unique_ptr<CIntElement>&& b,
std::unique_ptr<CIntElement>&& c, std::unique_ptr<CIntElement>&& d,
std::unique_ptr<CIntElement>&& e, bool f);
TLockedToken<CTexture> GetValueTexture(int frame) const
{
return TLockedToken<CTexture>(x4_tex);

View File

@ -61,8 +61,8 @@ bool CVEKeyframeEmitter::GetValue(int frame, zeus::CVector3f& valOut) const
return false;
}
CVECone::CVECone(CVectorElement* a, CRealElement* b)
: x4_direction(a), x8_magnitude(b)
CVECone::CVECone(std::unique_ptr<CVectorElement>&& a, std::unique_ptr<CRealElement>&& b)
: x4_direction(std::move(a)), x8_magnitude(std::move(b))
{
zeus::CVector3f av;
x4_direction->GetValue(0, av);
@ -136,8 +136,9 @@ bool CVEAdd::GetValue(int frame, zeus::CVector3f& valOut) const
return false;
}
CVECircleCluster::CVECircleCluster(CVectorElement* a, CVectorElement* b, CIntElement* c, CRealElement* d)
: x4_a(a), x24_magnitude(d)
CVECircleCluster::CVECircleCluster(std::unique_ptr<CVectorElement>&& a, std::unique_ptr<CVectorElement>&& b,
std::unique_ptr<CIntElement>&& c, std::unique_ptr<CRealElement>&& d)
: x4_a(std::move(a)), x24_magnitude(std::move(d))
{
int cv;
c->GetValue(0, cv);
@ -151,9 +152,6 @@ CVECircleCluster::CVECircleCluster(CVectorElement* a, CVectorElement* b, CIntEle
else
x8_xVec = bv.cross(zeus::CVector3f(1.f, 0.f, 0.f));
x14_yVec = bv.cross(x8_xVec);
delete b;
delete c;
}
bool CVECircleCluster::GetValue(int frame, zeus::CVector3f& valOut) const
@ -194,8 +192,11 @@ bool CVEFastConstant::GetValue(int frame, zeus::CVector3f& valOut) const
return false;
}
CVECircle::CVECircle(CVectorElement* a, CVectorElement* b, CRealElement* c, CRealElement* d, CRealElement* e)
: x4_direction(a), x20_angleConstant(c), x24_angleLinear(d), x28_radius(e)
CVECircle::CVECircle(std::unique_ptr<CVectorElement>&& a, std::unique_ptr<CVectorElement>&& b,
std::unique_ptr<CRealElement>&& c, std::unique_ptr<CRealElement>&& d,
std::unique_ptr<CRealElement>&& e)
: x4_direction(std::move(a)), x20_angleConstant(std::move(c)),
x24_angleLinear(std::move(d)), x28_radius(std::move(e))
{
zeus::CVector3f bv;
b->GetValue(0, bv);
@ -205,7 +206,6 @@ CVECircle::CVECircle(CVectorElement* a, CVectorElement* b, CRealElement* c, CRea
else
x8_xVec = bv.cross(zeus::CVector3f(1.f, 0.f, 0.f));
x14_yVec = bv.cross(x8_xVec);
delete b;
}
bool CVECircle::GetValue(int frame, zeus::CVector3f& valOut) const

View File

@ -29,7 +29,7 @@ class CVECone : public CVectorElement
zeus::CVector3f xc_xVec;
zeus::CVector3f x18_yVec;
public:
CVECone(CVectorElement* a, CRealElement* b);
CVECone(std::unique_ptr<CVectorElement>&& a, std::unique_ptr<CRealElement>&& b);
bool GetValue(int frame, zeus::CVector3f& valOut) const;
};
@ -39,8 +39,9 @@ class CVETimeChain : public CVectorElement
std::unique_ptr<CVectorElement> x8_b;
std::unique_ptr<CIntElement> xc_swFrame;
public:
CVETimeChain(CVectorElement* a, CVectorElement* b, CIntElement* c)
: x4_a(a), x8_b(b), xc_swFrame(c) {}
CVETimeChain(std::unique_ptr<CVectorElement>&& a, std::unique_ptr<CVectorElement>&& b,
std::unique_ptr<CIntElement>&& c)
: x4_a(std::move(a)), x8_b(std::move(b)), xc_swFrame(std::move(c)) {}
bool GetValue(int frame, zeus::CVector3f& valOut) const;
};
@ -52,8 +53,11 @@ class CVEAngleCone : public CVectorElement
std::unique_ptr<CRealElement> x10_angleYRange;
std::unique_ptr<CRealElement> x14_magnitude;
public:
CVEAngleCone(CRealElement* a, CRealElement* b, CRealElement* c, CRealElement* d, CRealElement* e)
: x4_angleXConstant(a), x8_angleYConstant(b), xc_angleXRange(c), x10_angleYRange(d), x14_magnitude(e) {}
CVEAngleCone(std::unique_ptr<CRealElement>&& a, std::unique_ptr<CRealElement>&& b,
std::unique_ptr<CRealElement>&& c, std::unique_ptr<CRealElement>&& d,
std::unique_ptr<CRealElement>&& e)
: x4_angleXConstant(std::move(a)), x8_angleYConstant(std::move(b)),
xc_angleXRange(std::move(c)), x10_angleYRange(std::move(d)), x14_magnitude(std::move(e)) {}
bool GetValue(int frame, zeus::CVector3f& valOut) const;
};
@ -62,8 +66,8 @@ class CVEAdd : public CVectorElement
std::unique_ptr<CVectorElement> x4_a;
std::unique_ptr<CVectorElement> x8_b;
public:
CVEAdd(CVectorElement* a, CVectorElement* b)
: x4_a(a), x8_b(b) {}
CVEAdd(std::unique_ptr<CVectorElement>&& a, std::unique_ptr<CVectorElement>&& b)
: x4_a(std::move(a)), x8_b(std::move(b)) {}
bool GetValue(int frame, zeus::CVector3f& valOut) const;
};
@ -75,7 +79,8 @@ class CVECircleCluster : public CVectorElement
float x20_deltaAngle;
std::unique_ptr<CRealElement> x24_magnitude;
public:
CVECircleCluster(CVectorElement* a, CVectorElement* b, CIntElement* c, CRealElement* d);
CVECircleCluster(std::unique_ptr<CVectorElement>&& a, std::unique_ptr<CVectorElement>&& b,
std::unique_ptr<CIntElement>&& c, std::unique_ptr<CRealElement>&& d);
bool GetValue(int frame, zeus::CVector3f& valOut) const;
};
@ -85,8 +90,8 @@ class CVEConstant : public CVectorElement
std::unique_ptr<CRealElement> x8_b;
std::unique_ptr<CRealElement> xc_c;
public:
CVEConstant(CRealElement* a, CRealElement* b, CRealElement* c)
: x4_a(a), x8_b(b), xc_c(c) {}
CVEConstant(std::unique_ptr<CRealElement>&& a, std::unique_ptr<CRealElement>&& b, std::unique_ptr<CRealElement>&& c)
: x4_a(std::move(a)), x8_b(std::move(b)), xc_c(std::move(c)) {}
bool GetValue(int frame, zeus::CVector3f& valOut) const;
};
@ -108,7 +113,9 @@ class CVECircle : public CVectorElement
std::unique_ptr<CRealElement> x24_angleLinear;
std::unique_ptr<CRealElement> x28_radius;
public:
CVECircle(CVectorElement* a, CVectorElement* b, CRealElement* c, CRealElement* d, CRealElement* e);
CVECircle(std::unique_ptr<CVectorElement>&& a, std::unique_ptr<CVectorElement>&& b,
std::unique_ptr<CRealElement>&& c, std::unique_ptr<CRealElement>&& d,
std::unique_ptr<CRealElement>&& e);
bool GetValue(int frame, zeus::CVector3f& valOut) const;
};
@ -117,8 +124,8 @@ class CVEMultiply : public CVectorElement
std::unique_ptr<CVectorElement> x4_a;
std::unique_ptr<CVectorElement> x8_b;
public:
CVEMultiply(CVectorElement* a, CVectorElement* b)
: x4_a(a), x8_b(b) {}
CVEMultiply(std::unique_ptr<CVectorElement>&& a, std::unique_ptr<CVectorElement>&& b)
: x4_a(std::move(a)), x8_b(std::move(b)) {}
bool GetValue(int frame, zeus::CVector3f& valOut) const;
};
@ -126,8 +133,8 @@ class CVERealToVector : public CVectorElement
{
std::unique_ptr<CRealElement> x4_a;
public:
CVERealToVector(CRealElement* a)
: x4_a(a) {}
CVERealToVector(std::unique_ptr<CRealElement>&& a)
: x4_a(std::move(a)) {}
bool GetValue(int frame, zeus::CVector3f& valOut) const;
};
@ -138,8 +145,9 @@ class CVEPulse : public CVectorElement
std::unique_ptr<CVectorElement> xc_aVal;
std::unique_ptr<CVectorElement> x10_bVal;
public:
CVEPulse(CIntElement* a, CIntElement* b, CVectorElement* c, CVectorElement* d)
: x4_aDuration(a), x8_bDuration(b), xc_aVal(c), x10_bVal(d) {}
CVEPulse(std::unique_ptr<CIntElement>&& a, std::unique_ptr<CIntElement>&& b,
std::unique_ptr<CVectorElement>&& c, std::unique_ptr<CVectorElement>&& d)
: x4_aDuration(std::move(a)), x8_bDuration(std::move(b)), xc_aVal(std::move(c)), x10_bVal(std::move(d)) {}
bool GetValue(int frame, zeus::CVector3f& valOut) const;
};
@ -190,8 +198,8 @@ class CVESubtract : public CVectorElement
std::unique_ptr<CVectorElement> x4_a;
std::unique_ptr<CVectorElement> x8_b;
public:
CVESubtract(CVectorElement* a, CVectorElement* b)
: x4_a(a), x8_b(b)
CVESubtract(std::unique_ptr<CVectorElement>&& a, std::unique_ptr<CVectorElement>&& b)
: x4_a(std::move(a)), x8_b(std::move(b))
{}
bool GetValue(int frame, zeus::CVector3f& valOut) const;
};
@ -200,8 +208,8 @@ class CVEColorToVector : public CVectorElement
{
std::unique_ptr<CColorElement> x4_a;
public:
CVEColorToVector(CColorElement* a)
: x4_a(a) {}
CVEColorToVector(std::unique_ptr<CColorElement>&& a)
: x4_a(std::move(a)) {}
bool GetValue(int frame, zeus::CVector3f& valOut) const;
};

View File

@ -35,4 +35,12 @@ void CEnvFxManager::AreaLoaded()
grid.x0_24_ = true;
}
void CEnvFxManager::Cleanup()
{
xb68_envRainSplashId = kInvalidUniqueId;
xb6a_ = false;
xb6c_ = 0;
xb70_ = 0;
}
}

View File

@ -64,6 +64,10 @@ class CEnvFxManager
float xb54_;
TLockedToken<CGenDescription> xb58_envRainSplash;
bool xb64_ = true;
TUniqueId xb68_envRainSplashId = kInvalidUniqueId;
bool xb6a_ = false;
u32 xb6c_ = 0;
u32 xb70_ = 0;
void SetupSnowTevs();
void SetupRainTevs();
@ -80,6 +84,7 @@ public:
void SetXB54(float f) { xb54_ = f; }
bool GetX24() const { return x24_; }
float GetRainMagnitude() const { return x30_rainMagnitude; }
void Cleanup();
};
}

View File

@ -1230,7 +1230,7 @@ void CGameArea::FillInStaticGeometry(bool textures)
++secIt;
}
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
CGraphicsCommitResources([&](boo::IGraphicsDataFactory::Context& ctx)
{
/* Shared geometry uniform buffer - one for normal render, one for shadow render */
for (int i=0 ; i<2 ; ++i)

View File

@ -60,7 +60,7 @@ void CScriptDock::Think(float dt, CStateManager& mgr)
else if (x264_dockState == EDockState::EnterNextArea)
{
CPlayer& player = mgr.GetPlayer();
if (HasPointCrossedDock(mgr, player.GetTransform().origin))
if (HasPointCrossedDock(mgr, player.GetTranslation()))
{
IGameArea::Dock* dock = mgr.WorldNC()->GetArea(mgr.GetNextAreaId())->DockNC(x25c_dock);
TAreaId aid = dock->GetConnectedAreaId(dock->GetReferenceCount());
@ -237,7 +237,7 @@ void CScriptDock::UpdateAreaActivateFlags(CStateManager& mgr)
bool CScriptDock::HasPointCrossedDock(const CStateManager& mgr, const zeus::CVector3f& point) const
{
const zeus::CPlane plane = GetPlane(mgr);
return (point.dot(plane.vec) < plane.d);
return (point.dot(plane.vec) >= plane.d);
}
void CScriptDock::AreaLoaded(CStateManager& mgr) { SetLoadConnected(mgr, x268_25_loadConnected); }

View File

@ -79,7 +79,14 @@ void CScriptDoor::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStat
{
if (x27e_partner2 != kInvalidUniqueId)
if (CEntity* ent = mgr.ObjectById(x27e_partner2))
{
static int RecDepth = 0;
if (RecDepth > 9)
printf("");
++RecDepth;
mgr.SendScriptMsg(ent, GetUniqueId(), EScriptObjectMessage::Close);
--RecDepth;
}
x2a8_26_isOpen = false;
SetDoorAnimation(EDoorAnimType::Close);
mgr.GetCameraManager()->GetBallCamera()->DoorClosing(GetUniqueId());
@ -277,6 +284,8 @@ void CScriptDoor::OpenDoor(TUniqueId uid, CStateManager& mgr)
x2a8_26_isOpen = true;
x2a8_25_wasOpen = true;
x2a8_27_conditionsMet = false;
x27c_partner1 = kInvalidUniqueId;
x27e_partner2 = kInvalidUniqueId;
if (const CScriptDoor* door = TCastToConstPtr<CScriptDoor>(mgr.GetObjectById(uid)))
x27c_partner1 = door->GetUniqueId();
@ -292,12 +301,13 @@ void CScriptDoor::OpenDoor(TUniqueId uid, CStateManager& mgr)
for (CEntity* ent : mgr.GetPlatformAndDoorObjectList())
{
TCastToConstPtr<CScriptDoor> door = ent;
if (!door || door->GetUniqueId() == GetUniqueId())
if (!door || door->GetUniqueId() == uid)
continue;
if(TCastToConstPtr<CScriptDock> dock2 = mgr.GetObjectById(door->x282_dockId))
if (TCastToConstPtr<CScriptDock> dock2 = mgr.GetObjectById(door->x282_dockId))
{
if (dock1->GetCurrentConnectedAreaId(mgr) == dock2->GetAreaId() && dock2->GetCurrentConnectedAreaId(mgr) == dock1->GetAreaId())
if (dock1->GetCurrentConnectedAreaId(mgr) == dock2->GetAreaId() &&
dock2->GetCurrentConnectedAreaId(mgr) == dock1->GetAreaId())
{
x27e_partner2 = door->GetUniqueId();
mgr.SendScriptMsg(ent, GetUniqueId(), EScriptObjectMessage::Open);

View File

@ -176,9 +176,6 @@ void CScriptSound::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CSta
break;
case EScriptObjectMessage::Play:
{
if (xc_editorId.id == 0x00000223)
printf("");
if (GetActive())
PlaySound(mgr);
}

2
hecl

@ -1 +1 @@
Subproject commit dc5348ad25f5dc7264fde4319e8cd4505fe23af1
Subproject commit c26f24fb90da308ef6428b3198522d13569df50d

@ -1 +1 @@
Subproject commit 326b5b4d2ff727f4836ca0a4467ab311cd239889
Subproject commit a709031d36f5556b5ef3646673fba5c984d1d45a