From c70a0d81cb4e9de58ae7600369154150e9b4034d Mon Sep 17 00:00:00 2001 From: Phillip Stephens Date: Tue, 9 May 2017 17:03:20 -0700 Subject: [PATCH 1/2] Fix CInputGenerator, CRadarPaintShaderGLSL and CPhazonSuitFilterGLSL crashes --- Runtime/Graphics/Shaders/CPhazonSuitFilterGLSL.cpp | 2 +- Runtime/Graphics/Shaders/CRadarPaintShaderGLSL.cpp | 2 +- Runtime/Input/CInputGenerator.hpp | 3 ++- Runtime/MP1/World/CActorContraption.cpp | 2 +- hecl | 2 +- 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Runtime/Graphics/Shaders/CPhazonSuitFilterGLSL.cpp b/Runtime/Graphics/Shaders/CPhazonSuitFilterGLSL.cpp index 38ba01299..8a0d2ce43 100644 --- a/Runtime/Graphics/Shaders/CPhazonSuitFilterGLSL.cpp +++ b/Runtime/Graphics/Shaders/CPhazonSuitFilterGLSL.cpp @@ -92,7 +92,7 @@ static const char* BlurVS = "#version 330\n" BOO_GLSL_BINDING_HEAD "layout(location=0) in vec4 posIn;\n" -"layout(location=3) in vec4 uvIn;\n" +"layout(location=1) in vec4 uvIn;\n" "\n" "UBINDING0 uniform PhazonSuitBlurUniform\n" "{\n" diff --git a/Runtime/Graphics/Shaders/CRadarPaintShaderGLSL.cpp b/Runtime/Graphics/Shaders/CRadarPaintShaderGLSL.cpp index cf796fe0a..33c6150be 100644 --- a/Runtime/Graphics/Shaders/CRadarPaintShaderGLSL.cpp +++ b/Runtime/Graphics/Shaders/CRadarPaintShaderGLSL.cpp @@ -126,7 +126,7 @@ CRadarPaintShader::Initialize(boo::VulkanDataFactory::Context& ctx) {nullptr, nullptr, boo::VertexSemantic::UV4, 3}, {nullptr, nullptr, boo::VertexSemantic::Color} }; - s_VtxFmt = ctx.newVertexFormat(2, VtxVmt); + s_VtxFmt = ctx.newVertexFormat(9, VtxVmt); s_Pipeline = ctx.newShaderPipeline(VS, FS, s_VtxFmt, boo::BlendFactor::SrcAlpha, boo::BlendFactor::One, boo::Primitive::TriStrips, boo::ZTest::None, false, true, false, boo::CullMode::None); diff --git a/Runtime/Input/CInputGenerator.hpp b/Runtime/Input/CInputGenerator.hpp index a5eb3f619..3da1ef698 100644 --- a/Runtime/Input/CInputGenerator.hpp +++ b/Runtime/Input/CInputGenerator.hpp @@ -179,7 +179,8 @@ public: if (!smashAdapter) { smashAdapter = std::dynamic_pointer_cast(tok.openAndGetDevice()); - smashAdapter->setCallback(&m_dolphinCb); + if (smashAdapter) + smashAdapter->setCallback(&m_dolphinCb); } } void deviceDisconnected(boo::DeviceToken&, boo::DeviceBase* device) diff --git a/Runtime/MP1/World/CActorContraption.cpp b/Runtime/MP1/World/CActorContraption.cpp index 39bbd26d0..3235480cb 100644 --- a/Runtime/MP1/World/CActorContraption.cpp +++ b/Runtime/MP1/World/CActorContraption.cpp @@ -36,7 +36,7 @@ void MP1::CActorContraption::Think(float dt, CStateManager& mgr) if (act && act->GetActive()) { - act->SetTransform(act->GetScaledLocatorTransform(uid.second)); + act->SetTransform(x34_transform * act->GetScaledLocatorTransform(uid.second)); } } } diff --git a/hecl b/hecl index 104d554f4..b25f7f300 160000 --- a/hecl +++ b/hecl @@ -1 +1 @@ -Subproject commit 104d554f42102390ddcc52fe50832097b78c6c08 +Subproject commit b25f7f30026b51ae5f3025efbade3d88c933dbe0 From 3c566c2d8ced39ed92a798dc2e413c127716a791 Mon Sep 17 00:00:00 2001 From: Phillip Stephens Date: Wed, 10 May 2017 03:03:29 -0700 Subject: [PATCH 2/2] Minor CActorParameters cleanup, initial CFlameThrower --- Runtime/Weapon/CFlameInfo.hpp | 4 ++-- Runtime/Weapon/CFlameThrower.cpp | 12 +++++++++++- Runtime/Weapon/CFlameThrower.hpp | 7 ++++++- Runtime/World/CActorParameters.hpp | 27 +++++++++++++++++---------- Runtime/World/ScriptLoader.cpp | 6 +++--- 5 files changed, 39 insertions(+), 17 deletions(-) diff --git a/Runtime/Weapon/CFlameInfo.hpp b/Runtime/Weapon/CFlameInfo.hpp index 45561ff4a..f27f3b158 100644 --- a/Runtime/Weapon/CFlameInfo.hpp +++ b/Runtime/Weapon/CFlameInfo.hpp @@ -7,13 +7,13 @@ namespace urde { class CFlameInfo { - ResId x4_flameFxId; + ResId x8_flameFxId; public: CFlameInfo(s32, u32, s32, s32, float, float, float); void GetAttributes() const; void GetLength() const; - ResId GetFlameFxId() const { x4_flameFxId; } + ResId GetFlameFxId() const { return x8_flameFxId; } }; } #endif // __URDE_CFLAMEINFO_HPP__ diff --git a/Runtime/Weapon/CFlameThrower.cpp b/Runtime/Weapon/CFlameThrower.cpp index 493efb38a..8adb36854 100644 --- a/Runtime/Weapon/CFlameThrower.cpp +++ b/Runtime/Weapon/CFlameThrower.cpp @@ -1,5 +1,9 @@ #include "Weapon/CFlameThrower.hpp" - +#include "Weapon/CFlameInfo.hpp" +#include "Particle/CElementGen.hpp" +#include "GameGlobalObjects.hpp" +#include "CSimplePool.hpp" +#include "TCastTo.hpp" namespace urde { const zeus::CVector3f CFlameThrower::kLightOffset(0, 3.f, 2.f); @@ -9,8 +13,14 @@ CFlameThrower::CFlameThrower(const TToken& wDesc, const std: const CDamageInfo& dInfo, TUniqueId owner, TAreaId aId, TUniqueId uid, u32 w1) : CGameProjectile(false, wDesc, name, wType, xf, matType, dInfo, owner, aId, uid, kInvalidUniqueId, w1, false, zeus::CVector3f(1.f), {}, -1, false) +, x2e8_(xf) +, x33c_flameDesc(g_SimplePool->GetObj({flameInfo.GetFlameFxId(), SBIG('PART')})) +, x348_flameGen(new CElementGen(x33c_flameDesc, CElementGen::EModelOrientationType::Normal, + CElementGen::EOptionalSystemFlags::One)) { } +void CFlameThrower::Accept(IVisitor& visitor) { visitor.Visit(this); } + void CFlameThrower::SetTransform(const zeus::CTransform& xf) { x2e8_ = xf; } } diff --git a/Runtime/Weapon/CFlameThrower.hpp b/Runtime/Weapon/CFlameThrower.hpp index 81ff49261..5afb4ead7 100644 --- a/Runtime/Weapon/CFlameThrower.hpp +++ b/Runtime/Weapon/CFlameThrower.hpp @@ -6,16 +6,21 @@ namespace urde { class CFlameInfo; +class CElementGen; class CFlameThrower : public CGameProjectile { static const zeus::CVector3f kLightOffset; zeus::CTransform x2e8_; - + zeus::CAABox x318_ = zeus::CAABox::skNullBox; + TToken x33c_flameDesc; + std::unique_ptr x348_flameGen; public: CFlameThrower(const TToken& wDesc, const std::string& name, EWeaponType wType, const CFlameInfo& flameInfo, const zeus::CTransform& xf, EMaterialTypes matType, const CDamageInfo& dInfo, TUniqueId owner, TAreaId aId, TUniqueId uid, u32 w1); + void Accept(IVisitor &visitor); + void SetTransform(const zeus::CTransform& xf); }; } diff --git a/Runtime/World/CActorParameters.hpp b/Runtime/World/CActorParameters.hpp index 69a5d8f24..c5de8c8e5 100644 --- a/Runtime/World/CActorParameters.hpp +++ b/Runtime/World/CActorParameters.hpp @@ -16,28 +16,35 @@ class CActorParameters std::pair x44_xrayAssets = {}; std::pair x4c_thermalAssets = {}; CVisorParameters x54_visorParms; - bool b1 : 1; - bool b2 : 1; - bool b3 : 1; - bool b4 : 1; + union + { + struct + { + bool x58_24_ : 1; + bool x58_25_thermalHeat : 1; + bool x58_26_ : 1; + bool x58_27_ : 1; + }; + u32 _dummy = 0; + }; float x5c_ = 0.f; float x60_ = 0.f; float x64_ = 0.f; public: - CActorParameters() : b1(true), b2(false), b3(false), b4(false) {} + CActorParameters() : x58_24_(true), x58_25_thermalHeat(false), x58_26_(false), x58_27_(false) {} CActorParameters(const CLightParameters& lightParms, const CScannableParameters& scanParms, const std::pair& xrayAssets, const std::pair& thermalAssets, - const CVisorParameters& visorParms, bool a, bool b, bool c, bool d) + const CVisorParameters& visorParms, bool b1, bool thermalHeat, bool c, bool d) : x0_lightParms(lightParms) , x40_scanParms(scanParms) , x44_xrayAssets(xrayAssets) , x4c_thermalAssets(thermalAssets) , x54_visorParms(visorParms) - , b1(a) - , b2(b) - , b3(c) - , b4(d) + , x58_24_(b1) + , x58_25_thermalHeat(thermalHeat) + , x58_26_(c) + , x58_27_(d) { } CActorParameters Scannable(const CScannableParameters& sParms) const diff --git a/Runtime/World/ScriptLoader.cpp b/Runtime/World/ScriptLoader.cpp index 77b024f31..b109c08af 100644 --- a/Runtime/World/ScriptLoader.cpp +++ b/Runtime/World/ScriptLoader.cpp @@ -216,9 +216,9 @@ CActorParameters ScriptLoader::LoadActorParameters(CInputStream& in) if (propCount > 6) vParms = LoadVisorParameters(in); - bool b2 = false; + bool thermalHeat = false; if (propCount > 10) - b2 = in.readBool(); + thermalHeat = in.readBool(); bool b3 = false; if (propCount > 11) @@ -240,7 +240,7 @@ CActorParameters ScriptLoader::LoadActorParameters(CInputStream& in) if (g_ResFactory->GetResourceTypeById(infraModel)) infra = {infraModel, infraSkin}; - return CActorParameters(lParms, sParams, xray, infra, vParms, b1, b2, b3, b4); + return CActorParameters(lParms, sParams, xray, infra, vParms, b1, thermalHeat, b3, b4); } return CActorParameters::None(); }