From 12430610f110c0b8f4c647415c560af26a3f928a Mon Sep 17 00:00:00 2001 From: Jack Andersen Date: Wed, 9 May 2018 21:25:26 -1000 Subject: [PATCH] Lots of bug fixes --- DataSpec/DNACommon/CRSC.cpp | 21 ++++---- Editor/ViewManager.cpp | 2 + Runtime/CSortedLists.cpp | 8 ++- Runtime/Camera/CCameraManager.cpp | 1 - Runtime/Camera/CFirstPersonCamera.cpp | 2 +- Runtime/Character/CSkinRules.cpp | 4 +- Runtime/Graphics/CModel.hpp | 1 + Runtime/Graphics/CModelBoo.cpp | 51 +++++++++++++++---- Runtime/Graphics/CSkinnedModel.cpp | 14 ++++- Runtime/Graphics/CSkinnedModel.hpp | 1 + Runtime/Graphics/Shaders/CModelShaders.hpp | 2 + .../Graphics/Shaders/CModelShadersGLSL.cpp | 12 +++++ .../Graphics/Shaders/CModelShadersHLSL.cpp | 12 +++++ .../Graphics/Shaders/CModelShadersMetal.cpp | 12 +++++ Runtime/GuiSys/CCompoundTargetReticle.cpp | 6 +-- Runtime/MP1/CFrontEndUI.cpp | 2 +- Runtime/Particle/CWeaponDescription.hpp | 2 +- Runtime/Weapon/CEnergyProjectile.cpp | 6 +-- Runtime/Weapon/CProjectileWeapon.cpp | 6 +-- Runtime/Weapon/CProjectileWeapon.hpp | 2 +- Runtime/World/CWorld.cpp | 1 + hecl | 2 +- specter | 2 +- 23 files changed, 129 insertions(+), 43 deletions(-) diff --git a/DataSpec/DNACommon/CRSC.cpp b/DataSpec/DNACommon/CRSC.cpp index c08a29c02..2bce30521 100644 --- a/DataSpec/DNACommon/CRSC.cpp +++ b/DataSpec/DNACommon/CRSC.cpp @@ -245,29 +245,28 @@ void CRSM::_write(athena::io::IStreamWriter& w) const w.writeBytes("CRSM", 4); for (const auto& pair : x0_generators) { - if (pair.second) - { - w.writeBytes(pair.first.toString().c_str(), 4); - pair.second.write(w); - } + w.writeBytes(pair.first.getChars(), 4); + pair.second.write(w); } for (const auto& pair : x10_sfx) { + w.writeBytes(pair.first.getChars(), 4); if (pair.second != ~0) { - w.writeBytes(pair.first.toString().c_str(), 4); + w.writeBytes("CNST", 4); w.writeUint32Big(pair.second); } + else + { + w.writeBytes("NONE", 4); + } } for (const auto& pair : x20_decals) { - if (pair.second) - { - w.writeBytes(pair.first.toString().c_str(), 4); - pair.second.write(w); - } + w.writeBytes(pair.first.getChars(), 4); + pair.second.write(w); } if (x30_RNGE != 50.f) diff --git a/Editor/ViewManager.cpp b/Editor/ViewManager.cpp index 9e826f71f..4dcb0417a 100644 --- a/Editor/ViewManager.cpp +++ b/Editor/ViewManager.cpp @@ -301,6 +301,8 @@ bool ViewManager::proc() g_ResFactory->AsyncIdle(); if (!m_skipWait || !hecl::com_developer->toBoolean()) m_mainWindow->waitForRetrace(m_voiceEngine.get()); + else + m_voiceEngine->pumpAndMixVoices(); CBooModel::ClearModelUniformCounters(); CGraphics::TickRenderTimings(); ++logvisor::FrameIndex; diff --git a/Runtime/CSortedLists.cpp b/Runtime/CSortedLists.cpp index 1a526c08e..0efb31da1 100644 --- a/Runtime/CSortedLists.cpp +++ b/Runtime/CSortedLists.cpp @@ -1,5 +1,7 @@ #include "CSortedLists.hpp" #include "World/CActor.hpp" +#include "Weapon/CEnergyProjectile.hpp" +#include "TCastTo.hpp" namespace urde { @@ -75,8 +77,10 @@ void CSortedListManager::MoveInList(ESortedList list, s16 idx) if (AccessElement(x0_nodes, AccessElement(sl.x0_ids, idx + 1)).x4_box[int(list)] >= AccessElement(x0_nodes, AccessElement(sl.x0_ids, idx)).x4_box[int(list)]) return; - AccessElement(x0_nodes, AccessElement(sl.x0_ids, idx + 1)).x1c_selfIdxs[int(list)] = idx + 1; + AccessElement(x0_nodes, AccessElement(sl.x0_ids, idx + 1)).x1c_selfIdxs[int(list)] = idx; + AccessElement(x0_nodes, AccessElement(sl.x0_ids, idx)).x1c_selfIdxs[int(list)] = idx + 1; std::swap(AccessElement(sl.x0_ids, idx), AccessElement(sl.x0_ids, idx + 1)); + ++idx; } } } @@ -110,7 +114,7 @@ void CSortedListManager::InsertInList(ESortedList list, SNode& node) /* Do insert */ AccessElement(sl.x0_ids, insIdx) = node.x0_actor->GetUniqueId().Value(); - node.x1c_selfIdxs[int(list)] = insIdx; + node.x1c_selfIdxs[int(list)] = s16(insIdx); ++sl.x800_size; } diff --git a/Runtime/Camera/CCameraManager.cpp b/Runtime/Camera/CCameraManager.cpp index c403c3433..c78027d2e 100644 --- a/Runtime/Camera/CCameraManager.cpp +++ b/Runtime/Camera/CCameraManager.cpp @@ -26,7 +26,6 @@ CCameraManager::CCameraManager(TUniqueId curCameraId) : x0_curCameraId(curCamera { CSfxManager::AddListener(CSfxManager::ESfxChannels::Game, zeus::CVector3f::skZero, zeus::CVector3f::skZero, {1.f, 0.f, 0.f}, {0.f, 0.f, 1.f}, 50.f, 50.f, 1000.f, 1, 1.f); - sAspect = float(g_Viewport.x8_width / g_Viewport.xc_height); sFirstPersonFOV = g_tweakGame->GetFirstPersonFOV(); } diff --git a/Runtime/Camera/CFirstPersonCamera.cpp b/Runtime/Camera/CFirstPersonCamera.cpp index b887da470..d093654f0 100644 --- a/Runtime/Camera/CFirstPersonCamera.cpp +++ b/Runtime/Camera/CFirstPersonCamera.cpp @@ -153,7 +153,7 @@ void CFirstPersonCamera::UpdateTransform(CStateManager& mgr, float dt) const CActor* act = TCastToConstPtr(mgr.GetObjectById(player->x310_orbitTargetId)); if (act && act->GetMaterialList().HasMaterial(EMaterialTypes::Orbit)) { - zeus::CVector3f v = player->x314_orbitPoint.y - eyePos; + zeus::CVector3f v = player->x314_orbitPoint - eyePos; if (v.canBeNormalized()) v.normalize(); diff --git a/Runtime/Character/CSkinRules.cpp b/Runtime/Character/CSkinRules.cpp index 9fb3c6ca1..dc0fb8795 100644 --- a/Runtime/Character/CSkinRules.cpp +++ b/Runtime/Character/CSkinRules.cpp @@ -39,9 +39,9 @@ void CSkinRules::TransformVerticesCPU(std::vector& vertBuf, const std::vector>& vn) const; + void RestoreVerticesCPU(const boo::ObjToken& vertBuf) const; void _WarmupShaders(); static void WarmupShaders(const SObjectTag& cmdlTag); diff --git a/Runtime/Graphics/CModelBoo.cpp b/Runtime/Graphics/CModelBoo.cpp index dada760a0..67e231f39 100644 --- a/Runtime/Graphics/CModelBoo.cpp +++ b/Runtime/Graphics/CModelBoo.cpp @@ -281,7 +281,7 @@ CBooModel::ModelInstance* CBooModel::PushNewModelInstance(int sharedLayoutBuf) m_instances.emplace_back(); ModelInstance& newInst = m_instances.back(); - CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool + CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) { /* Build geometry uniform buffer if shared not available */ boo::ObjToken geomUniformBuf; @@ -643,24 +643,47 @@ void CBooModel::DrawSurface(const CBooSurface& surf, const CModelFlags& flags) c extended = flags.m_noCull ? (flags.m_noZWrite ? EExtendedShader::ForcedAdditiveNoCullNoZWrite : EExtendedShader::ForcedAdditiveNoCull) : - EExtendedShader::ForcedAdditive; + (flags.m_noZWrite ? + EExtendedShader::ForcedAdditiveNoZWrite : + EExtendedShader::ForcedAdditive); else if (flags.x0_blendMode > 4) extended = flags.m_noCull ? (flags.m_noZWrite ? EExtendedShader::ForcedAlphaNoCullNoZWrite : EExtendedShader::ForcedAlphaNoCull) : - EExtendedShader::ForcedAlpha; + (flags.m_noZWrite ? + EExtendedShader::ForcedAlphaNoZWrite : + EExtendedShader::ForcedAlpha); else - extended = EExtendedShader::Lighting; + extended = flags.m_noCull ? (flags.m_noZWrite ? + EExtendedShader::ForcedAlphaNoCullNoZWrite : + EExtendedShader::ForcedAlphaNoCull) : + (flags.m_noZWrite ? + EExtendedShader::ForcedAlphaNoZWrite : + EExtendedShader::Lighting); + } + else if (flags.m_noCull && flags.m_noZWrite) + { + /* Substitute no-cull,no-zwrite pipeline if available */ + if (data.heclIr.m_blendDst == boo::BlendFactor::One) + extended = EExtendedShader::ForcedAdditiveNoCullNoZWrite; + else + extended = EExtendedShader::ForcedAlphaNoCullNoZWrite; } else if (flags.m_noCull) { /* Substitute no-cull pipeline if available */ - if (data.heclIr.m_blendDst == boo::BlendFactor::InvSrcAlpha) - extended = EExtendedShader::ForcedAlphaNoCull; - else if (data.heclIr.m_blendDst == boo::BlendFactor::One) + if (data.heclIr.m_blendDst == boo::BlendFactor::One) extended = EExtendedShader::ForcedAdditiveNoCull; else - extended = EExtendedShader::Lighting; + extended = EExtendedShader::ForcedAlphaNoCull; + } + else if (flags.m_noZWrite) + { + /* Substitute no-zwrite pipeline if available */ + if (data.heclIr.m_blendDst == boo::BlendFactor::One) + extended = EExtendedShader::ForcedAdditiveNoZWrite; + else + extended = EExtendedShader::ForcedAlphaNoZWrite; } else { @@ -1357,7 +1380,7 @@ size_t CModel::GetPoolVertexOffset(size_t idx) const zeus::CVector3f CModel::GetPoolVertex(size_t idx) const { auto* floats = reinterpret_cast(m_dynamicVertexData.get() + GetPoolVertexOffset(idx)); - return {floats[0], floats[1], floats[2]}; + return {floats}; } size_t CModel::GetPoolNormalOffset(size_t idx) const @@ -1368,7 +1391,7 @@ size_t CModel::GetPoolNormalOffset(size_t idx) const zeus::CVector3f CModel::GetPoolNormal(size_t idx) const { auto* floats = reinterpret_cast(m_dynamicVertexData.get() + GetPoolNormalOffset(idx)); - return {floats[0], floats[1], floats[2]}; + return {floats}; } void CModel::ApplyVerticesCPU(const boo::ObjToken& vertBuf, @@ -1389,6 +1412,14 @@ void CModel::ApplyVerticesCPU(const boo::ObjToken& vertBu vertBuf->unmap(); } +void CModel::RestoreVerticesCPU(const boo::ObjToken& vertBuf) const +{ + size_t size = m_hmdlMeta.vertStride * m_hmdlMeta.vertCount; + u8* data = reinterpret_cast(vertBuf->map(size)); + memcpy(data, m_dynamicVertexData.get(), size); + vertBuf->unmap(); +} + void CModel::_WarmupShaders() { CBooModel::SetDummyTextures(true); diff --git a/Runtime/Graphics/CSkinnedModel.cpp b/Runtime/Graphics/CSkinnedModel.cpp index 4ea8795e0..e4c12cacc 100644 --- a/Runtime/Graphics/CSkinnedModel.cpp +++ b/Runtime/Graphics/CSkinnedModel.cpp @@ -38,7 +38,8 @@ void CSkinnedModel::Calculate(const CPoseAsTransforms& pose, { if (morphEffect || g_PointGenFunc) { - if (boo::ObjToken vertBuf = m_modelInst->UpdateUniformData(drawFlags, nullptr, nullptr)) + if (boo::ObjToken vertBuf = + m_modelInst->UpdateUniformData(drawFlags, nullptr, nullptr)) { x10_skinRules->TransformVerticesCPU(m_vertWorkspace, pose, *x4_model); if (morphEffect) @@ -46,11 +47,20 @@ void CSkinnedModel::Calculate(const CPoseAsTransforms& pose, if (g_PointGenFunc) g_PointGenFunc(g_PointGenCtx, m_vertWorkspace); x4_model->ApplyVerticesCPU(vertBuf, m_vertWorkspace); + m_modifiedVBO = true; } } else { - m_modelInst->UpdateUniformData(drawFlags, x10_skinRules.GetObj(), &pose); + if (boo::ObjToken vertBuf = + m_modelInst->UpdateUniformData(drawFlags, x10_skinRules.GetObj(), &pose)) + { + if (m_modifiedVBO) + { + x4_model->RestoreVerticesCPU(vertBuf); + m_modifiedVBO = false; + } + } } } diff --git a/Runtime/Graphics/CSkinnedModel.hpp b/Runtime/Graphics/CSkinnedModel.hpp index 71891c471..436a44284 100644 --- a/Runtime/Graphics/CSkinnedModel.hpp +++ b/Runtime/Graphics/CSkinnedModel.hpp @@ -22,6 +22,7 @@ class CSkinnedModel TLockedToken x10_skinRules; TLockedToken x1c_layoutInfo; std::vector> m_vertWorkspace; + bool m_modifiedVBO = false; public: enum class EDataOwnership { diff --git a/Runtime/Graphics/Shaders/CModelShaders.hpp b/Runtime/Graphics/Shaders/CModelShaders.hpp index 582bbc66f..6d1805d68 100644 --- a/Runtime/Graphics/Shaders/CModelShaders.hpp +++ b/Runtime/Graphics/Shaders/CModelShaders.hpp @@ -29,6 +29,8 @@ enum EExtendedShader : uint8_t WorldShadow, ForcedAlphaNoCull, ForcedAdditiveNoCull, + ForcedAlphaNoZWrite, + ForcedAdditiveNoZWrite, ForcedAlphaNoCullNoZWrite, ForcedAdditiveNoCullNoZWrite }; diff --git a/Runtime/Graphics/Shaders/CModelShadersGLSL.cpp b/Runtime/Graphics/Shaders/CModelShadersGLSL.cpp index 84fa93c61..35746497d 100644 --- a/Runtime/Graphics/Shaders/CModelShadersGLSL.cpp +++ b/Runtime/Graphics/Shaders/CModelShadersGLSL.cpp @@ -271,6 +271,18 @@ CModelShaders::GetShaderExtensionsGLSL(boo::IGraphicsDataFactory::Platform plat) hecl::Backend::BlendFactor::One, hecl::Backend::ZTest::Original, hecl::Backend::CullMode::None, false, false, true); + /* Forced alpha shading without Z-write */ + ext.registerExtensionSlot({LightingGLSL, "LightingFunc"}, {MainPostGLSL, "MainPostFunc"}, + 3, BlockNames, 0, nullptr, hecl::Backend::BlendFactor::SrcAlpha, + hecl::Backend::BlendFactor::InvSrcAlpha, hecl::Backend::ZTest::Original, + hecl::Backend::CullMode::Original, true, false, true); + + /* Forced additive shading without Z-write */ + ext.registerExtensionSlot({LightingGLSL, "LightingFunc"}, {MainPostGLSL, "MainPostFunc"}, + 3, BlockNames, 0, nullptr, hecl::Backend::BlendFactor::SrcAlpha, + hecl::Backend::BlendFactor::One, hecl::Backend::ZTest::Original, + hecl::Backend::CullMode::Original, true, false, true); + /* Forced alpha shading without culling or Z-write */ ext.registerExtensionSlot({LightingGLSL, "LightingFunc"}, {MainPostGLSL, "MainPostFunc"}, 3, BlockNames, 0, nullptr, hecl::Backend::BlendFactor::SrcAlpha, diff --git a/Runtime/Graphics/Shaders/CModelShadersHLSL.cpp b/Runtime/Graphics/Shaders/CModelShadersHLSL.cpp index c2ea7503c..84f73354c 100644 --- a/Runtime/Graphics/Shaders/CModelShadersHLSL.cpp +++ b/Runtime/Graphics/Shaders/CModelShadersHLSL.cpp @@ -251,6 +251,18 @@ CModelShaders::GetShaderExtensionsHLSL(boo::IGraphicsDataFactory::Platform plat) hecl::Backend::BlendFactor::One, hecl::Backend::ZTest::Original, hecl::Backend::CullMode::None, false, false, true); + /* Forced alpha shading without Z-write */ + ext.registerExtensionSlot({LightingHLSL, "LightingFunc"}, {MainPostHLSL, "MainPostFunc"}, + 0, nullptr, 0, nullptr, hecl::Backend::BlendFactor::SrcAlpha, + hecl::Backend::BlendFactor::InvSrcAlpha, hecl::Backend::ZTest::Original, + hecl::Backend::CullMode::Original, true, false, true); + + /* Forced additive shading without Z-write */ + ext.registerExtensionSlot({LightingHLSL, "LightingFunc"}, {MainPostHLSL, "MainPostFunc"}, + 0, nullptr, 0, nullptr, hecl::Backend::BlendFactor::SrcAlpha, + hecl::Backend::BlendFactor::One, hecl::Backend::ZTest::Original, + hecl::Backend::CullMode::Original, true, false, true); + /* Forced alpha shading without culling or Z-write */ ext.registerExtensionSlot({LightingHLSL, "LightingFunc"}, {MainPostHLSL, "MainPostFunc"}, 0, nullptr, 0, nullptr, hecl::Backend::BlendFactor::SrcAlpha, diff --git a/Runtime/Graphics/Shaders/CModelShadersMetal.cpp b/Runtime/Graphics/Shaders/CModelShadersMetal.cpp index 05816dbcc..a5b1bf9fc 100644 --- a/Runtime/Graphics/Shaders/CModelShadersMetal.cpp +++ b/Runtime/Graphics/Shaders/CModelShadersMetal.cpp @@ -261,6 +261,18 @@ CModelShaders::GetShaderExtensionsMetal(boo::IGraphicsDataFactory::Platform plat hecl::Backend::BlendFactor::One, hecl::Backend::ZTest::Original, hecl::Backend::CullMode::None, false, false, true); + /* Forced alpha shading without Z-write */ + ext.registerExtensionSlot({LightingMetal, "LightingFunc"}, {MainPostMetal, "MainPostFunc"}, + 1, BlockNames, 0, nullptr, hecl::Backend::BlendFactor::SrcAlpha, + hecl::Backend::BlendFactor::InvSrcAlpha, hecl::Backend::ZTest::Original, + hecl::Backend::CullMode::Original, true, false, true); + + /* Forced additive shading without Z-write */ + ext.registerExtensionSlot({LightingMetal, "LightingFunc"}, {MainPostMetal, "MainPostFunc"}, + 1, BlockNames, 0, nullptr, hecl::Backend::BlendFactor::SrcAlpha, + hecl::Backend::BlendFactor::One, hecl::Backend::ZTest::Original, + hecl::Backend::CullMode::Original, true, false, true); + /* Forced alpha shading without culling or Z-write */ ext.registerExtensionSlot({LightingMetal, "LightingFunc"}, {MainPostMetal, "MainPostFunc"}, 1, BlockNames, 0, nullptr, hecl::Backend::BlendFactor::SrcAlpha, diff --git a/Runtime/GuiSys/CCompoundTargetReticle.cpp b/Runtime/GuiSys/CCompoundTargetReticle.cpp index e0e6e8bfa..5f4aeac63 100644 --- a/Runtime/GuiSys/CCompoundTargetReticle.cpp +++ b/Runtime/GuiSys/CCompoundTargetReticle.cpp @@ -350,9 +350,9 @@ void CCompoundTargetReticle::UpdateCurrLockOnGroup(float dt, const CStateManager IsGrappleTarget(targetId, mgr) ? g_tweakTargeting->GetGrappleMinClampScale() : 1.f, false); x16c_currGroupDur = xf0_targetId == kInvalidUniqueId ? g_tweakTargeting->GetCurrLockOnExitDuration() : g_tweakTargeting->GetCurrLockOnSwitchDuration(); - x170_currGroupTimer = x16c_currGroupDur; - xf0_targetId = targetId; } + x170_currGroupTimer = x16c_currGroupDur; + xf0_targetId = targetId; } if (x170_currGroupTimer > 0.f) { @@ -581,7 +581,7 @@ void CCompoundTargetReticle::DrawCurrLockOnGroup(const zeus::CMatrix3f& rot, con zeus::CMatrix3f lockBreakXf; zeus::CColor lockBreakColor = zeus::CColor::skClear; - if (IsDamageOrbit(mgr.GetPlayer().GetOrbitRequest()) && x14c_currGroupB.GetFactor() == 0) + if (IsDamageOrbit(mgr.GetPlayer().GetOrbitRequest()) && x14c_currGroupB.GetFactor() == 0.f) { zeus::CMatrix3f lockBreakRM; for (int i=0 ; i<4 ; ++i) diff --git a/Runtime/MP1/CFrontEndUI.cpp b/Runtime/MP1/CFrontEndUI.cpp index ed6f813f3..d68e0e8a0 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(1); + g_GameState->CurrentWorldState().SetAreaId(0); g_GameState->GameOptions().ResetToDefaults(); g_GameState->WriteBackupBuf(); diff --git a/Runtime/Particle/CWeaponDescription.hpp b/Runtime/Particle/CWeaponDescription.hpp index 7fe920449..cf97cb6b8 100644 --- a/Runtime/Particle/CWeaponDescription.hpp +++ b/Runtime/Particle/CWeaponDescription.hpp @@ -53,7 +53,7 @@ public: bool xa4_EWTR = true; bool xa5_LWTR = true; bool xa6_SWTR = true; - s32 xa8_PJFX; + s32 xa8_PJFX = -1; std::unique_ptr xac_RNGE; std::unique_ptr xb0_FOFF; }; diff --git a/Runtime/Weapon/CEnergyProjectile.cpp b/Runtime/Weapon/CEnergyProjectile.cpp index 4b0c909f3..b749cd749 100644 --- a/Runtime/Weapon/CEnergyProjectile.cpp +++ b/Runtime/Weapon/CEnergyProjectile.cpp @@ -31,14 +31,14 @@ CEnergyProjectile::CEnergyProjectile(bool active, const TToken= 0.f) + s32 sfxId = x170_projectile.GetSoundIdForCollision(type); + if (sfxId >= 0) { CAudioSys::C3DEmitterParmData parmData = {}; parmData.x18_maxDist = x170_projectile.GetAudibleRange(); parmData.x1c_distComp = x170_projectile.GetAudibleFallOff(); parmData.x20_flags = 0x1; // Continuous parameter update - parmData.x24_sfxId = CSfxManager::TranslateSFXID(sfxId); + parmData.x24_sfxId = CSfxManager::TranslateSFXID(u16(sfxId)); parmData.x26_maxVol = 1.f; parmData.x27_minVol = 0.16f; parmData.x29_prio = 0x7f; diff --git a/Runtime/Weapon/CProjectileWeapon.cpp b/Runtime/Weapon/CProjectileWeapon.cpp index d225d986b..92692927f 100644 --- a/Runtime/Weapon/CProjectileWeapon.cpp +++ b/Runtime/Weapon/CProjectileWeapon.cpp @@ -168,11 +168,11 @@ CProjectileWeapon::GetDecalForCollision(EWeaponCollisionResponseTypes type) cons return x4_weaponDesc->x94_COLR.m_res->GetDecalDescription(type); } -u16 CProjectileWeapon::GetSoundIdForCollision(EWeaponCollisionResponseTypes type) const +s32 CProjectileWeapon::GetSoundIdForCollision(EWeaponCollisionResponseTypes type) const { if (!x4_weaponDesc->x94_COLR) - return 0xffff; - return u16(x4_weaponDesc->x94_COLR.m_res->GetSoundEffectId(type)); + return -1; + return x4_weaponDesc->x94_COLR.m_res->GetSoundEffectId(type); } std::experimental::optional> diff --git a/Runtime/Weapon/CProjectileWeapon.hpp b/Runtime/Weapon/CProjectileWeapon.hpp index 9224decd1..6c1801ee3 100644 --- a/Runtime/Weapon/CProjectileWeapon.hpp +++ b/Runtime/Weapon/CProjectileWeapon.hpp @@ -78,7 +78,7 @@ public: float GetAudibleRange() const; std::experimental::optional> GetDecalForCollision(EWeaponCollisionResponseTypes type) const; - u16 GetSoundIdForCollision(EWeaponCollisionResponseTypes type) const; + s32 GetSoundIdForCollision(EWeaponCollisionResponseTypes type) const; std::experimental::optional> CollisionOccured(EWeaponCollisionResponseTypes type, bool deflected, bool useTarget, const zeus::CVector3f& pos, const zeus::CVector3f& normal, const zeus::CVector3f& target); diff --git a/Runtime/World/CWorld.cpp b/Runtime/World/CWorld.cpp index d759076b1..3d828cab5 100644 --- a/Runtime/World/CWorld.cpp +++ b/Runtime/World/CWorld.cpp @@ -723,6 +723,7 @@ void CWorld::DrawSky(const zeus::CTransform& xf) const CGraphics::SetDepthRange(DEPTH_SKY, DEPTH_FAR); CModelFlags flags(0, 0, 1, zeus::CColor::skWhite); + flags.m_noZWrite = true; model->Draw(flags); CGraphics::SetDepthRange(DEPTH_WORLD, DEPTH_FAR); diff --git a/hecl b/hecl index 29830aacb..ed2e587c3 160000 --- a/hecl +++ b/hecl @@ -1 +1 @@ -Subproject commit 29830aacb55bd35f05e9ef79e087b9363c01c95a +Subproject commit ed2e587c3af34009200dbb2e6eb5f3e376479a4c diff --git a/specter b/specter index e3901665c..498c57005 160000 --- a/specter +++ b/specter @@ -1 +1 @@ -Subproject commit e3901665c3a2984f51aad77fb4920858e87f2764 +Subproject commit 498c570050df733cb7c8a97c262d76920b5aac16