Lots of bug fixes

This commit is contained in:
Jack Andersen 2018-05-09 21:25:26 -10:00
parent b58ebc1af5
commit 12430610f1
23 changed files with 129 additions and 43 deletions

View File

@ -245,30 +245,29 @@ void CRSM<IDType>::_write(athena::io::IStreamWriter& w) const
w.writeBytes("CRSM", 4); w.writeBytes("CRSM", 4);
for (const auto& pair : x0_generators) for (const auto& pair : x0_generators)
{ {
if (pair.second) w.writeBytes(pair.first.getChars(), 4);
{
w.writeBytes(pair.first.toString().c_str(), 4);
pair.second.write(w); pair.second.write(w);
} }
}
for (const auto& pair : x10_sfx) for (const auto& pair : x10_sfx)
{ {
w.writeBytes(pair.first.getChars(), 4);
if (pair.second != ~0) if (pair.second != ~0)
{ {
w.writeBytes(pair.first.toString().c_str(), 4); w.writeBytes("CNST", 4);
w.writeUint32Big(pair.second); w.writeUint32Big(pair.second);
} }
else
{
w.writeBytes("NONE", 4);
}
} }
for (const auto& pair : x20_decals) for (const auto& pair : x20_decals)
{ {
if (pair.second) w.writeBytes(pair.first.getChars(), 4);
{
w.writeBytes(pair.first.toString().c_str(), 4);
pair.second.write(w); pair.second.write(w);
} }
}
if (x30_RNGE != 50.f) if (x30_RNGE != 50.f)
{ {

View File

@ -301,6 +301,8 @@ bool ViewManager::proc()
g_ResFactory->AsyncIdle(); g_ResFactory->AsyncIdle();
if (!m_skipWait || !hecl::com_developer->toBoolean()) if (!m_skipWait || !hecl::com_developer->toBoolean())
m_mainWindow->waitForRetrace(m_voiceEngine.get()); m_mainWindow->waitForRetrace(m_voiceEngine.get());
else
m_voiceEngine->pumpAndMixVoices();
CBooModel::ClearModelUniformCounters(); CBooModel::ClearModelUniformCounters();
CGraphics::TickRenderTimings(); CGraphics::TickRenderTimings();
++logvisor::FrameIndex; ++logvisor::FrameIndex;

View File

@ -1,5 +1,7 @@
#include "CSortedLists.hpp" #include "CSortedLists.hpp"
#include "World/CActor.hpp" #include "World/CActor.hpp"
#include "Weapon/CEnergyProjectile.hpp"
#include "TCastTo.hpp"
namespace urde 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)] >= 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)]) AccessElement(x0_nodes, AccessElement(sl.x0_ids, idx)).x4_box[int(list)])
return; 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)); 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 */ /* Do insert */
AccessElement(sl.x0_ids, insIdx) = node.x0_actor->GetUniqueId().Value(); 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; ++sl.x800_size;
} }

View File

@ -26,7 +26,6 @@ CCameraManager::CCameraManager(TUniqueId curCameraId) : x0_curCameraId(curCamera
{ {
CSfxManager::AddListener(CSfxManager::ESfxChannels::Game, zeus::CVector3f::skZero, zeus::CVector3f::skZero, 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); {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(); sFirstPersonFOV = g_tweakGame->GetFirstPersonFOV();
} }

View File

@ -153,7 +153,7 @@ void CFirstPersonCamera::UpdateTransform(CStateManager& mgr, float dt)
const CActor* act = TCastToConstPtr<CActor>(mgr.GetObjectById(player->x310_orbitTargetId)); const CActor* act = TCastToConstPtr<CActor>(mgr.GetObjectById(player->x310_orbitTargetId));
if (act && act->GetMaterialList().HasMaterial(EMaterialTypes::Orbit)) 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()) if (v.canBeNormalized())
v.normalize(); v.normalize();

View File

@ -39,9 +39,9 @@ void CSkinRules::TransformVerticesCPU(std::vector<std::pair<zeus::CVector3f, zeu
{ {
const zeus::CTransform& xf = pose.GetRestToAccumTransform(w.m_id); const zeus::CTransform& xf = pose.GetRestToAccumTransform(w.m_id);
vertex += (xf * origVertex) * w.m_weight; vertex += (xf * origVertex) * w.m_weight;
normal += (xf.basis.inverted().transposed() * origVertex) * w.m_weight; normal += (xf.basis.inverted().transposed() * origNormal) * w.m_weight;
} }
vnOut[i] = std::make_pair(vertex, normal); vnOut[i] = std::make_pair(vertex, normal.normalized());
} }
} }

