diff --git a/Editor/badging/Badging.cpp b/Editor/badging/Badging.cpp index 7fe44937e..307b1e8f8 100644 --- a/Editor/badging/Badging.cpp +++ b/Editor/badging/Badging.cpp @@ -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; diff --git a/Editor/icons/icons.cpp b/Editor/icons/icons.cpp index 4c3a2c0b9..fff516980 100644 --- a/Editor/icons/icons.cpp +++ b/Editor/icons/icons.cpp @@ -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, diff --git a/NESEmulator/CNESEmulator.cpp b/NESEmulator/CNESEmulator.cpp index dd08f3ddd..11661fa7f 100644 --- a/NESEmulator/CNESEmulator.cpp +++ b/NESEmulator/CNESEmulator.cpp @@ -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, diff --git a/NESEmulator/CNESShader.cpp b/NESEmulator/CNESShader.cpp index 70e6c0dd8..556c20d9f 100644 --- a/NESEmulator/CNESShader.cpp +++ b/NESEmulator/CNESShader.cpp @@ -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()) { diff --git a/Runtime/AutoMapper/CAutoMapper.cpp b/Runtime/AutoMapper/CAutoMapper.cpp index 353740cd2..04b727ec8 100644 --- a/Runtime/AutoMapper/CAutoMapper.cpp +++ b/Runtime/AutoMapper/CAutoMapper.cpp @@ -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)) diff --git a/Runtime/AutoMapper/CMapArea.cpp b/Runtime/AutoMapper/CMapArea.cpp index ad07ee226..691ebe662 100644 --- a/Runtime/AutoMapper/CMapArea.cpp +++ b/Runtime/AutoMapper/CMapArea.cpp @@ -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); } } } diff --git a/Runtime/AutoMapper/CMappableObject.cpp b/Runtime/AutoMapper/CMappableObject.cpp index 2b414f43d..ea607ea73 100644 --- a/Runtime/AutoMapper/CMappableObject.cpp +++ b/Runtime/AutoMapper/CMappableObject.cpp @@ -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); diff --git a/Runtime/AutoMapper/CMappableObject.hpp b/Runtime/AutoMapper/CMappableObject.hpp index bf0ae03e8..df58363b0 100644 --- a/Runtime/AutoMapper/CMappableObject.hpp +++ b/Runtime/AutoMapper/CMappableObject.hpp @@ -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 m_doorSurface; diff --git a/Runtime/CSimplePool.cpp b/Runtime/CSimplePool.cpp index 370bbcc24..61c368b77 100644 --- a/Runtime/CSimplePool.cpp +++ b/Runtime/CSimplePool.cpp @@ -9,6 +9,11 @@ CSimplePool::CSimplePool(IFactory& factory) : x18_factory(factory), x1c_paramXfer(new TObjOwnerParam(this)) {} +CSimplePool::~CSimplePool() +{ + assert(x8_resources.empty() && "Dangling CSimplePool resources detected"); +} + CToken CSimplePool::GetObj(const SObjectTag& tag, const CVParamTransfer& paramXfer) { if (!tag) diff --git a/Runtime/CSimplePool.hpp b/Runtime/CSimplePool.hpp index 12082600b..7e6dffaee 100644 --- a/Runtime/CSimplePool.hpp +++ b/Runtime/CSimplePool.hpp @@ -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); diff --git a/Runtime/CStateManager.cpp b/Runtime/CStateManager.cpp index 3f8cdebbb..7a29a6875 100644 --- a/Runtime/CStateManager.cpp +++ b/Runtime/CStateManager.cpp @@ -217,6 +217,25 @@ CStateManager::CStateManager(const std::weak_ptr& 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()(ent); + } + ClearGraveyard(); + x84c_player->AcceptScriptMsg(EScriptObjectMessage::Deleted, kInvalidUniqueId, *this); + RemoveObject(x84c_player->GetUniqueId()); + x84c_player.reset(); + CCollisionPrimitive::Uninitialize(); g_StateManager = nullptr; } @@ -2207,8 +2226,7 @@ void CStateManager::ClearGraveyard() { CEntity* ent = GetAllObjectList().GetValidObjectById(id); RemoveObject(id); - if (ent) - std::default_delete()(ent); + std::default_delete()(ent); } x854_objectGraveyard.clear(); } diff --git a/Runtime/CToken.hpp b/Runtime/CToken.hpp index 9f7020544..93fb76fbb 100644 --- a/Runtime/CToken.hpp +++ b/Runtime/CToken.hpp @@ -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(); }; diff --git a/Runtime/Graphics/CBooRenderer.cpp b/Runtime/Graphics/CBooRenderer.cpp index efd210aec..70bc18b8e 100644 --- a/Runtime/Graphics/CBooRenderer.cpp +++ b/Runtime/Graphics/CBooRenderer.cpp @@ -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); diff --git a/Runtime/Graphics/CGraphics.hpp b/Runtime/Graphics/CGraphics.hpp index 8f039f987..3bcc5acd0 100644 --- a/Runtime/Graphics/CGraphics.hpp +++ b/Runtime/Graphics/CGraphics.hpp @@ -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& binding) { g_BooMainCommandQueue->setShaderDataBinding(binding); diff --git a/Runtime/Graphics/CLineRenderer.cpp b/Runtime/Graphics/CLineRenderer.cpp index 73a0a98c2..f6273493e 100644 --- a/Runtime/Graphics/CLineRenderer.cpp +++ b/Runtime/Graphics/CLineRenderer.cpp @@ -25,7 +25,7 @@ hecl::UniformBufferPool CLineRenderer::s_uniformPoo CLineRenderer::CLineRenderer(boo::IGraphicsDataFactory::Context& ctx, EPrimitiveMode mode, u32 maxVerts, const boo::ObjToken& 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& 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; }); } diff --git a/Runtime/Graphics/CLineRenderer.hpp b/Runtime/Graphics/CLineRenderer.hpp index 9b2e80e90..a82d1a46b 100644 --- a/Runtime/Graphics/CLineRenderer.hpp +++ b/Runtime/Graphics/CLineRenderer.hpp @@ -74,9 +74,9 @@ public: CLineRenderer(boo::IGraphicsDataFactory::Context& ctx, EPrimitiveMode mode, u32 maxVerts, const boo::ObjToken& texture, - bool additive, bool zTest = false); + bool additive, bool zTest = false, bool zGEqual = false); CLineRenderer(EPrimitiveMode mode, u32 maxVerts, const boo::ObjToken& texture, - bool additive, bool zTest = false); + bool additive, bool zTest = false, bool zGEqual = false); CLineRenderer(CLineRenderer&&) = default; void Reset(); diff --git a/Runtime/Graphics/CModel.hpp b/Runtime/Graphics/CModel.hpp index 571b99465..1e086ddc4 100644 --- a/Runtime/Graphics/CModel.hpp +++ b/Runtime/Graphics/CModel.hpp @@ -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 x8_surfaces; std::vector x18_matSets; std::unique_ptr x28_modelInst; - CModel* x30_next = nullptr; - CModel* x34_prev = nullptr; + //CModel* x30_next = nullptr; + //CModel* x34_prev = nullptr; int x38_lastFrame; /* urde addition: boo! */ diff --git a/Runtime/Graphics/CModelBoo.cpp b/Runtime/Graphics/CModelBoo.cpp index 492933d59..7fcaf0886 100644 --- a/Runtime/Graphics/CModelBoo.cpp +++ b/Runtime/Graphics/CModelBoo.cpp @@ -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 geomUniformBuf; @@ -1197,8 +1202,8 @@ std::unique_ptr CModel::MakeNewInstance(int shaderIdx, int subInsts, if (shaderIdx >= x18_matSets.size()) shaderIdx = 0; auto ret = std::make_unique(m_selfToken, this, &x8_surfaces, x18_matSets[shaderIdx], - m_staticVtxFmt, m_staticVbo, m_ibo, - m_aabb, (m_flags & 0x2) != 0, subInsts, txtrOverrides); + m_staticVtxFmt, m_staticVbo, m_ibo, + m_aabb, (m_flags & 0x2) != 0, subInsts, txtrOverrides); if (lockParent) ret->LockParent(); return ret; @@ -1275,7 +1280,7 @@ CModel::CModel(std::unique_ptr&& 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) diff --git a/Runtime/Graphics/CMoviePlayer.cpp b/Runtime/Graphics/CMoviePlayer.cpp index 4231c8079..1b8c7dde2 100644 --- a/Runtime/Graphics/CMoviePlayer.cpp +++ b/Runtime/Graphics/CMoviePlayer.cpp @@ -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); diff --git a/Runtime/Graphics/CRainSplashGenerator.cpp b/Runtime/Graphics/CRainSplashGenerator.cpp index 6c10b51fb..5a776f488 100644 --- a/Runtime/Graphics/CRainSplashGenerator.cpp +++ b/Runtime/Graphics/CRainSplashGenerator.cpp @@ -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 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(data)); const u8* paletteTexels = reinterpret_cast(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(); diff --git a/Runtime/Graphics/Shaders/CAABoxShader.cpp b/Runtime/Graphics/Shaders/CAABoxShader.cpp index c28ddbd97..d51cb2d83 100644 --- a/Runtime/Graphics/Shaders/CAABoxShader.cpp +++ b/Runtime/Graphics/Shaders/CAABoxShader.cpp @@ -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); diff --git a/Runtime/Graphics/Shaders/CCameraBlurFilter.cpp b/Runtime/Graphics/Shaders/CCameraBlurFilter.cpp index 695fe75c1..b2357ee34 100644 --- a/Runtime/Graphics/Shaders/CCameraBlurFilter.cpp +++ b/Runtime/Graphics/Shaders/CCameraBlurFilter.cpp @@ -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); diff --git a/Runtime/Graphics/Shaders/CColoredQuadFilter.cpp b/Runtime/Graphics/Shaders/CColoredQuadFilter.cpp index 57618323a..ae2f8f614 100644 --- a/Runtime/Graphics/Shaders/CColoredQuadFilter.cpp +++ b/Runtime/Graphics/Shaders/CColoredQuadFilter.cpp @@ -5,7 +5,7 @@ namespace urde CColoredQuadFilter::CColoredQuadFilter(EFilterType type) { - CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool + CGraphicsCommitResources([&](boo::IGraphicsDataFactory::Context& ctx) { struct Vert { diff --git a/Runtime/Graphics/Shaders/CEnergyBarShader.cpp b/Runtime/Graphics/Shaders/CEnergyBarShader.cpp index 5883779a3..832551b32 100644 --- a/Runtime/Graphics/Shaders/CEnergyBarShader.cpp +++ b/Runtime/Graphics/Shaders/CEnergyBarShader.cpp @@ -21,7 +21,7 @@ void CEnergyBarShader::draw(const zeus::CColor& color0, const std::vector 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& pipeline, u32 maxVertCount, bool door) { - CGraphics::CommitResources( + CGraphicsCommitResources( [&](boo::IGraphicsDataFactory::Context& ctx) { m_vbo = ctx.newDynamicBuffer(boo::BufferUse::Vertex, sizeof(Vertex), maxVertCount); diff --git a/Runtime/Graphics/Shaders/CFogVolumeFilter.cpp b/Runtime/Graphics/Shaders/CFogVolumeFilter.cpp index 0131f7f0d..ce93e2351 100644 --- a/Runtime/Graphics/Shaders/CFogVolumeFilter.cpp +++ b/Runtime/Graphics/Shaders/CFogVolumeFilter.cpp @@ -5,7 +5,7 @@ namespace urde CFogVolumeFilter::CFogVolumeFilter() { - CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool + CGraphicsCommitResources([&](boo::IGraphicsDataFactory::Context& ctx) { struct Vert { diff --git a/Runtime/Graphics/Shaders/CFogVolumePlaneShader.cpp b/Runtime/Graphics/Shaders/CFogVolumePlaneShader.cpp index 6ce615c81..62c68e0a0 100644 --- a/Runtime/Graphics/Shaders/CFogVolumePlaneShader.cpp +++ b/Runtime/Graphics/Shaders/CFogVolumePlaneShader.cpp @@ -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::BuildShaderDataBinding(ctx, *this); diff --git a/Runtime/Graphics/Shaders/CLineRendererShaders.cpp b/Runtime/Graphics/Shaders/CLineRendererShaders.cpp index 22e047ef3..2b2001aef 100644 --- a/Runtime/Graphics/Shaders/CLineRendererShaders.cpp +++ b/Runtime/Graphics/Shaders/CLineRendererShaders.cpp @@ -15,6 +15,8 @@ boo::ObjToken CLineRendererShaders::m_texAdditiveZ; boo::ObjToken CLineRendererShaders::m_noTexAlphaZ; boo::ObjToken CLineRendererShaders::m_noTexAdditiveZ; +boo::ObjToken CLineRendererShaders::m_noTexAlphaZGEqual; + boo::ObjToken CLineRendererShaders::m_texVtxFmt; boo::ObjToken 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& texture, - bool additive, bool zTest) + bool additive, bool zTest, bool zGEqual) { boo::ObjToken pipeline; - if (zTest) + + if (zGEqual) + { + pipeline = m_noTexAlphaZGEqual; + } + else if (zTest) { if (texture) { diff --git a/Runtime/Graphics/Shaders/CLineRendererShaders.hpp b/Runtime/Graphics/Shaders/CLineRendererShaders.hpp index f7a4112cb..4849a6365 100644 --- a/Runtime/Graphics/Shaders/CLineRendererShaders.hpp +++ b/Runtime/Graphics/Shaders/CLineRendererShaders.hpp @@ -36,6 +36,8 @@ private: static boo::ObjToken m_noTexAlphaZ; static boo::ObjToken m_noTexAdditiveZ; + static boo::ObjToken m_noTexAlphaZGEqual; + static boo::ObjToken m_texVtxFmt; static boo::ObjToken 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& texture, bool additive, bool zTest); + const boo::ObjToken& texture, bool additive, bool zTest, + bool zGEqual); }; } diff --git a/Runtime/Graphics/Shaders/CLineRendererShadersGLSL.cpp b/Runtime/Graphics/Shaders/CLineRendererShadersGLSL.cpp index 578b7518a..8c182e17c 100644 --- a/Runtime/Graphics/Shaders/CLineRendererShadersGLSL.cpp +++ b/Runtime/Graphics/Shaders/CLineRendererShadersGLSL.cpp @@ -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 diff --git a/Runtime/Graphics/Shaders/CLineRendererShadersHLSL.cpp b/Runtime/Graphics/Shaders/CLineRendererShadersHLSL.cpp index f4897efde..bd9e31227 100644 --- a/Runtime/Graphics/Shaders/CLineRendererShadersHLSL.cpp +++ b/Runtime/Graphics/Shaders/CLineRendererShadersHLSL.cpp @@ -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; } diff --git a/Runtime/Graphics/Shaders/CLineRendererShadersMetal.cpp b/Runtime/Graphics/Shaders/CLineRendererShadersMetal.cpp index 9e5aa5b64..eac89dcd9 100644 --- a/Runtime/Graphics/Shaders/CLineRendererShadersMetal.cpp +++ b/Runtime/Graphics/Shaders/CLineRendererShadersMetal.cpp @@ -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; } diff --git a/Runtime/Graphics/Shaders/CMapSurfaceShaderGLSL.cpp b/Runtime/Graphics/Shaders/CMapSurfaceShaderGLSL.cpp index ea284ea2f..917616114 100644 --- a/Runtime/Graphics/Shaders/CMapSurfaceShaderGLSL.cpp +++ b/Runtime/Graphics/Shaders/CMapSurfaceShaderGLSL.cpp @@ -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; } diff --git a/Runtime/Graphics/Shaders/CModelShaders.hpp b/Runtime/Graphics/Shaders/CModelShaders.hpp index 6d1805d68..4a3ed5f52 100644 --- a/Runtime/Graphics/Shaders/CModelShaders.hpp +++ b/Runtime/Graphics/Shaders/CModelShaders.hpp @@ -32,7 +32,8 @@ enum EExtendedShader : uint8_t ForcedAlphaNoZWrite, ForcedAdditiveNoZWrite, ForcedAlphaNoCullNoZWrite, - ForcedAdditiveNoCullNoZWrite + ForcedAdditiveNoCullNoZWrite, + DepthGEqualNoZWrite }; class CModelShaders diff --git a/Runtime/Graphics/Shaders/CModelShadersGLSL.cpp b/Runtime/Graphics/Shaders/CModelShadersGLSL.cpp index 35746497d..36fefdb91 100644 --- a/Runtime/Graphics/Shaders/CModelShadersGLSL.cpp +++ b/Runtime/Graphics/Shaders/CModelShadersGLSL.cpp @@ -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; } diff --git a/Runtime/Graphics/Shaders/CModelShadersHLSL.cpp b/Runtime/Graphics/Shaders/CModelShadersHLSL.cpp index 84f73354c..218432dbd 100644 --- a/Runtime/Graphics/Shaders/CModelShadersHLSL.cpp +++ b/Runtime/Graphics/Shaders/CModelShadersHLSL.cpp @@ -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; } diff --git a/Runtime/Graphics/Shaders/CModelShadersMetal.cpp b/Runtime/Graphics/Shaders/CModelShadersMetal.cpp index a5b1bf9fc..da8483124 100644 --- a/Runtime/Graphics/Shaders/CModelShadersMetal.cpp +++ b/Runtime/Graphics/Shaders/CModelShadersMetal.cpp @@ -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; } diff --git a/Runtime/Graphics/Shaders/CPhazonSuitFilter.cpp b/Runtime/Graphics/Shaders/CPhazonSuitFilter.cpp index da5f97e4d..d0412f8a4 100644 --- a/Runtime/Graphics/Shaders/CPhazonSuitFilter.cpp +++ b/Runtime/Graphics/Shaders/CPhazonSuitFilter.cpp @@ -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); diff --git a/Runtime/Graphics/Shaders/CRadarPaintShader.cpp b/Runtime/Graphics/Shaders/CRadarPaintShader.cpp index fb12b41e3..244b4a8a6 100644 --- a/Runtime/Graphics/Shaders/CRadarPaintShader.cpp +++ b/Runtime/Graphics/Shaders/CRadarPaintShader.cpp @@ -12,7 +12,7 @@ void CRadarPaintShader::draw(const std::vector& 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); diff --git a/Runtime/Graphics/Shaders/CRandomStaticFilter.cpp b/Runtime/Graphics/Shaders/CRandomStaticFilter.cpp index 1b4e2f695..71d8ef3dd 100644 --- a/Runtime/Graphics/Shaders/CRandomStaticFilter.cpp +++ b/Runtime/Graphics/Shaders/CRandomStaticFilter.cpp @@ -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 { diff --git a/Runtime/Graphics/Shaders/CScanLinesFilter.cpp b/Runtime/Graphics/Shaders/CScanLinesFilter.cpp index d63a19c00..c402188d0 100644 --- a/Runtime/Graphics/Shaders/CScanLinesFilter.cpp +++ b/Runtime/Graphics/Shaders/CScanLinesFilter.cpp @@ -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::BuildShaderDataBinding(ctx, type, *this); diff --git a/Runtime/Graphics/Shaders/CSpaceWarpFilter.cpp b/Runtime/Graphics/Shaders/CSpaceWarpFilter.cpp index 3546dfc10..89e50d8fb 100644 --- a/Runtime/Graphics/Shaders/CSpaceWarpFilter.cpp +++ b/Runtime/Graphics/Shaders/CSpaceWarpFilter.cpp @@ -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 diff --git a/Runtime/Graphics/Shaders/CTexturedQuadFilter.cpp b/Runtime/Graphics/Shaders/CTexturedQuadFilter.cpp index ba8798ece..13b4c77ad 100644 --- a/Runtime/Graphics/Shaders/CTexturedQuadFilter.cpp +++ b/Runtime/Graphics/Shaders/CTexturedQuadFilter.cpp @@ -15,7 +15,7 @@ CTexturedQuadFilter::CTexturedQuadFilter(EFilterType type, const boo::ObjTokenplatform() == 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& 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); diff --git a/Runtime/Graphics/Shaders/CThermalColdFilter.cpp b/Runtime/Graphics/Shaders/CThermalColdFilter.cpp index b9776b785..7d2d588e6 100644 --- a/Runtime/Graphics/Shaders/CThermalColdFilter.cpp +++ b/Runtime/Graphics/Shaders/CThermalColdFilter.cpp @@ -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); diff --git a/Runtime/Graphics/Shaders/CThermalHotFilter.cpp b/Runtime/Graphics/Shaders/CThermalHotFilter.cpp index e4be7be84..e169ae46c 100644 --- a/Runtime/Graphics/Shaders/CThermalHotFilter.cpp +++ b/Runtime/Graphics/Shaders/CThermalHotFilter.cpp @@ -6,7 +6,7 @@ namespace urde CThermalHotFilter::CThermalHotFilter() { - CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool + CGraphicsCommitResources([&](boo::IGraphicsDataFactory::Context& ctx) { struct Vert { diff --git a/Runtime/Graphics/Shaders/CWorldShadowShader.cpp b/Runtime/Graphics/Shaders/CWorldShadowShader.cpp index 35e0ec8de..9cda80c2a 100644 --- a/Runtime/Graphics/Shaders/CWorldShadowShader.cpp +++ b/Runtime/Graphics/Shaders/CWorldShadowShader.cpp @@ -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); diff --git a/Runtime/Graphics/Shaders/CXRayBlurFilter.cpp b/Runtime/Graphics/Shaders/CXRayBlurFilter.cpp index 51c519713..819bfbb70 100644 --- a/Runtime/Graphics/Shaders/CXRayBlurFilter.cpp +++ b/Runtime/Graphics/Shaders/CXRayBlurFilter.cpp @@ -9,7 +9,7 @@ namespace urde CXRayBlurFilter::CXRayBlurFilter(TLockedToken& tex) : m_paletteTex(tex), m_booTex(tex->GetPaletteTexture()) { - CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool + CGraphicsCommitResources([&](boo::IGraphicsDataFactory::Context& ctx) { struct Vert { diff --git a/Runtime/Graphics/Shaders/TMultiBlendShader.hpp b/Runtime/Graphics/Shaders/TMultiBlendShader.hpp index 67b080868..752e9e9ce 100644 --- a/Runtime/Graphics/Shaders/TMultiBlendShader.hpp +++ b/Runtime/Graphics/Shaders/TMultiBlendShader.hpp @@ -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()) { diff --git a/Runtime/Graphics/Shaders/TShader.hpp b/Runtime/Graphics/Shaders/TShader.hpp index 033a839a0..5a9aa9be5 100644 --- a/Runtime/Graphics/Shaders/TShader.hpp +++ b/Runtime/Graphics/Shaders/TShader.hpp @@ -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()) { diff --git a/Runtime/GuiSys/CCompoundTargetReticle.cpp b/Runtime/GuiSys/CCompoundTargetReticle.cpp index 5f4aeac63..16196584b 100644 --- a/Runtime/GuiSys/CCompoundTargetReticle.cpp +++ b/Runtime/GuiSys/CCompoundTargetReticle.cpp @@ -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) { diff --git a/Runtime/GuiSys/CTextRenderBuffer.cpp b/Runtime/GuiSys/CTextRenderBuffer.cpp index ba7519fa1..1dd52ae77 100644 --- a/Runtime/GuiSys/CTextRenderBuffer.cpp +++ b/Runtime/GuiSys/CTextRenderBuffer.cpp @@ -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(); diff --git a/Runtime/Input/CRumbleManager.hpp b/Runtime/Input/CRumbleManager.hpp index 630781177..9cdcaa4a0 100644 --- a/Runtime/Input/CRumbleManager.hpp +++ b/Runtime/Input/CRumbleManager.hpp @@ -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); }; diff --git a/Runtime/MP1/CFrontEndUI.cpp b/Runtime/MP1/CFrontEndUI.cpp index d68e0e8a0..ed6f813f3 100644 --- a/Runtime/MP1/CFrontEndUI.cpp +++ b/Runtime/MP1/CFrontEndUI.cpp @@ -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(); diff --git a/Runtime/MP1/CMFGame.cpp b/Runtime/MP1/CMFGame.cpp index 25ca92cc0..e69b23e20 100644 --- a/Runtime/MP1/CMFGame.cpp +++ b/Runtime/MP1/CMFGame.cpp @@ -319,6 +319,8 @@ CMFGameLoader::CMFGameLoader() : CMFGameLoaderBase("CMFGameLoader") } } +CMFGameLoader::~CMFGameLoader() {} + static const char* LoadDepPAKs[] = { "TestAnim", diff --git a/Runtime/MP1/CMFGame.hpp b/Runtime/MP1/CMFGame.hpp index 69dc2b337..ae0dcebd6 100644 --- a/Runtime/MP1/CMFGame.hpp +++ b/Runtime/MP1/CMFGame.hpp @@ -83,6 +83,7 @@ class CMFGameLoader : public CMFGameLoaderBase public: CMFGameLoader(); + ~CMFGameLoader(); EMessageReturn OnMessage(const CArchitectureMessage& msg, CArchitectureQueue& queue); void Draw() const; }; diff --git a/Runtime/MP1/MP1.cpp b/Runtime/MP1/MP1.cpp index 187d90e0e..4e7eefe55 100644 --- a/Runtime/MP1/MP1.cpp +++ b/Runtime/MP1/MP1.cpp @@ -785,6 +785,7 @@ void CMain::Shutdown() CNESShader::Shutdown(); CGraphics::ShutdownBoo(); ShutdownDiscord(); + CBooModel::AssertAllFreed(); } boo::IWindow* CMain::GetMainWindow() const diff --git a/Runtime/Particle/CColorElement.hpp b/Runtime/Particle/CColorElement.hpp index 38bd877f5..35404268f 100644 --- a/Runtime/Particle/CColorElement.hpp +++ b/Runtime/Particle/CColorElement.hpp @@ -29,8 +29,9 @@ class CCEConstant : public CColorElement std::unique_ptr xc_c; std::unique_ptr 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&& a, std::unique_ptr&& b, + std::unique_ptr&& c, std::unique_ptr&& 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 x8_b; std::unique_ptr xc_swFrame; public: - CCETimeChain(CColorElement* a, CColorElement* b, CIntElement* c) - : x4_a(a), x8_b(b), xc_swFrame(c) {} + CCETimeChain(std::unique_ptr&& a, std::unique_ptr&& b, + std::unique_ptr&& 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 xc_startFrame; std::unique_ptr 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&& a, std::unique_ptr&& b, + std::unique_ptr&& c, std::unique_ptr&& 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 x8_b; std::unique_ptr xc_endFrame; public: - CCEFade(CColorElement* a, CColorElement* b, CRealElement* c) - : x4_a(a), x8_b(b), xc_endFrame(c) {} + CCEFade(std::unique_ptr&& a, std::unique_ptr&& b, + std::unique_ptr&& 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 xc_aVal; std::unique_ptr 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&& a, std::unique_ptr&& b, + std::unique_ptr&& c, std::unique_ptr&& 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; }; diff --git a/Runtime/Particle/CDecal.cpp b/Runtime/Particle/CDecal.cpp index 40402c42f..3a8924524 100644 --- a/Runtime/Particle/CDecal.cpp +++ b/Runtime/Particle/CDecal.cpp @@ -32,7 +32,7 @@ CDecal::CDecal(const TToken& 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) { diff --git a/Runtime/Particle/CDecalDataFactory.cpp b/Runtime/Particle/CDecalDataFactory.cpp index 0c9273171..b6ce91945 100644 --- a/Runtime/Particle/CDecalDataFactory.cpp +++ b/Runtime/Particle/CDecalDataFactory.cpp @@ -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'): diff --git a/Runtime/Particle/CElementGen.cpp b/Runtime/Particle/CElementGen.cpp index b91f4b81e..6bd01eac4 100644 --- a/Runtime/Particle/CElementGen.cpp +++ b/Runtime/Particle/CElementGen.cpp @@ -234,7 +234,7 @@ CElementGen::CElementGen(const TToken& 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) { diff --git a/Runtime/Particle/CEmitterElement.hpp b/Runtime/Particle/CEmitterElement.hpp index 06ea201b2..1e46f6923 100644 --- a/Runtime/Particle/CEmitterElement.hpp +++ b/Runtime/Particle/CEmitterElement.hpp @@ -13,8 +13,8 @@ class CEESimpleEmitter : public CEmitterElement std::unique_ptr x4_loc; std::unique_ptr x8_vec; public: - CEESimpleEmitter(CVectorElement* a, CVectorElement* b) - : x4_loc(a), x8_vec(b) {} + CEESimpleEmitter(std::unique_ptr&& a, std::unique_ptr&& 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 x8_sphereRadius; std::unique_ptr xc_velocityMag; public: - CVESphere(CVectorElement* a, CRealElement* b, CRealElement* c) - : x4_sphereOrigin(a), x8_sphereRadius(b), xc_velocityMag(c) {} + CVESphere(std::unique_ptr&& a, std::unique_ptr&& b, + std::unique_ptr&& 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 x18_angleXRange; std::unique_ptr 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&& a, std::unique_ptr&& b, + std::unique_ptr&& c, std::unique_ptr&& d, + std::unique_ptr&& e, std::unique_ptr&& f, + std::unique_ptr&& 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; }; diff --git a/Runtime/Particle/CIntElement.hpp b/Runtime/Particle/CIntElement.hpp index 205475ff5..899ae32c3 100644 --- a/Runtime/Particle/CIntElement.hpp +++ b/Runtime/Particle/CIntElement.hpp @@ -27,8 +27,8 @@ class CIEDeath : public CIntElement std::unique_ptr x4_a; std::unique_ptr x8_b; public: - CIEDeath(CIntElement* a, CIntElement* b) - : x4_a(a), x8_b(b) {} + CIEDeath(std::unique_ptr&& a, std::unique_ptr&& 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 x8_max; std::unique_ptr xc_val; public: - CIEClamp(CIntElement* a, CIntElement* b, CIntElement* c) - : x4_min(a), x8_max(b), xc_val(c) {} + CIEClamp(std::unique_ptr&& a, std::unique_ptr&& b, std::unique_ptr&& 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 x8_b; std::unique_ptr xc_swFrame; public: - CIETimeChain(CIntElement* a, CIntElement* b, CIntElement* c) - : x4_a(a), x8_b(b), xc_swFrame(c) {} + CIETimeChain(std::unique_ptr&& a, std::unique_ptr&& b, std::unique_ptr&& 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 x4_a; std::unique_ptr x8_b; public: - CIEAdd(CIntElement* a, CIntElement* b) - : x4_a(a), x8_b(b) {} + CIEAdd(std::unique_ptr&& a, std::unique_ptr&& 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 x4_a; public: - CIEImpulse(CIntElement* a) - : x4_a(a) {} + CIEImpulse(std::unique_ptr&& a) + : x4_a(std::move(a)) {} bool GetValue(int frame, int& valOut) const; }; @@ -85,8 +85,8 @@ class CIELifetimePercent : public CIntElement { std::unique_ptr x4_percentVal; public: - CIELifetimePercent(CIntElement* a) - : x4_percentVal(a) {} + CIELifetimePercent(std::unique_ptr&& a) + : x4_percentVal(std::move(a)) {} bool GetValue(int frame, int& valOut) const; }; @@ -95,8 +95,8 @@ class CIEInitialRandom : public CIntElement std::unique_ptr x4_a; std::unique_ptr x8_b; public: - CIEInitialRandom(CIntElement* a, CIntElement* b) - : x4_a(a), x8_b(b) {} + CIEInitialRandom(std::unique_ptr&& a, std::unique_ptr&& 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 xc_aVal; std::unique_ptr 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&& a, std::unique_ptr&& b, + std::unique_ptr&& c, std::unique_ptr&& 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 x4_a; std::unique_ptr x8_b; public: - CIEMultiply(CIntElement* a, CIntElement* b) - : x4_a(a), x8_b(b) {} + CIEMultiply(std::unique_ptr&& a, std::unique_ptr&& 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 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&& a, std::unique_ptr&& b, + std::unique_ptr&& 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 x4_min; std::unique_ptr x8_max; public: - CIERandom(CIntElement* a, CIntElement* b) - : x4_min(a), x8_max(b) {} + CIERandom(std::unique_ptr&& a, std::unique_ptr&& 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 x4_a; public: - CIETimeScale(CRealElement* a) - : x4_a(a) {} + CIETimeScale(std::unique_ptr&& a) + : x4_a(std::move(a)) {} bool GetValue(int frame, int& valOut) const; }; @@ -177,8 +179,8 @@ class CIEModulo : public CIntElement std::unique_ptr x4_a; std::unique_ptr x8_b; public: - CIEModulo(CIntElement* a, CIntElement* b) - : x4_a(a), x8_b(b) {} + CIEModulo(std::unique_ptr&& a, std::unique_ptr&& 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 x4_a; std::unique_ptr x8_b; public: - CIESubtract(CIntElement* a, CIntElement* b) - : x4_a(a), x8_b(b) {} + CIESubtract(std::unique_ptr&& a, std::unique_ptr&& b) + : x4_a(std::move(a)), x8_b(std::move(b)) {} bool GetValue(int frame, int& valOut) const; }; diff --git a/Runtime/Particle/CModVectorElement.cpp b/Runtime/Particle/CModVectorElement.cpp index 25af85804..400510b4a 100644 --- a/Runtime/Particle/CModVectorElement.cpp +++ b/Runtime/Particle/CModVectorElement.cpp @@ -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&& a, std::unique_ptr&& b, + std::unique_ptr&& c, std::unique_ptr&& 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()) { diff --git a/Runtime/Particle/CModVectorElement.hpp b/Runtime/Particle/CModVectorElement.hpp index 89d7ef796..a24bd9c99 100644 --- a/Runtime/Particle/CModVectorElement.hpp +++ b/Runtime/Particle/CModVectorElement.hpp @@ -16,8 +16,10 @@ class CMVEImplosion : public CModVectorElement std::unique_ptr 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&& a, std::unique_ptr&& b, + std::unique_ptr&& c, std::unique_ptr&& 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 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&& a, std::unique_ptr&& b, + std::unique_ptr&& c, std::unique_ptr&& 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 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&& a, std::unique_ptr&& b, + std::unique_ptr&& c, std::unique_ptr&& 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 x8_b; std::unique_ptr xc_swFrame; public: - CMVETimeChain(CModVectorElement* a, CModVectorElement* b, CIntElement* c) - : x4_a(a), x8_b(b), xc_swFrame(c) {} + CMVETimeChain(std::unique_ptr&& a, std::unique_ptr&& b, + std::unique_ptr&& 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&& a, std::unique_ptr&& b, + std::unique_ptr&& c, std::unique_ptr&& 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 x8_y; std::unique_ptr xc_z; public: - CMVEConstant(CRealElement* a, CRealElement* b, CRealElement* c) - : x4_x(a), x8_y(b), xc_z(c) {} + CMVEConstant(std::unique_ptr&& a, std::unique_ptr&& b, + std::unique_ptr&& 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 x4_a; public: - CMVEGravity(CVectorElement* a) - : x4_a(a) {} + CMVEGravity(std::unique_ptr&& 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 x4_a; std::unique_ptr x8_b; public: - CMVEExplode(CRealElement* a, CRealElement* b) - : x4_a(a), x8_b(b) {} + CMVEExplode(std::unique_ptr&& a, std::unique_ptr&& 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 x4_a; public: - CMVESetPosition(CVectorElement* a) - : x4_a(a) {} + CMVESetPosition(std::unique_ptr&& 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 xc_aVal; std::unique_ptr 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&& a, std::unique_ptr&& b, + std::unique_ptr&& c, std::unique_ptr&& 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 x4_velocity; std::unique_ptr x8_factor; public: - CMVEWind(CVectorElement* a, CRealElement* b) - : x4_velocity(a), x8_factor(b) {} + CMVEWind(std::unique_ptr&& a, std::unique_ptr&& 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 xc_targetRadius; std::unique_ptr 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&& a, std::unique_ptr&& b, + std::unique_ptr&& c, std::unique_ptr&& 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; }; diff --git a/Runtime/Particle/CParticleDataFactory.cpp b/Runtime/Particle/CParticleDataFactory.cpp index 7c5591e02..7095d7227 100644 --- a/Runtime/Particle/CParticleDataFactory.cpp +++ b/Runtime/Particle/CParticleDataFactory.cpp @@ -47,14 +47,16 @@ SParticleModel CParticleDataFactory::GetModel(CInputStream& in, CSimplePool* res return {resPool->GetObj({FOURCC('CMDL'), id}), true}; } -SChildGeneratorDesc CParticleDataFactory::GetChildGeneratorDesc(CAssetId res, CSimplePool* resPool, const std::vector& tracker) +SChildGeneratorDesc CParticleDataFactory::GetChildGeneratorDesc(CAssetId res, CSimplePool* resPool, + const std::vector& tracker) { if (std::count(tracker.cbegin(), tracker.cend(), res) == 0) return {resPool->GetObj({FOURCC('PART'), res}), true}; return {}; } -SChildGeneratorDesc CParticleDataFactory::GetChildGeneratorDesc(CInputStream& in, CSimplePool* resPool, const std::vector& tracker) +SChildGeneratorDesc CParticleDataFactory::GetChildGeneratorDesc(CInputStream& in, CSimplePool* resPool, + const std::vector& tracker) { FourCC clsId = GetClassID(in); if (clsId == SBIG('NONE')) @@ -87,7 +89,7 @@ SElectricGeneratorDesc CParticleDataFactory::GetElectricGeneratorDesc(CInputStre return {resPool->GetObj({FOURCC('ELSC'), id}), true}; } -CUVElement* CParticleDataFactory::GetTextureElement(CInputStream& in, CSimplePool* resPool) +std::unique_ptr CParticleDataFactory::GetTextureElement(CInputStream& in, CSimplePool* resPool) { FourCC clsId = GetClassID(in); switch (clsId) @@ -99,7 +101,7 @@ CUVElement* CParticleDataFactory::GetTextureElement(CInputStream& in, CSimplePoo return nullptr; CAssetId id = in.readUint32Big(); TToken txtr = resPool->GetObj({FOURCC('TXTR'), id}); - return new CUVEConstant(std::move(txtr)); + return std::make_unique(std::move(txtr)); } case SBIG('ATEX'): { @@ -107,21 +109,22 @@ CUVElement* CParticleDataFactory::GetTextureElement(CInputStream& in, CSimplePoo if (subId == SBIG('NONE')) return nullptr; CAssetId id = in.readUint32Big(); - CIntElement* a = GetIntElement(in); - CIntElement* b = GetIntElement(in); - CIntElement* c = GetIntElement(in); - CIntElement* d = GetIntElement(in); - CIntElement* e = GetIntElement(in); + auto a = GetIntElement(in); + auto b = GetIntElement(in); + auto c = GetIntElement(in); + auto d = GetIntElement(in); + auto e = GetIntElement(in); bool f = GetBool(in); TToken txtr = resPool->GetObj({FOURCC('TXTR'), id}); - return new CUVEAnimTexture(std::move(txtr), a, b, c, d, e, f); + return std::make_unique(std::move(txtr), std::move(std::move(a)), std::move(b), std::move(c), + std::move(d), std::move(e), std::move(f)); } default: break; } return nullptr; } -CColorElement* CParticleDataFactory::GetColorElement(CInputStream& in) +std::unique_ptr CParticleDataFactory::GetColorElement(CInputStream& in) { FourCC clsId = GetClassID(in); switch (clsId) @@ -129,14 +132,14 @@ CColorElement* CParticleDataFactory::GetColorElement(CInputStream& in) case SBIG('KEYE'): case SBIG('KEYP'): { - return new CCEKeyframeEmitter(in); + return std::make_unique(in); } case SBIG('CNST'): { - CRealElement* a = GetRealElement(in); - CRealElement* b = GetRealElement(in); - CRealElement* c = GetRealElement(in); - CRealElement* d = GetRealElement(in); + auto a = GetRealElement(in); + auto b = GetRealElement(in); + auto c = GetRealElement(in); + auto d = GetRealElement(in); if (a->IsConstant() && b->IsConstant() && c->IsConstant() && d->IsConstant()) { float af, bf, cf, df; @@ -144,162 +147,163 @@ CColorElement* CParticleDataFactory::GetColorElement(CInputStream& in) b->GetValue(0, bf); c->GetValue(0, cf); d->GetValue(0, df); - return new CCEFastConstant(af, bf, cf, df); + return std::make_unique(af, bf, cf, df); } else { - return new CCEConstant(a, b, c, d); + return std::make_unique(std::move(std::move(a)), std::move(b), std::move(c), std::move(d)); } } case SBIG('CHAN'): { - CColorElement* a = GetColorElement(in); - CColorElement* b = GetColorElement(in); - CIntElement* c = GetIntElement(in); - return new CCETimeChain(a, b, c); + auto a = GetColorElement(in); + auto b = GetColorElement(in); + auto c = GetIntElement(in); + return std::make_unique(std::move(std::move(a)), std::move(b), std::move(c)); } case SBIG('CFDE'): { - CColorElement* a = GetColorElement(in); - CColorElement* b = GetColorElement(in); - CRealElement* c = GetRealElement(in); - CRealElement* d = GetRealElement(in); - return new CCEFadeEnd(a, b, c, d); + auto a = GetColorElement(in); + auto b = GetColorElement(in); + auto c = GetRealElement(in); + auto d = GetRealElement(in); + return std::make_unique(std::move(std::move(a)), std::move(b), std::move(c), std::move(d)); } case SBIG('FADE'): { - CColorElement* a = GetColorElement(in); - CColorElement* b = GetColorElement(in); - CRealElement* c = GetRealElement(in); - return new CCEFade(a, b, c); + auto a = GetColorElement(in); + auto b = GetColorElement(in); + auto c = GetRealElement(in); + return std::make_unique(std::move(std::move(a)), std::move(b), std::move(c)); } case SBIG('PULS'): { - CIntElement* a = GetIntElement(in); - CIntElement* b = GetIntElement(in); - CColorElement* c = GetColorElement(in); - CColorElement* d = GetColorElement(in); - return new CCEPulse(a, b, c, d); + auto a = GetIntElement(in); + auto b = GetIntElement(in); + auto c = GetColorElement(in); + auto d = GetColorElement(in); + return std::make_unique(std::move(std::move(a)), std::move(b), std::move(c), std::move(d)); } case SBIG('PCOL'): { - return new CCEParticleColor(); + return std::make_unique(); } default: break; } return nullptr; } -CModVectorElement* CParticleDataFactory::GetModVectorElement(CInputStream& in) +std::unique_ptr CParticleDataFactory::GetModVectorElement(CInputStream& in) { FourCC clsId = GetClassID(in); switch (clsId) { case SBIG('IMPL'): { - CVectorElement* a = GetVectorElement(in); - CRealElement* b = GetRealElement(in); - CRealElement* c = GetRealElement(in); - CRealElement* d = GetRealElement(in); + auto a = GetVectorElement(in); + auto b = GetRealElement(in); + auto c = GetRealElement(in); + auto d = GetRealElement(in); bool e = GetBool(in); - return new CMVEImplosion(a, b, c, d, e); + return std::make_unique(std::move(a), std::move(b), std::move(c), std::move(d), std::move(e)); } case SBIG('EMPL'): { - CVectorElement* a = GetVectorElement(in); - CRealElement* b = GetRealElement(in); - CRealElement* c = GetRealElement(in); - CRealElement* d = GetRealElement(in); + auto a = GetVectorElement(in); + auto b = GetRealElement(in); + auto c = GetRealElement(in); + auto d = GetRealElement(in); bool e = GetBool(in); - return new CMVEExponentialImplosion(a, b, c, d, e); + return std::make_unique(std::move(a), std::move(b), std::move(c), + std::move(d), std::move(e)); } case SBIG('CHAN'): { - CModVectorElement* a = GetModVectorElement(in); - CModVectorElement* b = GetModVectorElement(in); - CIntElement* c = GetIntElement(in); - return new CMVETimeChain(a, b, c); + auto a = GetModVectorElement(in); + auto b = GetModVectorElement(in); + auto c = GetIntElement(in); + return std::make_unique(std::move(a), std::move(b), std::move(c)); } case SBIG('BNCE'): { - CVectorElement* a = GetVectorElement(in); - CVectorElement* b = GetVectorElement(in); - CRealElement* c = GetRealElement(in); - CRealElement* d = GetRealElement(in); + auto a = GetVectorElement(in); + auto b = GetVectorElement(in); + auto c = GetRealElement(in); + auto d = GetRealElement(in); bool e = GetBool(in); - return new CMVEBounce(a, b, c, d, e); + return std::make_unique(std::move(a), std::move(b), std::move(c), std::move(d), std::move(e)); } case SBIG('CNST'): { - CRealElement* a = GetRealElement(in); - CRealElement* b = GetRealElement(in); - CRealElement* c = GetRealElement(in); + auto a = GetRealElement(in); + auto b = GetRealElement(in); + auto c = GetRealElement(in); if (a->IsConstant() && b->IsConstant() && c->IsConstant()) { float af, bf, cf; a->GetValue(0, af); b->GetValue(0, bf); c->GetValue(0, cf); - return new CMVEFastConstant(af, bf, cf); + return std::make_unique(af, bf, cf); } else { - return new CMVEConstant(a, b, c); + return std::make_unique(std::move(a), std::move(b), std::move(c)); } } case SBIG('GRAV'): { - CVectorElement* a = GetVectorElement(in); - return new CMVEGravity(a); + auto a = GetVectorElement(in); + return std::make_unique(std::move(a)); } case SBIG('EXPL'): { - CRealElement* a = GetRealElement(in); - CRealElement* b = GetRealElement(in); - return new CMVEExplode(a, b); + auto a = GetRealElement(in); + auto b = GetRealElement(in); + return std::make_unique(std::move(a), std::move(b)); } case SBIG('SPOS'): { - CVectorElement* a = GetVectorElement(in); - return new CMVESetPosition(a); + auto a = GetVectorElement(in); + return std::make_unique(std::move(a)); } case SBIG('LMPL'): { - CVectorElement* a = GetVectorElement(in); - CRealElement* b = GetRealElement(in); - CRealElement* c = GetRealElement(in); - CRealElement* d = GetRealElement(in); + auto a = GetVectorElement(in); + auto b = GetRealElement(in); + auto c = GetRealElement(in); + auto d = GetRealElement(in); bool e = GetBool(in); - return new CMVELinearImplosion(a, b, c, d, e); + return std::make_unique(std::move(a), std::move(b), std::move(c), std::move(d), std::move(e)); } case SBIG('PULS'): { - CIntElement* a = GetIntElement(in); - CIntElement* b = GetIntElement(in); - CModVectorElement* c = GetModVectorElement(in); - CModVectorElement* d = GetModVectorElement(in); - return new CMVEPulse(a, b, c, d); + auto a = GetIntElement(in); + auto b = GetIntElement(in); + auto c = GetModVectorElement(in); + auto d = GetModVectorElement(in); + return std::make_unique(std::move(a), std::move(b), std::move(c), std::move(d)); } case SBIG('WIND'): { - CVectorElement* a = GetVectorElement(in); - CRealElement* b = GetRealElement(in); - return new CMVEWind(a, b); + auto a = GetVectorElement(in); + auto b = GetRealElement(in); + return std::make_unique(std::move(a), std::move(b)); } case SBIG('SWRL'): { - CVectorElement* a = GetVectorElement(in); - CVectorElement* b = GetVectorElement(in); - CRealElement* c = GetRealElement(in); - CRealElement* d = GetRealElement(in); - return new CMVESwirl(a, b, c, d); + auto a = GetVectorElement(in); + auto b = GetVectorElement(in); + auto c = GetRealElement(in); + auto d = GetRealElement(in); + return std::make_unique(std::move(a), std::move(b), std::move(c), std::move(d)); } default: break; } return nullptr; } -CEmitterElement* CParticleDataFactory::GetEmitterElement(CInputStream& in) +std::unique_ptr CParticleDataFactory::GetEmitterElement(CInputStream& in) { FourCC clsId = GetClassID(in); switch (clsId) @@ -309,405 +313,406 @@ CEmitterElement* CParticleDataFactory::GetEmitterElement(CInputStream& in) FourCC prop = GetClassID(in); if (prop == SBIG('ILOC')) { - CVectorElement* a = GetVectorElement(in); + auto a = GetVectorElement(in); prop = GetClassID(in); if (prop == SBIG('IVEC')) { - CVectorElement* b = GetVectorElement(in); - return new CEESimpleEmitter(a, b); + auto b = GetVectorElement(in); + return std::make_unique(std::move(a), std::move(b)); } } return nullptr; } case SBIG('SEMR'): { - CVectorElement* a = GetVectorElement(in); - CVectorElement* b = GetVectorElement(in); - return new CEESimpleEmitter(a, b); + auto a = GetVectorElement(in); + auto b = GetVectorElement(in); + return std::make_unique(std::move(a), std::move(b)); } case SBIG('SPHE'): { - CVectorElement* a = GetVectorElement(in); - CRealElement* b = GetRealElement(in); - CRealElement* c = GetRealElement(in); - return new CVESphere(a, b, c); + auto a = GetVectorElement(in); + auto b = GetRealElement(in); + auto c = GetRealElement(in); + return std::make_unique(std::move(a), std::move(b), std::move(c)); } case SBIG('ASPH'): { - CVectorElement* a = GetVectorElement(in); - CRealElement* b = GetRealElement(in); - CRealElement* c = GetRealElement(in); - CRealElement* d = GetRealElement(in); - CRealElement* e = GetRealElement(in); - CRealElement* f = GetRealElement(in); - CRealElement* g = GetRealElement(in); - return new CVEAngleSphere(a, b, c, d, e, f, g); + auto a = GetVectorElement(in); + auto b = GetRealElement(in); + auto c = GetRealElement(in); + auto d = GetRealElement(in); + auto e = GetRealElement(in); + auto f = GetRealElement(in); + auto g = GetRealElement(in); + return std::make_unique(std::move(a), std::move(b), std::move(c), std::move(d), std::move(e), + std::move(f), std::move(g)); } default: break; } return nullptr; } -CVectorElement* CParticleDataFactory::GetVectorElement(CInputStream& in) +std::unique_ptr CParticleDataFactory::GetVectorElement(CInputStream& in) { FourCC clsId = GetClassID(in); switch (clsId) { case SBIG('CONE'): { - CVectorElement* a = GetVectorElement(in); - CRealElement* b = GetRealElement(in); - return new CVECone(a, b); + auto a = GetVectorElement(in); + auto b = GetRealElement(in); + return std::make_unique(std::move(a), std::move(b)); } case SBIG('CHAN'): { - CVectorElement* a = GetVectorElement(in); - CVectorElement* b = GetVectorElement(in); - CIntElement* c = GetIntElement(in); - return new CVETimeChain(a, b, c); + auto a = GetVectorElement(in); + auto b = GetVectorElement(in); + auto c = GetIntElement(in); + return std::make_unique(std::move(a), std::move(b), std::move(c)); } case SBIG('ANGC'): { - CRealElement* a = GetRealElement(in); - CRealElement* b = GetRealElement(in); - CRealElement* c = GetRealElement(in); - CRealElement* d = GetRealElement(in); - CRealElement* e = GetRealElement(in); - return new CVEAngleCone(a, b, c, d, e); + auto a = GetRealElement(in); + auto b = GetRealElement(in); + auto c = GetRealElement(in); + auto d = GetRealElement(in); + auto e = GetRealElement(in); + return std::make_unique(std::move(a), std::move(b), std::move(c), std::move(d), std::move(e)); } case SBIG('ADD_'): { - CVectorElement* a = GetVectorElement(in); - CVectorElement* b = GetVectorElement(in); - return new CVEAdd(a, b); + auto a = GetVectorElement(in); + auto b = GetVectorElement(in); + return std::make_unique(std::move(a), std::move(b)); } case SBIG('CCLU'): { - CVectorElement* a = GetVectorElement(in); - CVectorElement* b = GetVectorElement(in); - CIntElement* c = GetIntElement(in); - CRealElement* d = GetRealElement(in); - return new CVECircleCluster(a, b, c, d); + auto a = GetVectorElement(in); + auto b = GetVectorElement(in); + auto c = GetIntElement(in); + auto d = GetRealElement(in); + return std::make_unique(std::move(a), std::move(b), std::move(c), std::move(d)); } case SBIG('CNST'): { - CRealElement* a = GetRealElement(in); - CRealElement* b = GetRealElement(in); - CRealElement* c = GetRealElement(in); + auto a = GetRealElement(in); + auto b = GetRealElement(in); + auto c = GetRealElement(in); if (a->IsConstant() && b->IsConstant() && c->IsConstant()) { float af, bf, cf; a->GetValue(0, af); b->GetValue(0, bf); c->GetValue(0, cf); - return new CVEFastConstant(af, bf, cf); + return std::make_unique(af, bf, cf); } else { - return new CVEConstant(a, b, c); + return std::make_unique(std::move(a), std::move(b), std::move(c)); } } case SBIG('CIRC'): { - CVectorElement* a = GetVectorElement(in); - CVectorElement* b = GetVectorElement(in); - CRealElement* c = GetRealElement(in); - CRealElement* d = GetRealElement(in); - CRealElement* e = GetRealElement(in); - return new CVECircle(a, b, c, d, e); + auto a = GetVectorElement(in); + auto b = GetVectorElement(in); + auto c = GetRealElement(in); + auto d = GetRealElement(in); + auto e = GetRealElement(in); + return std::make_unique(std::move(a), std::move(b), std::move(c), std::move(d), std::move(e)); } case SBIG('KEYE'): case SBIG('KEYP'): { - return new CVEKeyframeEmitter(in); + return std::make_unique(in); } case SBIG('MULT'): { - CVectorElement* a = GetVectorElement(in); - CVectorElement* b = GetVectorElement(in); - return new CVEMultiply(a, b); + auto a = GetVectorElement(in); + auto b = GetVectorElement(in); + return std::make_unique(std::move(a), std::move(b)); } case SBIG('RTOV'): { - CRealElement* a = GetRealElement(in); - return new CVERealToVector(a); + auto a = GetRealElement(in); + return std::make_unique(std::move(a)); } case SBIG('PULS'): { - CIntElement* a = GetIntElement(in); - CIntElement* b = GetIntElement(in); - CVectorElement* c = GetVectorElement(in); - CVectorElement* d = GetVectorElement(in); - return new CVEPulse(a, b, c, d); + auto a = GetIntElement(in); + auto b = GetIntElement(in); + auto c = GetVectorElement(in); + auto d = GetVectorElement(in); + return std::make_unique(std::move(a), std::move(b), std::move(c), std::move(d)); } case SBIG('PVEL'): { - return new CVEParticleVelocity; + return std::make_unique(); } case SBIG('PLCO'): { - return new CVEParticleColor; + return std::make_unique(); } case SBIG('PLOC'): { - return new CVEParticleLocation; + return std::make_unique(); } case SBIG('PSOF'): { - return new CVEParticleSystemOrientationFront; + return std::make_unique(); } case SBIG('PSOU'): { - return new CVEParticleSystemOrientationUp; + return std::make_unique(); } case SBIG('PSOR'): { - return new CVEParticleSystemOrientationRight; + return std::make_unique(); } case SBIG('PSTR'): { - return new CVEParticleSystemTranslation; + return std::make_unique(); } case SBIG('SUB_'): { - CVectorElement* a = GetVectorElement(in); - CVectorElement* b = GetVectorElement(in); - return new CVESubtract(a, b); + auto a = GetVectorElement(in); + auto b = GetVectorElement(in); + return std::make_unique(std::move(a), std::move(b)); } case SBIG('CTVC'): { - CColorElement* a = GetColorElement(in); - return new CVEColorToVector(a); + auto a = GetColorElement(in); + return std::make_unique(std::move(a)); } default: break; } return nullptr; } -CRealElement* CParticleDataFactory::GetRealElement(CInputStream& in) +std::unique_ptr CParticleDataFactory::GetRealElement(CInputStream& in) { FourCC clsId = GetClassID(in); switch (clsId) { case SBIG('LFTW'): { - CRealElement* a = GetRealElement(in); - CRealElement* b = GetRealElement(in); - return new CRELifetimeTween(a, b); + auto a = GetRealElement(in); + auto b = GetRealElement(in); + return std::make_unique(std::move(a), std::move(b)); } case SBIG('CNST'): { float a = GetReal(in); - return new CREConstant(a); + return std::make_unique(std::move(a)); } case SBIG('CHAN'): { - CRealElement* a = GetRealElement(in); - CRealElement* b = GetRealElement(in); - CIntElement* c = GetIntElement(in); - return new CRETimeChain(a, b, c); + auto a = GetRealElement(in); + auto b = GetRealElement(in); + auto c = GetIntElement(in); + return std::make_unique(std::move(a), std::move(b), std::move(c)); } case SBIG('ADD_'): { - CRealElement* a = GetRealElement(in); - CRealElement* b = GetRealElement(in); - return new CREAdd(a, b); + auto a = GetRealElement(in); + auto b = GetRealElement(in); + return std::make_unique(std::move(a), std::move(b)); } case SBIG('CLMP'): { - CRealElement* a = GetRealElement(in); - CRealElement* b = GetRealElement(in); - CRealElement* c = GetRealElement(in); - return new CREClamp(a, b, c); + auto a = GetRealElement(in); + auto b = GetRealElement(in); + auto c = GetRealElement(in); + return std::make_unique(std::move(a), std::move(b), std::move(c)); } case SBIG('KEYE'): case SBIG('KEYP'): { - return new CREKeyframeEmitter(in); + return std::make_unique(in); } case SBIG('IRND'): { - CRealElement* a = GetRealElement(in); - CRealElement* b = GetRealElement(in); - return new CREInitialRandom(a, b); + auto a = GetRealElement(in); + auto b = GetRealElement(in); + return std::make_unique(std::move(a), std::move(b)); } case SBIG('RAND'): { - CRealElement* a = GetRealElement(in); - CRealElement* b = GetRealElement(in); - return new CRERandom(a, b); + auto a = GetRealElement(in); + auto b = GetRealElement(in); + return std::make_unique(std::move(a), std::move(b)); } case SBIG('DOTP'): { - CVectorElement* a = GetVectorElement(in); - CVectorElement* b = GetVectorElement(in); - return new CREDotProduct(a, b); + auto a = GetVectorElement(in); + auto b = GetVectorElement(in); + return std::make_unique(std::move(a), std::move(b)); } case SBIG('MULT'): { - CRealElement* a = GetRealElement(in); - CRealElement* b = GetRealElement(in); - return new CREMultiply(a, b); + auto a = GetRealElement(in); + auto b = GetRealElement(in); + return std::make_unique(std::move(a), std::move(b)); } case SBIG('PULS'): { - CIntElement* a = GetIntElement(in); - CIntElement* b = GetIntElement(in); - CRealElement* c = GetRealElement(in); - CRealElement* d = GetRealElement(in); - return new CREPulse(a, b, c, d); + auto a = GetIntElement(in); + auto b = GetIntElement(in); + auto c = GetRealElement(in); + auto d = GetRealElement(in); + return std::make_unique(std::move(a), std::move(b), std::move(c), std::move(d)); } case SBIG('SCAL'): { - CRealElement* a = GetRealElement(in); - return new CRETimeScale(a); + auto a = GetRealElement(in); + return std::make_unique(std::move(a)); } case SBIG('RLPT'): { - CRealElement* a = GetRealElement(in); - return new CRELifetimePercent(a); + auto a = GetRealElement(in); + return std::make_unique(std::move(a)); } case SBIG('SINE'): { - CRealElement* a = GetRealElement(in); - CRealElement* b = GetRealElement(in); - CRealElement* c = GetRealElement(in); - return new CRESineWave(a, b, c); + auto a = GetRealElement(in); + auto b = GetRealElement(in); + auto c = GetRealElement(in); + return std::make_unique(std::move(a), std::move(b), std::move(c)); } case SBIG('ISWT'): { - CRealElement* a = GetRealElement(in); - CRealElement* b = GetRealElement(in); - return new CREInitialSwitch(a, b); + auto a = GetRealElement(in); + auto b = GetRealElement(in); + return std::make_unique(std::move(a), std::move(b)); } case SBIG('CLTN'): { - CRealElement* a = GetRealElement(in); - CRealElement* b = GetRealElement(in); - CRealElement* c = GetRealElement(in); - CRealElement* d = GetRealElement(in); - return new CRECompareLessThan(a, b, c, d); + auto a = GetRealElement(in); + auto b = GetRealElement(in); + auto c = GetRealElement(in); + auto d = GetRealElement(in); + return std::make_unique(std::move(a), std::move(b), std::move(c), std::move(d)); } case SBIG('CEQL'): { - CRealElement* a = GetRealElement(in); - CRealElement* b = GetRealElement(in); - CRealElement* c = GetRealElement(in); - CRealElement* d = GetRealElement(in); - return new CRECompareEquals(a, b, c, d); + auto a = GetRealElement(in); + auto b = GetRealElement(in); + auto c = GetRealElement(in); + auto d = GetRealElement(in); + return std::make_unique(std::move(a), std::move(b), std::move(c), std::move(d)); } case SBIG('PAP1'): { - return new CREParticleAccessParam1; + return std::make_unique(); } case SBIG('PAP2'): { - return new CREParticleAccessParam2; + return std::make_unique(); } case SBIG('PAP3'): { - return new CREParticleAccessParam3; + return std::make_unique(); } case SBIG('PAP4'): { - return new CREParticleAccessParam4; + return std::make_unique(); } case SBIG('PAP5'): { - return new CREParticleAccessParam5; + return std::make_unique(); } case SBIG('PAP6'): { - return new CREParticleAccessParam6; + return std::make_unique(); } case SBIG('PAP7'): { - return new CREParticleAccessParam7; + return std::make_unique(); } case SBIG('PAP8'): { - return new CREParticleAccessParam8; + return std::make_unique(); } case SBIG('PSLL'): { - return new CREParticleSizeOrLineLength; + return std::make_unique(); } case SBIG('PRLW'): { - return new CREParticleRotationOrLineWidth; + return std::make_unique(); } case SBIG('SUB_'): { - CRealElement* a = GetRealElement(in); - CRealElement* b = GetRealElement(in); - return new CRESubtract(a, b); + auto a = GetRealElement(in); + auto b = GetRealElement(in); + return std::make_unique(std::move(a), std::move(b)); } case SBIG('VMAG'): { - CVectorElement* a = GetVectorElement(in); - return new CREVectorMagnitude(a); + auto a = GetVectorElement(in); + return std::make_unique(std::move(a)); } case SBIG('VXTR'): { - CVectorElement* a = GetVectorElement(in); - return new CREVectorXToReal(a); + auto a = GetVectorElement(in); + return std::make_unique(std::move(a)); } case SBIG('VYTR'): { - CVectorElement* a = GetVectorElement(in); - return new CREVectorYToReal(a); + auto a = GetVectorElement(in); + return std::make_unique(std::move(a)); } case SBIG('VZTR'): { - CVectorElement* a = GetVectorElement(in); - return new CREVectorZToReal(a); + auto a = GetVectorElement(in); + return std::make_unique(std::move(a)); } case SBIG('CEXT'): { - CIntElement* a = GetIntElement(in); - return new CRECEXT(a); + auto a = GetIntElement(in); + return std::make_unique(std::move(a)); } case SBIG('ITRL'): { - CIntElement* a = GetIntElement(in); - CRealElement* b = GetRealElement(in); - return new CREIntTimesReal(a, b); + auto a = GetIntElement(in); + auto b = GetRealElement(in); + return std::make_unique(std::move(a), std::move(b)); } case SBIG('CRNG'): { - CRealElement* a = GetRealElement(in); - CRealElement* b = GetRealElement(in); - CRealElement* c = GetRealElement(in); - CRealElement* d = GetRealElement(in); - CRealElement* e = GetRealElement(in); - return new CREConstantRange(a, b, c, d, e); + auto a = GetRealElement(in); + auto b = GetRealElement(in); + auto c = GetRealElement(in); + auto d = GetRealElement(in); + auto e = GetRealElement(in); + return std::make_unique(std::move(a), std::move(b), std::move(c), std::move(d), std::move(e)); } case SBIG('GTCR'): { - CColorElement* a = GetColorElement(in); - return new CREGetComponentRed(a); + auto a = GetColorElement(in); + return std::make_unique(std::move(a)); } case SBIG('GTCG'): { - CColorElement* a = GetColorElement(in); - return new CREGetComponentGreen(a); + auto a = GetColorElement(in); + return std::make_unique(std::move(a)); } case SBIG('GTCB'): { - CColorElement* a = GetColorElement(in); - return new CREGetComponentBlue(a); + auto a = GetColorElement(in); + return std::make_unique(std::move(a)); } case SBIG('GTCA'): { - CColorElement* a = GetColorElement(in); - return new CREGetComponentAlpha(a); + auto a = GetColorElement(in); + return std::make_unique(std::move(a)); } default: break; } return nullptr; } -CIntElement* CParticleDataFactory::GetIntElement(CInputStream& in) +std::unique_ptr CParticleDataFactory::GetIntElement(CInputStream& in) { FourCC clsId = GetClassID(in); switch (clsId) @@ -715,110 +720,110 @@ CIntElement* CParticleDataFactory::GetIntElement(CInputStream& in) case SBIG('KEYE'): case SBIG('KEYP'): { - return new CIEKeyframeEmitter(in); + return std::make_unique(in); } case SBIG('DETH'): { - CIntElement* a = GetIntElement(in); - CIntElement* b = GetIntElement(in); - return new CIEDeath(a, b); + auto a = GetIntElement(in); + auto b = GetIntElement(in); + return std::make_unique(std::move(a), std::move(b)); } case SBIG('CLMP'): { - CIntElement* a = GetIntElement(in); - CIntElement* b = GetIntElement(in); - CIntElement* c = GetIntElement(in); - return new CIEClamp(a, b, c); + auto a = GetIntElement(in); + auto b = GetIntElement(in); + auto c = GetIntElement(in); + return std::make_unique(std::move(a), std::move(b), std::move(c)); } case SBIG('CHAN'): { - CIntElement* a = GetIntElement(in); - CIntElement* b = GetIntElement(in); - CIntElement* c = GetIntElement(in); - return new CIETimeChain(a, b, c); + auto a = GetIntElement(in); + auto b = GetIntElement(in); + auto c = GetIntElement(in); + return std::make_unique(std::move(a), std::move(b), std::move(c)); } case SBIG('ADD_'): { - CIntElement* a = GetIntElement(in); - CIntElement* b = GetIntElement(in); - return new CIEAdd(a, b); + auto a = GetIntElement(in); + auto b = GetIntElement(in); + return std::make_unique(std::move(a), std::move(b)); } case SBIG('CNST'): { int a = GetInt(in); - return new CIEConstant(a); + return std::make_unique(std::move(a)); } case SBIG('IMPL'): { - CIntElement* a = GetIntElement(in); - return new CIEImpulse(a); + auto a = GetIntElement(in); + return std::make_unique(std::move(a)); } case SBIG('ILPT'): { - CIntElement* a = GetIntElement(in); - return new CIELifetimePercent(a); + auto a = GetIntElement(in); + return std::make_unique(std::move(a)); } case SBIG('IRND'): { - CIntElement* a = GetIntElement(in); - CIntElement* b = GetIntElement(in); - return new CIEInitialRandom(a, b); + auto a = GetIntElement(in); + auto b = GetIntElement(in); + return std::make_unique(std::move(a), std::move(b)); } case SBIG('PULS'): { - CIntElement* a = GetIntElement(in); - CIntElement* b = GetIntElement(in); - CIntElement* c = GetIntElement(in); - CIntElement* d = GetIntElement(in); - return new CIEPulse(a, b, c, d); + auto a = GetIntElement(in); + auto b = GetIntElement(in); + auto c = GetIntElement(in); + auto d = GetIntElement(in); + return std::make_unique(std::move(a), std::move(b), std::move(c), std::move(d)); } case SBIG('MULT'): { - CIntElement* a = GetIntElement(in); - CIntElement* b = GetIntElement(in); - return new CIEMultiply(a, b); + auto a = GetIntElement(in); + auto b = GetIntElement(in); + return std::make_unique(std::move(a), std::move(b)); } case SBIG('SPAH'): { - CIntElement* a = GetIntElement(in); - CIntElement* b = GetIntElement(in); - CIntElement* c = GetIntElement(in); - return new CIESampleAndHold(a, b, c); + auto a = GetIntElement(in); + auto b = GetIntElement(in); + auto c = GetIntElement(in); + return std::make_unique(std::move(a), std::move(b), std::move(c)); } case SBIG('RAND'): { - CIntElement* a = GetIntElement(in); - CIntElement* b = GetIntElement(in); - return new CIERandom(a, b); + auto a = GetIntElement(in); + auto b = GetIntElement(in); + return std::make_unique(std::move(a), std::move(b)); } case SBIG('TSCL'): { - CRealElement* a = GetRealElement(in); - return new CIETimeScale(a); + auto a = GetRealElement(in); + return std::make_unique(std::move(a)); } case SBIG('GAPC'): { - return new CIEGetActiveParticleCount; + return std::make_unique(); } case SBIG('GTCP'): { - return new CIEGetCumulativeParticleCount; + return std::make_unique(); } case SBIG('GEMT'): { - return new CIEGetEmitterTime; + return std::make_unique(); } case SBIG('MODU'): { - CIntElement* a = GetIntElement(in); - CIntElement* b = GetIntElement(in); - return new CIEModulo(a, b); + auto a = GetIntElement(in); + auto b = GetIntElement(in); + return std::make_unique(std::move(a), std::move(b)); } case SBIG('SUB_'): { - CIntElement* a = GetIntElement(in); - CIntElement* b = GetIntElement(in); - return new CIESubtract(a, b); + auto a = GetIntElement(in); + auto b = GetIntElement(in); + return std::make_unique(std::move(a), std::move(b)); } default: break; } @@ -861,19 +866,19 @@ bool CParticleDataFactory::CreateGPSM(CGenDescription* fillDesc, CInputStream& i switch (clsId) { case SBIG('PMCL'): - fillDesc->x78_x64_PMCL.reset(GetColorElement(in)); + fillDesc->x78_x64_PMCL = GetColorElement(in); break; case SBIG('LFOR'): - fillDesc->x118_x104_LFOR.reset(GetRealElement(in)); + fillDesc->x118_x104_LFOR = GetRealElement(in); break; case SBIG('IDTS'): fillDesc->xa4_x90_IDTS = GetChildGeneratorDesc(in, resPool, tracker); break; case SBIG('EMTR'): - fillDesc->x40_x2c_EMTR.reset(GetEmitterElement(in)); + fillDesc->x40_x2c_EMTR = GetEmitterElement(in); break; case SBIG('COLR'): - fillDesc->x30_x24_COLR.reset(GetColorElement(in)); + fillDesc->x30_x24_COLR = GetColorElement(in); break; case SBIG('CIND'): fillDesc->x45_30_x32_24_CIND = GetBool(in); @@ -882,10 +887,10 @@ bool CParticleDataFactory::CreateGPSM(CGenDescription* fillDesc, CInputStream& i fillDesc->x44_26_x30_26_AAPH = GetBool(in); break; case SBIG('CSSD'): - fillDesc->xa0_x8c_CSSD.reset(GetIntElement(in)); + fillDesc->xa0_x8c_CSSD = GetIntElement(in); break; case SBIG('GRTE'): - fillDesc->x2c_x20_GRTE.reset(GetRealElement(in)); + fillDesc->x2c_x20_GRTE = GetRealElement(in); break; case SBIG('FXLL'): fillDesc->x44_25_x30_25_FXLL = GetBool(in); @@ -904,64 +909,64 @@ bool CParticleDataFactory::CreateGPSM(CGenDescription* fillDesc, CInputStream& i break; } case SBIG('ILOC'): - delete GetVectorElement(in); + GetVectorElement(in); break; case SBIG('IITS'): fillDesc->xb8_xa4_IITS = GetChildGeneratorDesc(in, resPool, tracker); break; case SBIG('IVEC'): - delete GetVectorElement(in); + GetVectorElement(in); break; case SBIG('LDIR'): - fillDesc->x110_xfc_LDIR.reset(GetVectorElement(in)); + fillDesc->x110_xfc_LDIR = GetVectorElement(in); break; case SBIG('LCLR'): - fillDesc->x104_xf0_LCLR.reset(GetColorElement(in)); + fillDesc->x104_xf0_LCLR = GetColorElement(in); break; case SBIG('LENG'): - fillDesc->x20_x14_LENG.reset(GetRealElement(in)); + fillDesc->x20_x14_LENG = GetRealElement(in); break; case SBIG('MAXP'): - fillDesc->x28_x1c_MAXP.reset(GetIntElement(in)); + fillDesc->x28_x1c_MAXP = GetIntElement(in); break; case SBIG('LOFF'): - fillDesc->x10c_xf8_LOFF.reset(GetVectorElement(in)); + fillDesc->x10c_xf8_LOFF = GetVectorElement(in); break; case SBIG('LINT'): - fillDesc->x108_xf4_LINT.reset(GetRealElement(in)); + fillDesc->x108_xf4_LINT = GetRealElement(in); break; case SBIG('LINE'): fillDesc->x44_24_x30_24_LINE = GetBool(in); break; case SBIG('LFOT'): - fillDesc->x114_x100_LFOT.reset(GetIntElement(in)); + fillDesc->x114_x100_LFOT = GetIntElement(in); break; case SBIG('LIT_'): fillDesc->x44_29_x30_29_LIT_ = GetBool(in); break; case SBIG('LTME'): - fillDesc->x34_x28_LTME.reset(GetIntElement(in)); + fillDesc->x34_x28_LTME = GetIntElement(in); break; case SBIG('LSLA'): - fillDesc->x11c_x108_LSLA.reset(GetRealElement(in)); + fillDesc->x11c_x108_LSLA = GetRealElement(in); break; case SBIG('LTYP'): - fillDesc->x100_xec_LTYP.reset(GetIntElement(in)); + fillDesc->x100_xec_LTYP = GetIntElement(in); break; case SBIG('NDSY'): - fillDesc->xb4_xa0_NDSY.reset(GetIntElement(in)); + fillDesc->xb4_xa0_NDSY = GetIntElement(in); break; case SBIG('MBSP'): - fillDesc->x48_x34_MBSP.reset(GetIntElement(in)); + fillDesc->x48_x34_MBSP = GetIntElement(in); break; case SBIG('MBLR'): fillDesc->x44_30_x31_24_MBLR = GetBool(in); break; case SBIG('NCSY'): - fillDesc->x9c_x88_NCSY.reset(GetIntElement(in)); + fillDesc->x9c_x88_NCSY = GetIntElement(in); break; case SBIG('PISY'): - fillDesc->xc8_xb4_PISY.reset(GetIntElement(in)); + fillDesc->xc8_xb4_PISY = GetIntElement(in); break; case SBIG('OPTS'): fillDesc->x45_31_x32_25_OPTS = GetBool(in); @@ -970,70 +975,70 @@ bool CParticleDataFactory::CreateGPSM(CGenDescription* fillDesc, CInputStream& i fillDesc->x44_31_x31_25_PMAB = GetBool(in); break; case SBIG('SESD'): - fillDesc->xf8_xe4_SESD.reset(GetIntElement(in)); + fillDesc->xf8_xe4_SESD = GetIntElement(in); break; case SBIG('SEPO'): - fillDesc->xfc_xe8_SEPO.reset(GetVectorElement(in)); + fillDesc->xfc_xe8_SEPO = GetVectorElement(in); break; case SBIG('PSLT'): - fillDesc->xc_x0_PSLT.reset(GetIntElement(in)); + fillDesc->xc_x0_PSLT = GetIntElement(in); break; case SBIG('PMSC'): - fillDesc->x74_x60_PMSC.reset(GetVectorElement(in)); + fillDesc->x74_x60_PMSC = GetVectorElement(in); break; case SBIG('PMOP'): - fillDesc->x6c_x58_PMOP.reset(GetVectorElement(in)); + fillDesc->x6c_x58_PMOP = GetVectorElement(in); break; case SBIG('PMDL'): fillDesc->x5c_x48_PMDL = GetModel(in, resPool); break; case SBIG('PMRT'): - fillDesc->x70_x5c_PMRT.reset(GetVectorElement(in)); + fillDesc->x70_x5c_PMRT = GetVectorElement(in); break; case SBIG('POFS'): - fillDesc->x18_xc_POFS.reset(GetVectorElement(in)); + fillDesc->x18_xc_POFS = GetVectorElement(in); break; case SBIG('PMUS'): fillDesc->x45_24_x31_26_PMUS = GetBool(in); break; case SBIG('PSIV'): - delete GetVectorElement(in); + GetVectorElement(in); break; case SBIG('ROTA'): - fillDesc->x50_x3c_ROTA.reset(GetRealElement(in)); + fillDesc->x50_x3c_ROTA = GetRealElement(in); break; case SBIG('PSVM'): - delete GetModVectorElement(in); + GetModVectorElement(in); break; case SBIG('PSTS'): - fillDesc->x14_x8_PSTS.reset(GetRealElement(in)); + fillDesc->x14_x8_PSTS = GetRealElement(in); break; case SBIG('PSOV'): - delete GetVectorElement(in); + GetVectorElement(in); break; case SBIG('PSWT'): - fillDesc->x10_x4_PSWT.reset(GetIntElement(in)); + fillDesc->x10_x4_PSWT = GetIntElement(in); break; case SBIG('SEED'): - fillDesc->x1c_x10_SEED.reset(GetIntElement(in)); + fillDesc->x1c_x10_SEED = GetIntElement(in); break; case SBIG('PMOO'): fillDesc->x45_25_x31_27_PMOO = GetBool(in); break; case SBIG('SSSD'): - fillDesc->xe4_xd0_SSSD.reset(GetIntElement(in)); + fillDesc->xe4_xd0_SSSD = GetIntElement(in); break; case SBIG('SORT'): fillDesc->x44_28_x30_28_SORT = GetBool(in); break; case SBIG('SIZE'): - fillDesc->x4c_x38_SIZE.reset(GetRealElement(in)); + fillDesc->x4c_x38_SIZE = GetRealElement(in); break; case SBIG('SISY'): - fillDesc->xcc_xb8_SISY.reset(GetIntElement(in)); + fillDesc->xcc_xb8_SISY = GetIntElement(in); break; case SBIG('SSPO'): - fillDesc->xe8_xd4_SSPO.reset(GetVectorElement(in)); + fillDesc->xe8_xd4_SSPO = GetVectorElement(in); break; case SBIG('TEXR'): { @@ -1065,22 +1070,22 @@ bool CParticleDataFactory::CreateGPSM(CGenDescription* fillDesc, CInputStream& i fillDesc->x45_26_x31_28_VMD1 = GetBool(in); break; case SBIG('VEL4'): - fillDesc->x88_x74_VEL4.reset(GetModVectorElement(in)); + fillDesc->x88_x74_VEL4 = GetModVectorElement(in); break; case SBIG('VEL3'): - fillDesc->x84_x70_VEL3.reset(GetModVectorElement(in)); + fillDesc->x84_x70_VEL3 = GetModVectorElement(in); break; case SBIG('VEL2'): - fillDesc->x80_x6c_VEL2.reset(GetModVectorElement(in)); + fillDesc->x80_x6c_VEL2 = GetModVectorElement(in); break; case SBIG('VEL1'): - fillDesc->x7c_x68_VEL1.reset(GetModVectorElement(in)); + fillDesc->x7c_x68_VEL1 = GetModVectorElement(in); break; case SBIG('ZBUF'): fillDesc->x44_27_x30_27_ZBUF = GetBool(in); break; case SBIG('WIDT'): - fillDesc->x24_x18_WIDT.reset(GetRealElement(in)); + fillDesc->x24_x18_WIDT = GetRealElement(in); break; case SBIG('ORNT'): fillDesc->x30_30_ORNT = GetBool(in); @@ -1089,28 +1094,28 @@ bool CParticleDataFactory::CreateGPSM(CGenDescription* fillDesc, CInputStream& i fillDesc->x30_31_RSOP = GetBool(in); break; case SBIG('ADV1'): - fillDesc->x10c_ADV1.reset(GetRealElement(in)); + fillDesc->x10c_ADV1 = GetRealElement(in); break; case SBIG('ADV2'): - fillDesc->x110_ADV2.reset(GetRealElement(in)); + fillDesc->x110_ADV2 = GetRealElement(in); break; case SBIG('ADV3'): - fillDesc->x114_ADV3.reset(GetRealElement(in)); + fillDesc->x114_ADV3 = GetRealElement(in); break; case SBIG('ADV4'): - fillDesc->x118_ADV4.reset(GetRealElement(in)); + fillDesc->x118_ADV4 = GetRealElement(in); break; case SBIG('ADV5'): - fillDesc->x11c_ADV5.reset(GetRealElement(in)); + fillDesc->x11c_ADV5 = GetRealElement(in); break; case SBIG('ADV6'): - fillDesc->x120_ADV6.reset(GetRealElement(in)); + fillDesc->x120_ADV6 = GetRealElement(in); break; case SBIG('ADV7'): - fillDesc->x124_ADV7.reset(GetRealElement(in)); + fillDesc->x124_ADV7 = GetRealElement(in); break; case SBIG('ADV8'): - fillDesc->x128_ADV8.reset(GetRealElement(in)); + fillDesc->x128_ADV8 = GetRealElement(in); break; case SBIG('SELC'): fillDesc->xec_xd8_SELC = GetElectricGeneratorDesc(in, resPool); @@ -1134,11 +1139,13 @@ bool CParticleDataFactory::CreateGPSM(CGenDescription* fillDesc, CInputStream& i while (clsId != SBIG('_END') && !in.atEnd()) { - switch(clsId) + switch (clsId) { case SBIG('BGCL'): - fillDesc->m_bevelGradient.reset(GetColorElement(in)); - break; + fillDesc->m_bevelGradient = GetColorElement(in); + break; + default: + break; } clsId = GetClassID(in); } @@ -1169,7 +1176,8 @@ CFactoryFnReturn FParticleFactory(const SObjectTag& tag, CInputStream& in, CObjectReference* selfRef) { CSimplePool* sp = vparms.GetOwnedObj(); - return TToken::GetIObjObjectFor(std::unique_ptr(CParticleDataFactory::GetGeneratorDesc(in, sp))); + return TToken::GetIObjObjectFor( + std::unique_ptr(CParticleDataFactory::GetGeneratorDesc(in, sp))); } } diff --git a/Runtime/Particle/CParticleDataFactory.hpp b/Runtime/Particle/CParticleDataFactory.hpp index 294a8d28f..b90ac2b03 100644 --- a/Runtime/Particle/CParticleDataFactory.hpp +++ b/Runtime/Particle/CParticleDataFactory.hpp @@ -80,13 +80,13 @@ class CParticleDataFactory static SChildGeneratorDesc GetChildGeneratorDesc(CInputStream& in, CSimplePool* resPool, const std::vector& 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 GetTextureElement(CInputStream& in, CSimplePool* resPool); + static std::unique_ptr GetColorElement(CInputStream& in); + static std::unique_ptr GetModVectorElement(CInputStream& in); + static std::unique_ptr GetEmitterElement(CInputStream& in); + static std::unique_ptr GetVectorElement(CInputStream& in); + static std::unique_ptr GetRealElement(CInputStream& in); + static std::unique_ptr GetIntElement(CInputStream& in); static float GetReal(CInputStream& in); static s32 GetInt(CInputStream& in); diff --git a/Runtime/Particle/CParticleElectricDataFactory.cpp b/Runtime/Particle/CParticleElectricDataFactory.cpp index 6079eb60d..9bd64ecd2 100644 --- a/Runtime/Particle/CParticleElectricDataFactory.cpp +++ b/Runtime/Particle/CParticleElectricDataFactory.cpp @@ -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); diff --git a/Runtime/Particle/CParticleSwoosh.cpp b/Runtime/Particle/CParticleSwoosh.cpp index b1cb7dca5..76c41dcba 100644 --- a/Runtime/Particle/CParticleSwoosh.cpp +++ b/Runtime/Particle/CParticleSwoosh.cpp @@ -69,7 +69,7 @@ CParticleSwoosh::CParticleSwoosh(const TToken& 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); diff --git a/Runtime/Particle/CParticleSwooshDataFactory.cpp b/Runtime/Particle/CParticleSwooshDataFactory.cpp index 838a00519..7fac5f159 100644 --- a/Runtime/Particle/CParticleSwooshDataFactory.cpp +++ b/Runtime/Particle/CParticleSwooshDataFactory.cpp @@ -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); diff --git a/Runtime/Particle/CProjectileWeaponDataFactory.cpp b/Runtime/Particle/CProjectileWeaponDataFactory.cpp index 2498bc9b0..20669901f 100644 --- a/Runtime/Particle/CProjectileWeaponDataFactory.cpp +++ b/Runtime/Particle/CProjectileWeaponDataFactory.cpp @@ -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: { diff --git a/Runtime/Particle/CRealElement.hpp b/Runtime/Particle/CRealElement.hpp index 8fa3c0057..7f305e858 100644 --- a/Runtime/Particle/CRealElement.hpp +++ b/Runtime/Particle/CRealElement.hpp @@ -27,8 +27,8 @@ class CRELifetimeTween : public CRealElement std::unique_ptr x4_a; std::unique_ptr x8_b; public: - CRELifetimeTween(CRealElement* a, CRealElement* b) - : x4_a(a), x8_b(b) {} + CRELifetimeTween(std::unique_ptr&& a, std::unique_ptr&& 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 x8_b; std::unique_ptr xc_swFrame; public: - CRETimeChain(CRealElement* a, CRealElement* b, CIntElement* c) - : x4_a(a), x8_b(b), xc_swFrame(c) {} + CRETimeChain(std::unique_ptr&& a, std::unique_ptr&& b, std::unique_ptr&& 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 x4_a; std::unique_ptr x8_b; public: - CREAdd(CRealElement* a, CRealElement* b) - : x4_a(a), x8_b(b) {} + CREAdd(std::unique_ptr&& a, std::unique_ptr&& 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 x8_max; std::unique_ptr xc_val; public: - CREClamp(CRealElement* a, CRealElement* b, CRealElement* c) - : x4_min(a), x8_max(b), xc_val(c) {} + CREClamp(std::unique_ptr&& a, std::unique_ptr&& b, std::unique_ptr&& 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 x4_min; std::unique_ptr x8_max; public: - CREInitialRandom(CRealElement* a, CRealElement* b) - : x4_min(a), x8_max(b) {} + CREInitialRandom(std::unique_ptr&& a, std::unique_ptr&& 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 x4_min; std::unique_ptr x8_max; public: - CRERandom(CRealElement* a, CRealElement* b) - : x4_min(a), x8_max(b) {} + CRERandom(std::unique_ptr&& a, std::unique_ptr&& 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 x4_a; std::unique_ptr x8_b; public: - CREDotProduct(CVectorElement* a, CVectorElement* b) - : x4_a(a), x8_b(b) {} + CREDotProduct(std::unique_ptr&& a, std::unique_ptr&& 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 x4_a; std::unique_ptr x8_b; public: - CREMultiply(CRealElement* a, CRealElement* b) - : x4_a(a), x8_b(b) {} + CREMultiply(std::unique_ptr&& a, std::unique_ptr&& 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 xc_valA; std::unique_ptr 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&& a, std::unique_ptr&& b, + std::unique_ptr&& c, std::unique_ptr&& 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 x4_a; public: - CRETimeScale(CRealElement* a) - : x4_a(a) {} + CRETimeScale(std::unique_ptr&& a) + : x4_a(std::move(a)) {} bool GetValue(int frame, float& valOut) const; }; @@ -139,8 +140,8 @@ class CRELifetimePercent : public CRealElement { std::unique_ptr x4_percentVal; public: - CRELifetimePercent(CRealElement* a) - : x4_percentVal(a) {} + CRELifetimePercent(std::unique_ptr&& a) + : x4_percentVal(std::move(a)) {} bool GetValue(int frame, float& valOut) const; }; @@ -150,8 +151,9 @@ class CRESineWave : public CRealElement std::unique_ptr x8_linearFrame; std::unique_ptr xc_constantFrame; public: - CRESineWave(CRealElement* a, CRealElement* b, CRealElement* c) - : x4_magnitude(a), x8_linearFrame(b), xc_constantFrame(c) {} + CRESineWave(std::unique_ptr&& a, std::unique_ptr&& b, + std::unique_ptr&& 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 x4_a; std::unique_ptr x8_b; public: - CREInitialSwitch(CRealElement* a, CRealElement* b) - : x4_a(a), x8_b(b) {} + CREInitialSwitch(std::unique_ptr&& a, std::unique_ptr&& 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 xc_c; std::unique_ptr 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&& a, std::unique_ptr&& b, + std::unique_ptr&& c, std::unique_ptr&& 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 xc_c; std::unique_ptr 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&& a, std::unique_ptr&& b, + std::unique_ptr&& c, std::unique_ptr&& 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 x4_a; std::unique_ptr x8_b; public: - CRESubtract(CRealElement* a, CRealElement* b) - : x4_a(a), x8_b(b) {} + CRESubtract(std::unique_ptr&& a, std::unique_ptr&& 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 x4_a; public: - CREVectorMagnitude(CVectorElement* a) - : x4_a(a) {} + CREVectorMagnitude(std::unique_ptr&& a) + : x4_a(std::move(a)) {} bool GetValue(int frame, float& valOut) const; }; @@ -272,8 +276,8 @@ class CREVectorXToReal : public CRealElement { std::unique_ptr x4_a; public: - CREVectorXToReal(CVectorElement* a) - : x4_a(a) {} + CREVectorXToReal(std::unique_ptr&& a) + : x4_a(std::move(a)) {} bool GetValue(int frame, float& valOut) const; }; @@ -281,8 +285,8 @@ class CREVectorYToReal : public CRealElement { std::unique_ptr x4_a; public: - CREVectorYToReal(CVectorElement* a) - : x4_a(a) {} + CREVectorYToReal(std::unique_ptr&& a) + : x4_a(std::move(a)) {} bool GetValue(int frame, float& valOut) const; }; @@ -290,8 +294,8 @@ class CREVectorZToReal : public CRealElement { std::unique_ptr x4_a; public: - CREVectorZToReal(CVectorElement* a) - : x4_a(a) {} + CREVectorZToReal(std::unique_ptr&& a) + : x4_a(std::move(a)) {} bool GetValue(int frame, float& valOut) const; }; @@ -299,8 +303,8 @@ class CRECEXT : public CRealElement { std::unique_ptr x4_a; public: - CRECEXT(CIntElement* a) - : x4_a(a) {} + CRECEXT(std::unique_ptr&& a) + : x4_a(std::move(a)) {} bool GetValue(int frame, float& valOut) const; }; @@ -309,8 +313,8 @@ class CREIntTimesReal : public CRealElement std::unique_ptr x4_a; std::unique_ptr x8_b; public: - CREIntTimesReal(CIntElement* a, CRealElement* b) - : x4_a(a), x8_b(b) {} + CREIntTimesReal(std::unique_ptr&& a, std::unique_ptr&& 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 x10_inRange; std::unique_ptr 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&& a, std::unique_ptr&& b, + std::unique_ptr&& c, std::unique_ptr&& d, + std::unique_ptr&& 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 x4_a; public: - CREGetComponentRed(CColorElement* a) - : x4_a(a) {} + CREGetComponentRed(std::unique_ptr&& a) + : x4_a(std::move(a)) {} bool GetValue(int frame, float& valOut) const; }; @@ -342,8 +349,8 @@ class CREGetComponentGreen : public CRealElement { std::unique_ptr x4_a; public: - CREGetComponentGreen(CColorElement* a) - : x4_a(a) {} + CREGetComponentGreen(std::unique_ptr&& a) + : x4_a(std::move(a)) {} bool GetValue(int frame, float& valOut) const; }; @@ -352,8 +359,8 @@ class CREGetComponentBlue : public CRealElement { std::unique_ptr x4_a; public: - CREGetComponentBlue(CColorElement* a) - : x4_a(a) {} + CREGetComponentBlue(std::unique_ptr&& a) + : x4_a(std::move(a)) {} bool GetValue(int frame, float& valOut) const; }; @@ -362,8 +369,8 @@ class CREGetComponentAlpha : public CRealElement { std::unique_ptr x4_a; public: - CREGetComponentAlpha(CColorElement* a) - : x4_a(a) {} + CREGetComponentAlpha(std::unique_ptr&& a) + : x4_a(std::move(a)) {} bool GetValue(int frame, float& valOut) const; }; diff --git a/Runtime/Particle/CUVElement.cpp b/Runtime/Particle/CUVElement.cpp index bc85bf057..bab05d251 100644 --- a/Runtime/Particle/CUVElement.cpp +++ b/Runtime/Particle/CUVElement.cpp @@ -5,18 +5,15 @@ namespace urde { -CUVEAnimTexture::CUVEAnimTexture(TToken&& 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&& tex, std::unique_ptr&& a, + std::unique_ptr&& b, std::unique_ptr&& c, + std::unique_ptr&& d, std::unique_ptr&& 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(); diff --git a/Runtime/Particle/CUVElement.hpp b/Runtime/Particle/CUVElement.hpp index c540bc9fe..447fadd9b 100644 --- a/Runtime/Particle/CUVElement.hpp +++ b/Runtime/Particle/CUVElement.hpp @@ -55,8 +55,9 @@ struct CUVEAnimTexture : public CUVElement std::unique_ptr x28_cycleFrames; std::vector x2c_uvElems; public: - CUVEAnimTexture(TToken&& tex, CIntElement* a, CIntElement* b, - CIntElement* c, CIntElement* d, CIntElement* e, bool f); + CUVEAnimTexture(TToken&& tex, std::unique_ptr&& a, std::unique_ptr&& b, + std::unique_ptr&& c, std::unique_ptr&& d, + std::unique_ptr&& e, bool f); TLockedToken GetValueTexture(int frame) const { return TLockedToken(x4_tex); diff --git a/Runtime/Particle/CVectorElement.cpp b/Runtime/Particle/CVectorElement.cpp index 831b33ebb..a06192e53 100644 --- a/Runtime/Particle/CVectorElement.cpp +++ b/Runtime/Particle/CVectorElement.cpp @@ -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&& a, std::unique_ptr&& 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&& a, std::unique_ptr&& b, + std::unique_ptr&& c, std::unique_ptr&& 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&& a, std::unique_ptr&& b, + std::unique_ptr&& c, std::unique_ptr&& d, + std::unique_ptr&& 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 diff --git a/Runtime/Particle/CVectorElement.hpp b/Runtime/Particle/CVectorElement.hpp index 9e97d90e1..699ba3090 100644 --- a/Runtime/Particle/CVectorElement.hpp +++ b/Runtime/Particle/CVectorElement.hpp @@ -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&& a, std::unique_ptr&& b); bool GetValue(int frame, zeus::CVector3f& valOut) const; }; @@ -39,8 +39,9 @@ class CVETimeChain : public CVectorElement std::unique_ptr x8_b; std::unique_ptr xc_swFrame; public: - CVETimeChain(CVectorElement* a, CVectorElement* b, CIntElement* c) - : x4_a(a), x8_b(b), xc_swFrame(c) {} + CVETimeChain(std::unique_ptr&& a, std::unique_ptr&& b, + std::unique_ptr&& 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 x10_angleYRange; std::unique_ptr 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&& a, std::unique_ptr&& b, + std::unique_ptr&& c, std::unique_ptr&& d, + std::unique_ptr&& 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 x4_a; std::unique_ptr x8_b; public: - CVEAdd(CVectorElement* a, CVectorElement* b) - : x4_a(a), x8_b(b) {} + CVEAdd(std::unique_ptr&& a, std::unique_ptr&& 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 x24_magnitude; public: - CVECircleCluster(CVectorElement* a, CVectorElement* b, CIntElement* c, CRealElement* d); + CVECircleCluster(std::unique_ptr&& a, std::unique_ptr&& b, + std::unique_ptr&& c, std::unique_ptr&& d); bool GetValue(int frame, zeus::CVector3f& valOut) const; }; @@ -85,8 +90,8 @@ class CVEConstant : public CVectorElement std::unique_ptr x8_b; std::unique_ptr xc_c; public: - CVEConstant(CRealElement* a, CRealElement* b, CRealElement* c) - : x4_a(a), x8_b(b), xc_c(c) {} + CVEConstant(std::unique_ptr&& a, std::unique_ptr&& b, std::unique_ptr&& 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 x24_angleLinear; std::unique_ptr x28_radius; public: - CVECircle(CVectorElement* a, CVectorElement* b, CRealElement* c, CRealElement* d, CRealElement* e); + CVECircle(std::unique_ptr&& a, std::unique_ptr&& b, + std::unique_ptr&& c, std::unique_ptr&& d, + std::unique_ptr&& e); bool GetValue(int frame, zeus::CVector3f& valOut) const; }; @@ -117,8 +124,8 @@ class CVEMultiply : public CVectorElement std::unique_ptr x4_a; std::unique_ptr x8_b; public: - CVEMultiply(CVectorElement* a, CVectorElement* b) - : x4_a(a), x8_b(b) {} + CVEMultiply(std::unique_ptr&& a, std::unique_ptr&& 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 x4_a; public: - CVERealToVector(CRealElement* a) - : x4_a(a) {} + CVERealToVector(std::unique_ptr&& 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 xc_aVal; std::unique_ptr 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&& a, std::unique_ptr&& b, + std::unique_ptr&& c, std::unique_ptr&& 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 x4_a; std::unique_ptr x8_b; public: - CVESubtract(CVectorElement* a, CVectorElement* b) - : x4_a(a), x8_b(b) + CVESubtract(std::unique_ptr&& a, std::unique_ptr&& 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 x4_a; public: - CVEColorToVector(CColorElement* a) - : x4_a(a) {} + CVEColorToVector(std::unique_ptr&& a) + : x4_a(std::move(a)) {} bool GetValue(int frame, zeus::CVector3f& valOut) const; }; diff --git a/Runtime/World/CEnvFxManager.cpp b/Runtime/World/CEnvFxManager.cpp index a8b965a5f..c00babef5 100644 --- a/Runtime/World/CEnvFxManager.cpp +++ b/Runtime/World/CEnvFxManager.cpp @@ -35,4 +35,12 @@ void CEnvFxManager::AreaLoaded() grid.x0_24_ = true; } +void CEnvFxManager::Cleanup() +{ + xb68_envRainSplashId = kInvalidUniqueId; + xb6a_ = false; + xb6c_ = 0; + xb70_ = 0; +} + } diff --git a/Runtime/World/CEnvFxManager.hpp b/Runtime/World/CEnvFxManager.hpp index 70d3d2041..2c02e7d6e 100644 --- a/Runtime/World/CEnvFxManager.hpp +++ b/Runtime/World/CEnvFxManager.hpp @@ -64,6 +64,10 @@ class CEnvFxManager float xb54_; TLockedToken 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(); }; } diff --git a/Runtime/World/CGameArea.cpp b/Runtime/World/CGameArea.cpp index 72121a97f..ed8aec060 100644 --- a/Runtime/World/CGameArea.cpp +++ b/Runtime/World/CGameArea.cpp @@ -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) diff --git a/Runtime/World/CScriptDock.cpp b/Runtime/World/CScriptDock.cpp index 8cf35af93..24e0aeeb5 100644 --- a/Runtime/World/CScriptDock.cpp +++ b/Runtime/World/CScriptDock.cpp @@ -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); } diff --git a/Runtime/World/CScriptDoor.cpp b/Runtime/World/CScriptDoor.cpp index b0e19084b..b29ea4b68 100644 --- a/Runtime/World/CScriptDoor.cpp +++ b/Runtime/World/CScriptDoor.cpp @@ -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(mgr.GetObjectById(uid))) x27c_partner1 = door->GetUniqueId(); @@ -292,12 +301,13 @@ void CScriptDoor::OpenDoor(TUniqueId uid, CStateManager& mgr) for (CEntity* ent : mgr.GetPlatformAndDoorObjectList()) { TCastToConstPtr door = ent; - if (!door || door->GetUniqueId() == GetUniqueId()) + if (!door || door->GetUniqueId() == uid) continue; - if(TCastToConstPtr dock2 = mgr.GetObjectById(door->x282_dockId)) + if (TCastToConstPtr 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); diff --git a/Runtime/World/CScriptSound.cpp b/Runtime/World/CScriptSound.cpp index 960432478..d9a93018a 100644 --- a/Runtime/World/CScriptSound.cpp +++ b/Runtime/World/CScriptSound.cpp @@ -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); } diff --git a/hecl b/hecl index dc5348ad2..c26f24fb9 160000 --- a/hecl +++ b/hecl @@ -1 +1 @@ -Subproject commit dc5348ad25f5dc7264fde4319e8cd4505fe23af1 +Subproject commit c26f24fb90da308ef6428b3198522d13569df50d diff --git a/specter b/specter index 326b5b4d2..a709031d3 160000 --- a/specter +++ b/specter @@ -1 +1 @@ -Subproject commit 326b5b4d2ff727f4836ca0a4467ab311cd239889 +Subproject commit a709031d36f5556b5ef3646673fba5c984d1d45a