View File

@ -320,6 +320,7 @@ public:
zeus::CVector3f GetPoolNormal(size_t idx) const; zeus::CVector3f GetPoolNormal(size_t idx) const;
void ApplyVerticesCPU(const boo::ObjToken<boo::IGraphicsBufferD>& vertBuf, void ApplyVerticesCPU(const boo::ObjToken<boo::IGraphicsBufferD>& vertBuf,
const std::vector<std::pair<zeus::CVector3f, zeus::CVector3f>>& vn) const; const std::vector<std::pair<zeus::CVector3f, zeus::CVector3f>>& vn) const;
void RestoreVerticesCPU(const boo::ObjToken<boo::IGraphicsBufferD>& vertBuf) const;
void _WarmupShaders(); void _WarmupShaders();
static void WarmupShaders(const SObjectTag& cmdlTag); static void WarmupShaders(const SObjectTag& cmdlTag);

View File

@ -281,7 +281,7 @@ CBooModel::ModelInstance* CBooModel::PushNewModelInstance(int sharedLayoutBuf)
m_instances.emplace_back(); m_instances.emplace_back();
ModelInstance& newInst = m_instances.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 */ /* Build geometry uniform buffer if shared not available */
boo::ObjToken<boo::IGraphicsBufferD> geomUniformBuf; boo::ObjToken<boo::IGraphicsBufferD> geomUniformBuf;
@ -643,24 +643,47 @@ void CBooModel::DrawSurface(const CBooSurface& surf, const CModelFlags& flags) c
extended = flags.m_noCull ? (flags.m_noZWrite ? extended = flags.m_noCull ? (flags.m_noZWrite ?
EExtendedShader::ForcedAdditiveNoCullNoZWrite : EExtendedShader::ForcedAdditiveNoCullNoZWrite :
EExtendedShader::ForcedAdditiveNoCull) : EExtendedShader::ForcedAdditiveNoCull) :
EExtendedShader::ForcedAdditive; (flags.m_noZWrite ?
EExtendedShader::ForcedAdditiveNoZWrite :
EExtendedShader::ForcedAdditive);
else if (flags.x0_blendMode > 4) else if (flags.x0_blendMode > 4)
extended = flags.m_noCull ? (flags.m_noZWrite ? extended = flags.m_noCull ? (flags.m_noZWrite ?
EExtendedShader::ForcedAlphaNoCullNoZWrite : EExtendedShader::ForcedAlphaNoCullNoZWrite :
EExtendedShader::ForcedAlphaNoCull) : EExtendedShader::ForcedAlphaNoCull) :
EExtendedShader::ForcedAlpha; (flags.m_noZWrite ?
EExtendedShader::ForcedAlphaNoZWrite :
EExtendedShader::ForcedAlpha);
else 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) else if (flags.m_noCull)
{ {
/* Substitute no-cull pipeline if available */ /* Substitute no-cull pipeline if available */
if (data.heclIr.m_blendDst == boo::BlendFactor::InvSrcAlpha) if (data.heclIr.m_blendDst == boo::BlendFactor::One)
extended = EExtendedShader::ForcedAlphaNoCull;
else if (data.heclIr.m_blendDst == boo::BlendFactor::One)
extended = EExtendedShader::ForcedAdditiveNoCull; extended = EExtendedShader::ForcedAdditiveNoCull;
else 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 else
{ {
@ -1357,7 +1380,7 @@ size_t CModel::GetPoolVertexOffset(size_t idx) const
zeus::CVector3f CModel::GetPoolVertex(size_t idx) const zeus::CVector3f CModel::GetPoolVertex(size_t idx) const
{ {
auto* floats = reinterpret_cast<const float*>(m_dynamicVertexData.get() + GetPoolVertexOffset(idx)); auto* floats = reinterpret_cast<const float*>(m_dynamicVertexData.get() + GetPoolVertexOffset(idx));
return {floats[0], floats[1], floats[2]}; return {floats};
} }
size_t CModel::GetPoolNormalOffset(size_t idx) const 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 zeus::CVector3f CModel::GetPoolNormal(size_t idx) const
{ {
auto* floats = reinterpret_cast<const float*>(m_dynamicVertexData.get() + GetPoolNormalOffset(idx)); auto* floats = reinterpret_cast<const float*>(m_dynamicVertexData.get() + GetPoolNormalOffset(idx));
return {floats[0], floats[1], floats[2]}; return {floats};
} }
void CModel::ApplyVerticesCPU(const boo::ObjToken<boo::IGraphicsBufferD>& vertBuf, void CModel::ApplyVerticesCPU(const boo::ObjToken<boo::IGraphicsBufferD>& vertBuf,
@ -1389,6 +1412,14 @@ void CModel::ApplyVerticesCPU(const boo::ObjToken<boo::IGraphicsBufferD>& vertBu
vertBuf->unmap(); vertBuf->unmap();
} }
void CModel::RestoreVerticesCPU(const boo::ObjToken<boo::IGraphicsBufferD>& vertBuf) const
{
size_t size = m_hmdlMeta.vertStride * m_hmdlMeta.vertCount;
u8* data = reinterpret_cast<u8*>(vertBuf->map(size));
memcpy(data, m_dynamicVertexData.get(), size);
vertBuf->unmap();
}
void CModel::_WarmupShaders() void CModel::_WarmupShaders()
{ {
CBooModel::SetDummyTextures(true); CBooModel::SetDummyTextures(true);

View File

@ -38,7 +38,8 @@ void CSkinnedModel::Calculate(const CPoseAsTransforms& pose,
{ {
if (morphEffect || g_PointGenFunc) if (morphEffect || g_PointGenFunc)
{ {
if (boo::ObjToken<boo::IGraphicsBufferD> vertBuf = m_modelInst->UpdateUniformData(drawFlags, nullptr, nullptr)) if (boo::ObjToken<boo::IGraphicsBufferD> vertBuf =
m_modelInst->UpdateUniformData(drawFlags, nullptr, nullptr))
{ {
x10_skinRules->TransformVerticesCPU(m_vertWorkspace, pose, *x4_model); x10_skinRules->TransformVerticesCPU(m_vertWorkspace, pose, *x4_model);
if (morphEffect) if (morphEffect)
@ -46,11 +47,20 @@ void CSkinnedModel::Calculate(const CPoseAsTransforms& pose,
if (g_PointGenFunc) if (g_PointGenFunc)
g_PointGenFunc(g_PointGenCtx, m_vertWorkspace); g_PointGenFunc(g_PointGenCtx, m_vertWorkspace);
x4_model->ApplyVerticesCPU(vertBuf, m_vertWorkspace); x4_model->ApplyVerticesCPU(vertBuf, m_vertWorkspace);
m_modifiedVBO = true;
} }
} }
else else
{ {
m_modelInst->UpdateUniformData(drawFlags, x10_skinRules.GetObj(), &pose); if (boo::ObjToken<boo::IGraphicsBufferD> vertBuf =
m_modelInst->UpdateUniformData(drawFlags, x10_skinRules.GetObj(), &pose))
{
if (m_modifiedVBO)
{
x4_model->RestoreVerticesCPU(vertBuf);
m_modifiedVBO = false;
}
}
} }
} }

View File

@ -22,6 +22,7 @@ class CSkinnedModel
TLockedToken<CSkinRules> x10_skinRules; TLockedToken<CSkinRules> x10_skinRules;
TLockedToken<CCharLayoutInfo> x1c_layoutInfo; TLockedToken<CCharLayoutInfo> x1c_layoutInfo;
std::vector<std::pair<zeus::CVector3f, zeus::CVector3f>> m_vertWorkspace; std::vector<std::pair<zeus::CVector3f, zeus::CVector3f>> m_vertWorkspace;
bool m_modifiedVBO = false;
public: public:
enum class EDataOwnership enum class EDataOwnership
{ {

View File

@ -29,6 +29,8 @@ enum EExtendedShader : uint8_t
WorldShadow, WorldShadow,
ForcedAlphaNoCull, ForcedAlphaNoCull,
ForcedAdditiveNoCull, ForcedAdditiveNoCull,
ForcedAlphaNoZWrite,
ForcedAdditiveNoZWrite,
ForcedAlphaNoCullNoZWrite, ForcedAlphaNoCullNoZWrite,
ForcedAdditiveNoCullNoZWrite ForcedAdditiveNoCullNoZWrite
}; };

View File

@ -271,6 +271,18 @@ CModelShaders::GetShaderExtensionsGLSL(boo::IGraphicsDataFactory::Platform plat)
hecl::Backend::BlendFactor::One, hecl::Backend::ZTest::Original, hecl::Backend::BlendFactor::One, hecl::Backend::ZTest::Original,
hecl::Backend::CullMode::None, false, false, true); 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 */ /* Forced alpha shading without culling or Z-write */
ext.registerExtensionSlot({LightingGLSL, "LightingFunc"}, {MainPostGLSL, "MainPostFunc"}, ext.registerExtensionSlot({LightingGLSL, "LightingFunc"}, {MainPostGLSL, "MainPostFunc"},
3, BlockNames, 0, nullptr, hecl::Backend::BlendFactor::SrcAlpha, 3, BlockNames, 0, nullptr, hecl::Backend::BlendFactor::SrcAlpha,

View File

@ -251,6 +251,18 @@ CModelShaders::GetShaderExtensionsHLSL(boo::IGraphicsDataFactory::Platform plat)
hecl::Backend::BlendFactor::One, hecl::Backend::ZTest::Original, hecl::Backend::BlendFactor::One, hecl::Backend::ZTest::Original,
hecl::Backend::CullMode::None, false, false, true); 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 */ /* Forced alpha shading without culling or Z-write */
ext.registerExtensionSlot({LightingHLSL, "LightingFunc"}, {MainPostHLSL, "MainPostFunc"}, ext.registerExtensionSlot({LightingHLSL, "LightingFunc"}, {MainPostHLSL, "MainPostFunc"},
0, nullptr, 0, nullptr, hecl::Backend::BlendFactor::SrcAlpha, 0, nullptr, 0, nullptr, hecl::Backend::BlendFactor::SrcAlpha,

View File

@ -261,6 +261,18 @@ CModelShaders::GetShaderExtensionsMetal(boo::IGraphicsDataFactory::Platform plat
hecl::Backend::BlendFactor::One, hecl::Backend::ZTest::Original, hecl::Backend::BlendFactor::One, hecl::Backend::ZTest::Original,
hecl::Backend::CullMode::None, false, false, true); 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 */ /* Forced alpha shading without culling or Z-write */
ext.registerExtensionSlot({LightingMetal, "LightingFunc"}, {MainPostMetal, "MainPostFunc"}, ext.registerExtensionSlot({LightingMetal, "LightingFunc"}, {MainPostMetal, "MainPostFunc"},
1, BlockNames, 0, nullptr, hecl::Backend::BlendFactor::SrcAlpha, 1, BlockNames, 0, nullptr, hecl::Backend::BlendFactor::SrcAlpha,

View File

@ -350,10 +350,10 @@ void CCompoundTargetReticle::UpdateCurrLockOnGroup(float dt, const CStateManager
IsGrappleTarget(targetId, mgr) ? g_tweakTargeting->GetGrappleMinClampScale() : 1.f, false); IsGrappleTarget(targetId, mgr) ? g_tweakTargeting->GetGrappleMinClampScale() : 1.f, false);
x16c_currGroupDur = xf0_targetId == kInvalidUniqueId ? g_tweakTargeting->GetCurrLockOnExitDuration() : x16c_currGroupDur = xf0_targetId == kInvalidUniqueId ? g_tweakTargeting->GetCurrLockOnExitDuration() :
g_tweakTargeting->GetCurrLockOnSwitchDuration(); g_tweakTargeting->GetCurrLockOnSwitchDuration();
}
x170_currGroupTimer = x16c_currGroupDur; x170_currGroupTimer = x16c_currGroupDur;
xf0_targetId = targetId; xf0_targetId = targetId;
} }
}
if (x170_currGroupTimer > 0.f) if (x170_currGroupTimer > 0.f)
{ {
UpdateTargetParameters(x12c_currGroupA, mgr); UpdateTargetParameters(x12c_currGroupA, mgr);
@ -581,7 +581,7 @@ void CCompoundTargetReticle::DrawCurrLockOnGroup(const zeus::CMatrix3f& rot, con
zeus::CMatrix3f lockBreakXf; zeus::CMatrix3f lockBreakXf;
zeus::CColor lockBreakColor = zeus::CColor::skClear; 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; zeus::CMatrix3f lockBreakRM;
for (int i=0 ; i<4 ; ++i) for (int i=0 ; i<4 ; ++i)

View File

@ -2006,7 +2006,7 @@ CFrontEndUI::CFrontEndUI()
m->ResetGameState(); m->ResetGameState();
g_GameState->SetCurrentWorldId(g_ResFactory->TranslateOriginalToNew(g_DefaultWorldTag.id)); 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->GameOptions().ResetToDefaults();
g_GameState->WriteBackupBuf(); g_GameState->WriteBackupBuf();

View File

@ -53,7 +53,7 @@ public:
bool xa4_EWTR = true; bool xa4_EWTR = true;
bool xa5_LWTR = true; bool xa5_LWTR = true;
bool xa6_SWTR = true; bool xa6_SWTR = true;
s32 xa8_PJFX; s32 xa8_PJFX = -1;
std::unique_ptr<CRealElement> xac_RNGE; std::unique_ptr<CRealElement> xac_RNGE;
std::unique_ptr<CRealElement> xb0_FOFF; std::unique_ptr<CRealElement> xb0_FOFF;
}; };

View File

@ -31,14 +31,14 @@ CEnergyProjectile::CEnergyProjectile(bool active, const TToken<CWeaponDescriptio
void CEnergyProjectile::PlayImpactSound(const zeus::CVector3f& pos, EWeaponCollisionResponseTypes type) void CEnergyProjectile::PlayImpactSound(const zeus::CVector3f& pos, EWeaponCollisionResponseTypes type)
{ {
u16 sfxId = x170_projectile.GetSoundIdForCollision(type); s32 sfxId = x170_projectile.GetSoundIdForCollision(type);
if (sfxId >= 0.f) if (sfxId >= 0)
{ {
CAudioSys::C3DEmitterParmData parmData = {}; CAudioSys::C3DEmitterParmData parmData = {};
parmData.x18_maxDist = x170_projectile.GetAudibleRange(); parmData.x18_maxDist = x170_projectile.GetAudibleRange();
parmData.x1c_distComp = x170_projectile.GetAudibleFallOff(); parmData.x1c_distComp = x170_projectile.GetAudibleFallOff();
parmData.x20_flags = 0x1; // Continuous parameter update 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.x26_maxVol = 1.f;
parmData.x27_minVol = 0.16f; parmData.x27_minVol = 0.16f;
parmData.x29_prio = 0x7f; parmData.x29_prio = 0x7f;

View File

@ -168,11 +168,11 @@ CProjectileWeapon::GetDecalForCollision(EWeaponCollisionResponseTypes type) cons
return x4_weaponDesc->x94_COLR.m_res->GetDecalDescription(type); 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) if (!x4_weaponDesc->x94_COLR)
return 0xffff; return -1;
return u16(x4_weaponDesc->x94_COLR.m_res->GetSoundEffectId(type)); return x4_weaponDesc->x94_COLR.m_res->GetSoundEffectId(type);
} }
std::experimental::optional<TLockedToken<CGenDescription>> std::experimental::optional<TLockedToken<CGenDescription>>

View File

@ -78,7 +78,7 @@ public:
float GetAudibleRange() const; float GetAudibleRange() const;
std::experimental::optional<TLockedToken<CDecalDescription>> std::experimental::optional<TLockedToken<CDecalDescription>>
GetDecalForCollision(EWeaponCollisionResponseTypes type) const; GetDecalForCollision(EWeaponCollisionResponseTypes type) const;
u16 GetSoundIdForCollision(EWeaponCollisionResponseTypes type) const; s32 GetSoundIdForCollision(EWeaponCollisionResponseTypes type) const;
std::experimental::optional<TLockedToken<CGenDescription>> std::experimental::optional<TLockedToken<CGenDescription>>
CollisionOccured(EWeaponCollisionResponseTypes type, bool deflected, bool useTarget, const zeus::CVector3f& pos, CollisionOccured(EWeaponCollisionResponseTypes type, bool deflected, bool useTarget, const zeus::CVector3f& pos,
const zeus::CVector3f& normal, const zeus::CVector3f& target); const zeus::CVector3f& normal, const zeus::CVector3f& target);

View File

@ -723,6 +723,7 @@ void CWorld::DrawSky(const zeus::CTransform& xf) const
CGraphics::SetDepthRange(DEPTH_SKY, DEPTH_FAR); CGraphics::SetDepthRange(DEPTH_SKY, DEPTH_FAR);
CModelFlags flags(0, 0, 1, zeus::CColor::skWhite); CModelFlags flags(0, 0, 1, zeus::CColor::skWhite);
flags.m_noZWrite = true;
model->Draw(flags); model->Draw(flags);
CGraphics::SetDepthRange(DEPTH_WORLD, DEPTH_FAR); CGraphics::SetDepthRange(DEPTH_WORLD, DEPTH_FAR);

2
hecl

@ -1 +1 @@
Subproject commit 29830aacb55bd35f05e9ef79e087b9363c01c95a Subproject commit ed2e587c3af34009200dbb2e6eb5f3e376479a4c

@ -1 +1 @@
Subproject commit e3901665c3a2984f51aad77fb4920858e87f2764 Subproject commit 498c570050df733cb7c8a97c262d76920b5aac16