mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-05-13 17:11:22 +00:00
More bug fixes
This commit is contained in:
parent
5f8b65e3b5
commit
88591f48f0
@ -201,28 +201,28 @@ void CBooRenderer::ActivateLightsForModel(CAreaListItem* item, CBooModel& model)
|
|||||||
if (lightOctreeWords && !TestBit(lightOctreeWords, model.x44_areaInstanceIdx))
|
if (lightOctreeWords && !TestBit(lightOctreeWords, model.x44_areaInstanceIdx))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
float radius = model.x20_aabb.intersectionRadius(zeus::CSphere(refLight.GetPosition(), refLight.GetRadius()));
|
||||||
|
|
||||||
bool foundLight = false;
|
bool foundLight = false;
|
||||||
for (int j = 0; j < i; ++j) {
|
for (int j = 0; j < i; ++j) {
|
||||||
if (lightRefs[j] == &refLight)
|
if (lightRefs[j] == &refLight)
|
||||||
continue;
|
continue;
|
||||||
float radius = model.x20_aabb.intersectionRadius(zeus::CSphere(refLight.GetPosition(), refLight.GetRadius()));
|
|
||||||
if (radius < 0.f)
|
if (radius < 0.f)
|
||||||
break;
|
break;
|
||||||
if (lightRads[j] <= radius)
|
if (lightRads[j] <= radius)
|
||||||
break;
|
break;
|
||||||
lightRads[j] = radius;
|
lightRads[j] = radius;
|
||||||
lightRefs[j] = &refLight;
|
|
||||||
thisLights.push_back(refLight);
|
thisLights.push_back(refLight);
|
||||||
foundLight = true;
|
foundLight = true;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (foundLight)
|
if (foundLight)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
float radius = model.x20_aabb.intersectionRadius(zeus::CSphere(refLight.GetPosition(), refLight.GetRadius()));
|
lightRads[i] = radius;
|
||||||
if (radius < 0.f)
|
if (radius < 0.f)
|
||||||
continue;
|
continue;
|
||||||
lightRads[i] = radius;
|
|
||||||
lightRefs[i] = &refLight;
|
lightRefs[i] = &refLight;
|
||||||
thisLights.push_back(refLight);
|
thisLights.push_back(refLight);
|
||||||
++i;
|
++i;
|
||||||
|
@ -36,6 +36,14 @@ float CLight::GetIntensity() const {
|
|||||||
return x48_cachedIntensity;
|
return x48_cachedIntensity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float CLight::GetRadius() const {
|
||||||
|
if (x4c_25_radiusDirty) {
|
||||||
|
const_cast<CLight*>(this)->x44_cachedRadius = CalculateLightRadius();
|
||||||
|
const_cast<CLight*>(this)->x4c_25_radiusDirty = false;
|
||||||
|
}
|
||||||
|
return x44_cachedRadius;
|
||||||
|
}
|
||||||
|
|
||||||
CLight::CLight(const zeus::CVector3f& pos, const zeus::CVector3f& dir, const zeus::CColor& color, float distC,
|
CLight::CLight(const zeus::CVector3f& pos, const zeus::CVector3f& dir, const zeus::CColor& color, float distC,
|
||||||
float distL, float distQ, float angleC, float angleL, float angleQ)
|
float distL, float distQ, float angleC, float angleL, float angleQ)
|
||||||
: x0_pos(pos)
|
: x0_pos(pos)
|
||||||
|
@ -89,17 +89,10 @@ public:
|
|||||||
float GetAngleAttenuationLinear() const { return x34_angleL; }
|
float GetAngleAttenuationLinear() const { return x34_angleL; }
|
||||||
float GetAngleAttenuationQuadratic() const { return x38_angleQ; }
|
float GetAngleAttenuationQuadratic() const { return x38_angleQ; }
|
||||||
|
|
||||||
float GetRadius() const {
|
|
||||||
if (x4c_25_radiusDirty) {
|
|
||||||
const_cast<CLight*>(this)->x44_cachedRadius = CalculateLightRadius();
|
|
||||||
const_cast<CLight*>(this)->x4c_25_radiusDirty = false;
|
|
||||||
}
|
|
||||||
return x44_cachedRadius;
|
|
||||||
}
|
|
||||||
|
|
||||||
ELightType GetType() const { return x1c_type; }
|
ELightType GetType() const { return x1c_type; }
|
||||||
|
|
||||||
float GetIntensity() const;
|
float GetIntensity() const;
|
||||||
|
float GetRadius() const;
|
||||||
const zeus::CColor& GetColor() const { return x18_color; }
|
const zeus::CColor& GetColor() const { return x18_color; }
|
||||||
zeus::CColor GetNormalIndependentLightingAtPoint(const zeus::CVector3f& point) const;
|
zeus::CColor GetNormalIndependentLightingAtPoint(const zeus::CVector3f& point) const;
|
||||||
|
|
||||||
|
@ -961,7 +961,7 @@ boo::ObjToken<boo::IGraphicsBufferD> CBooModel::UpdateUniformData(const CModelFl
|
|||||||
lightingOut.colorRegs[1] = CGraphics::g_ColorRegs[1];
|
lightingOut.colorRegs[1] = CGraphics::g_ColorRegs[1];
|
||||||
lightingOut.colorRegs[2] = CGraphics::g_ColorRegs[2];
|
lightingOut.colorRegs[2] = CGraphics::g_ColorRegs[2];
|
||||||
lightingOut.mulColor = flags.x4_color;
|
lightingOut.mulColor = flags.x4_color;
|
||||||
lightingOut.ambient += flags.addColor;
|
lightingOut.addColor = flags.addColor;
|
||||||
lightingOut.fog = CGraphics::g_Fog;
|
lightingOut.fog = CGraphics::g_Fog;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,6 +55,7 @@ public:
|
|||||||
zeus::CColor ambient;
|
zeus::CColor ambient;
|
||||||
zeus::CColor colorRegs[3];
|
zeus::CColor colorRegs[3];
|
||||||
zeus::CColor mulColor;
|
zeus::CColor mulColor;
|
||||||
|
zeus::CColor addColor;
|
||||||
CGraphics::CFogState fog;
|
CGraphics::CFogState fog;
|
||||||
|
|
||||||
void ActivateLights(const std::vector<CLight>& lts);
|
void ActivateLights(const std::vector<CLight>& lts);
|
||||||
|
@ -66,6 +66,7 @@ FOG_STRUCT_GLSL
|
|||||||
" vec4 colorReg1;\n"
|
" vec4 colorReg1;\n"
|
||||||
" vec4 colorReg2;\n"
|
" vec4 colorReg2;\n"
|
||||||
" vec4 mulColor;\n"
|
" vec4 mulColor;\n"
|
||||||
|
" vec4 addColor;\n"
|
||||||
" Fog fog;\n"
|
" Fog fog;\n"
|
||||||
"};\n"
|
"};\n"
|
||||||
"\n"
|
"\n"
|
||||||
@ -116,6 +117,7 @@ static std::string_view LightingShadowGLSL =
|
|||||||
" vec4 colorReg1;\n"
|
" vec4 colorReg1;\n"
|
||||||
" vec4 colorReg2;\n"
|
" vec4 colorReg2;\n"
|
||||||
" vec4 mulColor;\n"
|
" vec4 mulColor;\n"
|
||||||
|
" vec4 addColor;\n"
|
||||||
" Fog fog;\n"
|
" Fog fog;\n"
|
||||||
"};\n"
|
"};\n"
|
||||||
"\n"
|
"\n"
|
||||||
@ -167,11 +169,11 @@ static std::string_view ThermalPostGLSL =
|
|||||||
"UBINDING2 uniform ThermalUniform\n"
|
"UBINDING2 uniform ThermalUniform\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" vec4 tmulColor;\n"
|
" vec4 tmulColor;\n"
|
||||||
" vec4 addColor;\n"
|
" vec4 taddColor;\n"
|
||||||
"};\n"
|
"};\n"
|
||||||
"vec4 ThermalPostFunc(vec4 colorIn)\n"
|
"vec4 ThermalPostFunc(vec4 colorIn)\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" return vec4(texture(extTex7, vtf.extTcgs[0]).rrr * tmulColor.rgb + addColor.rgb, tmulColor.a + addColor.a);\n"
|
" return vec4(texture(extTex7, vtf.extTcgs[0]).rrr * tmulColor.rgb + taddColor.rgb, tmulColor.a + taddColor.a);\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
"\n"sv;
|
"\n"sv;
|
||||||
|
|
||||||
@ -207,7 +209,7 @@ static std::string_view MBShadowPostGLSL =
|
|||||||
static std::string_view DisintegratePostGLSL = FOG_STRUCT_GLSL
|
static std::string_view DisintegratePostGLSL = FOG_STRUCT_GLSL
|
||||||
"UBINDING2 uniform DisintegrateUniform\n"
|
"UBINDING2 uniform DisintegrateUniform\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" vec4 addColor;\n"
|
" vec4 daddColor;\n"
|
||||||
" Fog fog;\n"
|
" Fog fog;\n"
|
||||||
"};\n"
|
"};\n"
|
||||||
"vec4 DisintegratePostFunc(vec4 colorIn)\n"
|
"vec4 DisintegratePostFunc(vec4 colorIn)\n"
|
||||||
@ -215,7 +217,7 @@ static std::string_view DisintegratePostGLSL = FOG_STRUCT_GLSL
|
|||||||
" vec4 texel0 = texture(extTex7, vtf.extTcgs[0]);\n"
|
" vec4 texel0 = texture(extTex7, vtf.extTcgs[0]);\n"
|
||||||
" vec4 texel1 = texture(extTex7, vtf.extTcgs[1]);\n"
|
" vec4 texel1 = texture(extTex7, vtf.extTcgs[1]);\n"
|
||||||
" colorIn = mix(vec4(0.0), texel1, texel0);\n"
|
" colorIn = mix(vec4(0.0), texel1, texel0);\n"
|
||||||
" colorIn.rgb += addColor.rgb;\n" FOG_ALGORITHM_GLSL
|
" colorIn.rgb += daddColor.rgb;\n" FOG_ALGORITHM_GLSL
|
||||||
"}\n"
|
"}\n"
|
||||||
"\n"sv;
|
"\n"sv;
|
||||||
|
|
||||||
|
@ -65,6 +65,7 @@ FOG_STRUCT_HLSL
|
|||||||
" float4 colorReg1;\n"
|
" float4 colorReg1;\n"
|
||||||
" float4 colorReg2;\n"
|
" float4 colorReg2;\n"
|
||||||
" float4 mulColor;\n"
|
" float4 mulColor;\n"
|
||||||
|
" float4 addColor;\n"
|
||||||
" Fog fog;\n"
|
" Fog fog;\n"
|
||||||
"};\n"
|
"};\n"
|
||||||
"\n"
|
"\n"
|
||||||
@ -114,6 +115,7 @@ static std::string_view LightingShadowHLSL =
|
|||||||
" float4 colorReg1;\n"
|
" float4 colorReg1;\n"
|
||||||
" float4 colorReg2;\n"
|
" float4 colorReg2;\n"
|
||||||
" float4 mulColor;\n"
|
" float4 mulColor;\n"
|
||||||
|
" float4 addColor;\n"
|
||||||
" Fog fog;\n"
|
" Fog fog;\n"
|
||||||
"};\n"
|
"};\n"
|
||||||
"\n"
|
"\n"
|
||||||
@ -160,12 +162,12 @@ static std::string_view ThermalPostHLSL =
|
|||||||
"cbuffer ThermalUniform : register(b2)\n"
|
"cbuffer ThermalUniform : register(b2)\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" float4 tmulColor;\n"
|
" float4 tmulColor;\n"
|
||||||
" float4 addColor;\n"
|
" float4 taddColor;\n"
|
||||||
"};\n"
|
"};\n"
|
||||||
"static float4 ThermalPostFunc(in VertToFrag vtf, float4 colorIn)\n"
|
"static float4 ThermalPostFunc(in VertToFrag vtf, float4 colorIn)\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" return float4(extTex7.Sample(samp, vtf.extTcgs[0]).rrr * tmulColor.rgb + addColor.rgb, tmulColor.a + "
|
" return float4(extTex7.Sample(samp, vtf.extTcgs[0]).rrr * tmulColor.rgb + taddColor.rgb, tmulColor.a + "
|
||||||
"addColor.a);\n"
|
"taddColor.a);\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
"\n"sv;
|
"\n"sv;
|
||||||
|
|
||||||
@ -201,7 +203,7 @@ static std::string_view MBShadowPostHLSL =
|
|||||||
static std::string_view DisintegratePostHLSL = FOG_STRUCT_HLSL
|
static std::string_view DisintegratePostHLSL = FOG_STRUCT_HLSL
|
||||||
"cbuffer DisintegrateUniform : register(b2)\n"
|
"cbuffer DisintegrateUniform : register(b2)\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" float4 addColor;\n"
|
" float4 daddColor;\n"
|
||||||
" Fog fog;\n"
|
" Fog fog;\n"
|
||||||
"};\n"
|
"};\n"
|
||||||
"static float4 DisintegratePostFunc(in VertToFrag vtf, float4 colorIn)\n"
|
"static float4 DisintegratePostFunc(in VertToFrag vtf, float4 colorIn)\n"
|
||||||
@ -209,7 +211,7 @@ static std::string_view DisintegratePostHLSL = FOG_STRUCT_HLSL
|
|||||||
" float4 texel0 = extTex7.Sample(samp, vtf.extTcgs[0]);\n"
|
" float4 texel0 = extTex7.Sample(samp, vtf.extTcgs[0]);\n"
|
||||||
" float4 texel1 = extTex7.Sample(samp, vtf.extTcgs[1]);\n"
|
" float4 texel1 = extTex7.Sample(samp, vtf.extTcgs[1]);\n"
|
||||||
" colorIn = lerp(float4(0.0,0.0,0.0,0.0), texel1, texel0);\n"
|
" colorIn = lerp(float4(0.0,0.0,0.0,0.0), texel1, texel0);\n"
|
||||||
" colorIn.rgb += addColor.rgb;\n" FOG_ALGORITHM_HLSL
|
" colorIn.rgb += daddColor.rgb;\n" FOG_ALGORITHM_HLSL
|
||||||
"}\n"
|
"}\n"
|
||||||
"\n"sv;
|
"\n"sv;
|
||||||
|
|
||||||
|
@ -65,6 +65,7 @@ FOG_STRUCT_METAL
|
|||||||
" float4 colorReg1;\n"
|
" float4 colorReg1;\n"
|
||||||
" float4 colorReg2;\n"
|
" float4 colorReg2;\n"
|
||||||
" float4 mulColor;\n"
|
" float4 mulColor;\n"
|
||||||
|
" float4 addColor;\n"
|
||||||
" Fog fog;\n"
|
" Fog fog;\n"
|
||||||
"};\n"
|
"};\n"
|
||||||
"\n"
|
"\n"
|
||||||
@ -114,6 +115,7 @@ static std::string_view LightingShadowMetal =
|
|||||||
" float4 colorReg1;\n"
|
" float4 colorReg1;\n"
|
||||||
" float4 colorReg2;\n"
|
" float4 colorReg2;\n"
|
||||||
" float4 mulColor;\n"
|
" float4 mulColor;\n"
|
||||||
|
" float4 addColor;\n"
|
||||||
" Fog fog;\n"
|
" Fog fog;\n"
|
||||||
"};\n"
|
"};\n"
|
||||||
"\n"
|
"\n"
|
||||||
@ -161,14 +163,14 @@ static std::string_view ThermalPostMetal =
|
|||||||
"struct ThermalUniform\n"
|
"struct ThermalUniform\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" float4 tmulColor;\n"
|
" float4 tmulColor;\n"
|
||||||
" float4 addColor;\n"
|
" float4 taddColor;\n"
|
||||||
"};\n"
|
"};\n"
|
||||||
"static float4 EXTThermalPostFunc(thread VertToFrag& vtf, constant ThermalUniform& lu,\n"
|
"static float4 EXTThermalPostFunc(thread VertToFrag& vtf, constant ThermalUniform& lu,\n"
|
||||||
" sampler samp, sampler clampSamp, texture2d<float> extTex7, float4 colorIn)\n"
|
" sampler samp, sampler clampSamp, texture2d<float> extTex7, float4 colorIn)\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" //return float4(vtf.extTcgs0.xy, 0.0, 1.0);\n"
|
" //return float4(vtf.extTcgs0.xy, 0.0, 1.0);\n"
|
||||||
" return float4(extTex7.sample(samp, vtf.extTcgs0).rrr * lu.tmulColor.rgb + lu.addColor.rgb,\n"
|
" return float4(extTex7.sample(samp, vtf.extTcgs0).rrr * lu.tmulColor.rgb + lu.taddColor.rgb,\n"
|
||||||
" lu.tmulColor.a + lu.addColor.a);\n"
|
" lu.tmulColor.a + lu.taddColor.a);\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
"\n"sv;
|
"\n"sv;
|
||||||
|
|
||||||
@ -206,7 +208,7 @@ static std::string_view MBShadowPostMetal =
|
|||||||
static std::string_view DisintegratePostMetal = FOG_STRUCT_METAL
|
static std::string_view DisintegratePostMetal = FOG_STRUCT_METAL
|
||||||
"struct DisintegrateUniform\n"
|
"struct DisintegrateUniform\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" float4 addColor;\n"
|
" float4 daddColor;\n"
|
||||||
" Fog fog;\n"
|
" Fog fog;\n"
|
||||||
"};\n"
|
"};\n"
|
||||||
"static float4 EXTDisintegratePostFunc(thread VertToFrag& vtf, constant DisintegrateUniform& lu, sampler samp,\n"
|
"static float4 EXTDisintegratePostFunc(thread VertToFrag& vtf, constant DisintegrateUniform& lu, sampler samp,\n"
|
||||||
@ -215,7 +217,7 @@ static std::string_view DisintegratePostMetal = FOG_STRUCT_METAL
|
|||||||
" float4 texel0 = extTex7.sample(samp, vtf.extTcgs0);\n"
|
" float4 texel0 = extTex7.sample(samp, vtf.extTcgs0);\n"
|
||||||
" float4 texel1 = extTex7.sample(samp, vtf.extTcgs1);\n"
|
" float4 texel1 = extTex7.sample(samp, vtf.extTcgs1);\n"
|
||||||
" colorIn = mix(float4(0.0), texel1, texel0);\n"
|
" colorIn = mix(float4(0.0), texel1, texel0);\n"
|
||||||
" colorIn.rgb += lu.addColor.rgb;\n" FOG_ALGORITHM_METAL
|
" colorIn.rgb += lu.daddColor.rgb;\n" FOG_ALGORITHM_METAL
|
||||||
"}\n"
|
"}\n"
|
||||||
"\n"sv;
|
"\n"sv;
|
||||||
|
|
||||||
|
@ -15,8 +15,8 @@ CFlickerBat::CFlickerBat(TUniqueId uid, std::string_view name, CPatterned::EFlav
|
|||||||
colType, EBodyType::Pitchable, actParms, EKnockBackVariant::Small)
|
colType, EBodyType::Pitchable, actParms, EKnockBackVariant::Small)
|
||||||
, x580_24_wasInXray(false)
|
, x580_24_wasInXray(false)
|
||||||
, x580_25_heardShot(false)
|
, x580_25_heardShot(false)
|
||||||
, x580_26_(false)
|
, x580_26_inLOS(false)
|
||||||
, x580_27_(b2)
|
, x580_27_enableLOSCheck(b2)
|
||||||
, x574_state(EFlickerBatState(b1)) {
|
, x574_state(EFlickerBatState(b1)) {
|
||||||
|
|
||||||
SetupPlayerCollision(b1);
|
SetupPlayerCollision(b1);
|
||||||
@ -45,26 +45,26 @@ void CFlickerBat::Think(float dt, CStateManager& mgr) {
|
|||||||
|
|
||||||
x402_29_drawParticles = mgr.GetPlayerState()->GetActiveVisor(mgr) != CPlayerState::EPlayerVisor::XRay;
|
x402_29_drawParticles = mgr.GetPlayerState()->GetActiveVisor(mgr) != CPlayerState::EPlayerVisor::XRay;
|
||||||
|
|
||||||
if (GetFlickerBatState() == EFlickerBatState::Two || GetFlickerBatState() == EFlickerBatState::Three) {
|
if (GetFlickerBatState() == EFlickerBatState::FadeIn || GetFlickerBatState() == EFlickerBatState::FadeOut) {
|
||||||
x578_ -= dt;
|
x578_fadeRemTime -= dt;
|
||||||
if (x578_ <= 0.f) {
|
if (x578_fadeRemTime <= 0.f) {
|
||||||
if (GetFlickerBatState() == EFlickerBatState::Two)
|
if (GetFlickerBatState() == EFlickerBatState::FadeIn)
|
||||||
SetFlickerBatState(EFlickerBatState::Zero, mgr);
|
SetFlickerBatState(EFlickerBatState::Visible, mgr);
|
||||||
else
|
else
|
||||||
SetFlickerBatState(EFlickerBatState::One, mgr);
|
SetFlickerBatState(EFlickerBatState::Hidden, mgr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool inXray = mgr.GetPlayerState()->GetCurrentVisor() == CPlayerState::EPlayerVisor::XRay;
|
bool inXray = mgr.GetPlayerState()->GetCurrentVisor() == CPlayerState::EPlayerVisor::XRay;
|
||||||
if (inXray != x580_24_wasInXray) {
|
if (inXray != x580_24_wasInXray) {
|
||||||
if (inXray) {
|
if (inXray) {
|
||||||
if (GetFlickerBatState() == EFlickerBatState::One) {
|
if (GetFlickerBatState() == EFlickerBatState::Hidden) {
|
||||||
AddMaterial(EMaterialTypes::Target, EMaterialTypes::Orbit, mgr);
|
AddMaterial(EMaterialTypes::Target, EMaterialTypes::Orbit, mgr);
|
||||||
SetMuted(false);
|
SetMuted(false);
|
||||||
}
|
}
|
||||||
CreateShadow(false);
|
CreateShadow(false);
|
||||||
} else {
|
} else {
|
||||||
if (GetFlickerBatState() == EFlickerBatState::One) {
|
if (GetFlickerBatState() == EFlickerBatState::Hidden) {
|
||||||
RemoveMaterial(EMaterialTypes::Target, EMaterialTypes::Orbit, mgr);
|
RemoveMaterial(EMaterialTypes::Target, EMaterialTypes::Orbit, mgr);
|
||||||
SetMuted(true);
|
SetMuted(true);
|
||||||
}
|
}
|
||||||
@ -75,11 +75,11 @@ void CFlickerBat::Think(float dt, CStateManager& mgr) {
|
|||||||
|
|
||||||
float alpha = 0.f;
|
float alpha = 0.f;
|
||||||
if (!x580_24_wasInXray) {
|
if (!x580_24_wasInXray) {
|
||||||
if (GetFlickerBatState() == EFlickerBatState::Zero)
|
if (GetFlickerBatState() == EFlickerBatState::Visible)
|
||||||
alpha = 1.f;
|
alpha = 1.f;
|
||||||
else if (GetFlickerBatState() == EFlickerBatState::Two || GetFlickerBatState() == EFlickerBatState::Three) {
|
else if (GetFlickerBatState() == EFlickerBatState::FadeIn || GetFlickerBatState() == EFlickerBatState::FadeOut) {
|
||||||
alpha = x578_ * x57c_;
|
alpha = x578_fadeRemTime * x57c_ooFadeDur;
|
||||||
if (GetFlickerBatState() == EFlickerBatState::Two)
|
if (GetFlickerBatState() == EFlickerBatState::FadeIn)
|
||||||
alpha = 1.f - alpha;
|
alpha = 1.f - alpha;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
@ -90,26 +90,26 @@ void CFlickerBat::Think(float dt, CStateManager& mgr) {
|
|||||||
|
|
||||||
bool targetable = true;
|
bool targetable = true;
|
||||||
if (mgr.GetPlayerState()->GetCurrentVisor() != CPlayerState::EPlayerVisor::XRay &&
|
if (mgr.GetPlayerState()->GetCurrentVisor() != CPlayerState::EPlayerVisor::XRay &&
|
||||||
(x574_state == EFlickerBatState::Zero || x574_state == EFlickerBatState::Two))
|
(x574_state == EFlickerBatState::Visible || x574_state == EFlickerBatState::FadeIn))
|
||||||
targetable = false;
|
targetable = false;
|
||||||
xe7_31_targetable = targetable;
|
xe7_31_targetable = targetable;
|
||||||
CPatterned::Think(dt, mgr);
|
CPatterned::Think(dt, mgr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CFlickerBat::Render(const CStateManager& mgr) const {
|
void CFlickerBat::Render(const CStateManager& mgr) const {
|
||||||
if (!x580_24_wasInXray && x580_26_ &&
|
if (!x580_24_wasInXray && x580_26_inLOS &&
|
||||||
(GetFlickerBatState() == EFlickerBatState::Two || GetFlickerBatState() == EFlickerBatState::Three)) {
|
(GetFlickerBatState() == EFlickerBatState::FadeIn || GetFlickerBatState() == EFlickerBatState::FadeOut)) {
|
||||||
float strength = 0.f;
|
float strength = 0.f;
|
||||||
if (GetFlickerBatState() == EFlickerBatState::Two) {
|
if (GetFlickerBatState() == EFlickerBatState::FadeIn) {
|
||||||
strength = 4.f * (x578_ - .75f);
|
strength = 4.f * (x578_fadeRemTime - .75f);
|
||||||
} else if (GetFlickerBatState() == EFlickerBatState::Three) {
|
} else if (GetFlickerBatState() == EFlickerBatState::FadeOut) {
|
||||||
strength = 4.f * x578_;
|
strength = 4.f * x578_fadeRemTime;
|
||||||
}
|
}
|
||||||
if (strength > 0.f && strength < 1.f)
|
if (strength > 0.f && strength < 1.f)
|
||||||
mgr.DrawSpaceWarp(GetTranslation(), 0.3f * std::sin(M_PIF * strength));
|
mgr.DrawSpaceWarp(GetTranslation(), 0.3f * std::sin(M_PIF * strength));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (x580_26_) {
|
if (x580_26_inLOS) {
|
||||||
mgr.SetupFogForAreaNonCurrent(GetAreaIdAlways());
|
mgr.SetupFogForAreaNonCurrent(GetAreaIdAlways());
|
||||||
CPatterned::Render(mgr);
|
CPatterned::Render(mgr);
|
||||||
mgr.SetupFogForArea(GetAreaIdAlways());
|
mgr.SetupFogForArea(GetAreaIdAlways());
|
||||||
@ -136,12 +136,12 @@ void CFlickerBat::DoUserAnimEvent(CStateManager& mgr, const CInt32POINode& node,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CFlickerBat::Death(CStateManager& mgr, const zeus::CVector3f& direction, EScriptObjectState state) {
|
void CFlickerBat::Death(CStateManager& mgr, const zeus::CVector3f& direction, EScriptObjectState state) {
|
||||||
SetFlickerBatState(EFlickerBatState::Zero, mgr);
|
SetFlickerBatState(EFlickerBatState::Visible, mgr);
|
||||||
CPatterned::Death(mgr, direction, state);
|
CPatterned::Death(mgr, direction, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CFlickerBat::CanBeShot(CStateManager& mgr, int) {
|
bool CFlickerBat::CanBeShot(CStateManager& mgr, int) {
|
||||||
return (GetFlickerBatState() == EFlickerBatState::Zero || GetFlickerBatState() == EFlickerBatState::Two ||
|
return (GetFlickerBatState() == EFlickerBatState::Visible || GetFlickerBatState() == EFlickerBatState::FadeIn ||
|
||||||
mgr.GetPlayerState()->GetCurrentVisor() == CPlayerState::EPlayerVisor::XRay);
|
mgr.GetPlayerState()->GetCurrentVisor() == CPlayerState::EPlayerVisor::XRay);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -196,15 +196,15 @@ void CFlickerBat::SetFlickerBatState(EFlickerBatState state, CStateManager& mgr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CFlickerBat::FlickerBatStateChanged(EFlickerBatState state, CStateManager& mgr) {
|
void CFlickerBat::FlickerBatStateChanged(EFlickerBatState state, CStateManager& mgr) {
|
||||||
if (state == EFlickerBatState::Zero) {
|
if (state == EFlickerBatState::Visible) {
|
||||||
if (mgr.GetPlayerState()->GetCurrentVisor() != CPlayerState::EPlayerVisor::XRay)
|
if (mgr.GetPlayerState()->GetCurrentVisor() != CPlayerState::EPlayerVisor::XRay)
|
||||||
CreateShadow(true);
|
CreateShadow(true);
|
||||||
|
|
||||||
AddMaterial(EMaterialTypes::Target, mgr);
|
AddMaterial(EMaterialTypes::Target, mgr);
|
||||||
} else if (state == EFlickerBatState::One) {
|
} else if (state == EFlickerBatState::Hidden) {
|
||||||
SetMuted(true);
|
SetMuted(true);
|
||||||
RemoveMaterial(EMaterialTypes::Target, mgr);
|
RemoveMaterial(EMaterialTypes::Target, mgr);
|
||||||
} else if (state == EFlickerBatState::Two) {
|
} else if (state == EFlickerBatState::FadeIn) {
|
||||||
if (mgr.GetPlayerState()->GetCurrentVisor() != CPlayerState::EPlayerVisor::XRay) {
|
if (mgr.GetPlayerState()->GetCurrentVisor() != CPlayerState::EPlayerVisor::XRay) {
|
||||||
CreateShadow(true);
|
CreateShadow(true);
|
||||||
SetMuted(false);
|
SetMuted(false);
|
||||||
@ -212,7 +212,7 @@ void CFlickerBat::FlickerBatStateChanged(EFlickerBatState state, CStateManager&
|
|||||||
|
|
||||||
CheckStaticIntersection(mgr);
|
CheckStaticIntersection(mgr);
|
||||||
SetupPlayerCollision(true);
|
SetupPlayerCollision(true);
|
||||||
} else if (state == EFlickerBatState::Three) {
|
} else if (state == EFlickerBatState::FadeOut) {
|
||||||
if (mgr.GetPlayerState()->GetCurrentVisor() != CPlayerState::EPlayerVisor::XRay)
|
if (mgr.GetPlayerState()->GetCurrentVisor() != CPlayerState::EPlayerVisor::XRay)
|
||||||
CreateShadow(true);
|
CreateShadow(true);
|
||||||
|
|
||||||
@ -222,8 +222,8 @@ void CFlickerBat::FlickerBatStateChanged(EFlickerBatState state, CStateManager&
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CFlickerBat::CheckStaticIntersection(CStateManager& mgr) {
|
void CFlickerBat::CheckStaticIntersection(CStateManager& mgr) {
|
||||||
if (!x580_27_) {
|
if (!x580_27_enableLOSCheck) {
|
||||||
x580_26_ = false;
|
x580_26_inLOS = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -231,7 +231,7 @@ void CFlickerBat::CheckStaticIntersection(CStateManager& mgr) {
|
|||||||
zeus::CVector3f diff = GetBoundingBox().center() - camPos;
|
zeus::CVector3f diff = GetBoundingBox().center() - camPos;
|
||||||
float mag = diff.magnitude();
|
float mag = diff.magnitude();
|
||||||
diff *= zeus::CVector3f(1.f / mag);
|
diff *= zeus::CVector3f(1.f / mag);
|
||||||
x580_26_ = CGameCollision::RayStaticIntersectionBool(mgr, camPos, diff, mag,
|
x580_26_inLOS = CGameCollision::RayStaticIntersectionBool(mgr, camPos, diff, mag,
|
||||||
CMaterialFilter::MakeExclude({EMaterialTypes::SeeThrough}));
|
CMaterialFilter::MakeExclude({EMaterialTypes::SeeThrough}));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -244,12 +244,12 @@ void CFlickerBat::NotifyNeighbors(CStateManager& mgr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CFlickerBat::ToggleVisible(CStateManager& mgr) {
|
void CFlickerBat::ToggleVisible(CStateManager& mgr) {
|
||||||
if (GetFlickerBatState() == EFlickerBatState::Zero || GetFlickerBatState() == EFlickerBatState::Two)
|
if (GetFlickerBatState() == EFlickerBatState::Visible || GetFlickerBatState() == EFlickerBatState::FadeIn)
|
||||||
SetFlickerBatState(EFlickerBatState::Three, mgr);
|
SetFlickerBatState(EFlickerBatState::FadeOut, mgr);
|
||||||
else
|
else
|
||||||
SetFlickerBatState(EFlickerBatState::Two, mgr);
|
SetFlickerBatState(EFlickerBatState::FadeIn, mgr);
|
||||||
|
|
||||||
x578_ = 1.f;
|
x578_fadeRemTime = 1.f;
|
||||||
x57c_ = 1.f / x578_;
|
x57c_ooFadeDur = 1.f / x578_fadeRemTime;
|
||||||
}
|
}
|
||||||
} // namespace urde::MP1
|
} // namespace urde::MP1
|
@ -5,19 +5,19 @@
|
|||||||
namespace urde::MP1 {
|
namespace urde::MP1 {
|
||||||
class CFlickerBat final : public CPatterned {
|
class CFlickerBat final : public CPatterned {
|
||||||
public:
|
public:
|
||||||
enum class EFlickerBatState { Zero, One, Two, Three };
|
enum class EFlickerBatState { Visible, Hidden, FadeIn, FadeOut };
|
||||||
|
|
||||||
private:
|
private:
|
||||||
float x568_ = 0.f;
|
float x568_ = 0.f;
|
||||||
float x56c_ = 0.f;
|
float x56c_ = 0.f;
|
||||||
float x570_ = 0.f;
|
float x570_ = 0.f;
|
||||||
EFlickerBatState x574_state;
|
EFlickerBatState x574_state;
|
||||||
float x578_ = 1.f;
|
float x578_fadeRemTime = 1.f;
|
||||||
float x57c_ = 0.f;
|
float x57c_ooFadeDur = 0.f;
|
||||||
bool x580_24_wasInXray : 1;
|
bool x580_24_wasInXray : 1;
|
||||||
bool x580_25_heardShot : 1;
|
bool x580_25_heardShot : 1;
|
||||||
bool x580_26_ : 1;
|
bool x580_26_inLOS : 1;
|
||||||
bool x580_27_ : 1;
|
bool x580_27_enableLOSCheck : 1;
|
||||||
|
|
||||||
void NotifyNeighbors(CStateManager&);
|
void NotifyNeighbors(CStateManager&);
|
||||||
void ToggleVisible(CStateManager&);
|
void ToggleVisible(CStateManager&);
|
||||||
|
@ -65,7 +65,7 @@ void CMetaree::Touch(CActor& act, CStateManager& mgr) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMetaree::CollidedWith(TUniqueId& id, const CCollisionInfoList& colList, CStateManager& mgr) {
|
void CMetaree::CollidedWith(TUniqueId id, const CCollisionInfoList& colList, CStateManager& mgr) {
|
||||||
if (!x400_25_alive || colList.GetCount() <= 0)
|
if (!x400_25_alive || colList.GetCount() <= 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ public:
|
|||||||
void Think(float, CStateManager&);
|
void Think(float, CStateManager&);
|
||||||
|
|
||||||
void Touch(CActor&, CStateManager&);
|
void Touch(CActor&, CStateManager&);
|
||||||
void CollidedWith(TUniqueId&, const CCollisionInfoList&, CStateManager&);
|
void CollidedWith(TUniqueId, const CCollisionInfoList&, CStateManager&);
|
||||||
void ThinkAboutMove(float){};
|
void ThinkAboutMove(float){};
|
||||||
bool Delay(CStateManager&, float) { return x330_stateMachineState.GetTime() > x568_delay; }
|
bool Delay(CStateManager&, float) { return x330_stateMachineState.GetTime() > x568_delay; }
|
||||||
void Explode(CStateManager&, EStateMsg, float);
|
void Explode(CStateManager&, EStateMsg, float);
|
||||||
|
@ -78,8 +78,9 @@ void CActor::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateMana
|
|||||||
case EScriptObjectMessage::Deleted: // 34
|
case EScriptObjectMessage::Deleted: // 34
|
||||||
{
|
{
|
||||||
RemoveEmitter();
|
RemoveEmitter();
|
||||||
if (HasModelData() && x64_modelData->AnimationData() && x64_modelData->GetNormalModel())
|
if (HasModelData() && !x64_modelData->IsNull())
|
||||||
x64_modelData->AnimationData()->GetParticleDB().DeleteAllLights(mgr);
|
if (CAnimData* aData = x64_modelData->AnimationData())
|
||||||
|
aData->GetParticleDB().DeleteAllLights(mgr);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case EScriptObjectMessage::Registered: // 33
|
case EScriptObjectMessage::Registered: // 33
|
||||||
|
@ -1552,6 +1552,18 @@ void CPatterned::PreRender(CStateManager& mgr, const zeus::CFrustum& frustum) {
|
|||||||
CActor::PreRender(mgr, frustum);
|
CActor::PreRender(mgr, frustum);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CPatterned::AddToRenderer(const zeus::CFrustum& frustum, const CStateManager& mgr) const {
|
||||||
|
if (x402_29_drawParticles) {
|
||||||
|
if (x64_modelData && !x64_modelData->IsNull()) {
|
||||||
|
int mask, target;
|
||||||
|
mgr.GetCharacterRenderMaskAndTarget(x402_31_thawed, mask, target);
|
||||||
|
if (CAnimData* aData = x64_modelData->AnimationData())
|
||||||
|
aData->GetParticleDB().AddToRendererClippedMasked(frustum, mask, target);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CActor::AddToRenderer(frustum, mgr);
|
||||||
|
}
|
||||||
|
|
||||||
void CPatterned::RenderIceModelWithFlags(const CModelFlags& flags) const {
|
void CPatterned::RenderIceModelWithFlags(const CModelFlags& flags) const {
|
||||||
CModelFlags useFlags = flags;
|
CModelFlags useFlags = flags;
|
||||||
useFlags.x1_matSetIdx = 0;
|
useFlags.x1_matSetIdx = 0;
|
||||||
|
@ -261,6 +261,7 @@ public:
|
|||||||
void PreThink(float, CStateManager& mgr) { CEntity::Think(x500_preThinkDt, mgr); }
|
void PreThink(float, CStateManager& mgr) { CEntity::Think(x500_preThinkDt, mgr); }
|
||||||
void Think(float, CStateManager&);
|
void Think(float, CStateManager&);
|
||||||
void PreRender(CStateManager&, const zeus::CFrustum&);
|
void PreRender(CStateManager&, const zeus::CFrustum&);
|
||||||
|
void AddToRenderer(const zeus::CFrustum&, const CStateManager&) const;
|
||||||
void Render(const CStateManager& mgr) const;
|
void Render(const CStateManager& mgr) const;
|
||||||
|
|
||||||
void CollidedWith(TUniqueId, const CCollisionInfoList&, CStateManager& mgr);
|
void CollidedWith(TUniqueId, const CCollisionInfoList&, CStateManager& mgr);
|
||||||
|
@ -192,6 +192,7 @@ static const char* FS =
|
|||||||
" vec4 kColor1;\n"
|
" vec4 kColor1;\n"
|
||||||
" vec4 kColor2;\n"
|
" vec4 kColor2;\n"
|
||||||
" vec4 kColor3;\n"
|
" vec4 kColor3;\n"
|
||||||
|
" vec4 addColor;\n"
|
||||||
" Fog fog;\n"
|
" Fog fog;\n"
|
||||||
"};\n"
|
"};\n"
|
||||||
"\n"
|
"\n"
|
||||||
@ -297,6 +298,7 @@ static const char* FSDoor =
|
|||||||
" vec4 kColor1;\n"
|
" vec4 kColor1;\n"
|
||||||
" vec4 kColor2;\n"
|
" vec4 kColor2;\n"
|
||||||
" vec4 kColor3;\n"
|
" vec4 kColor3;\n"
|
||||||
|
" vec4 addColor;\n"
|
||||||
" Fog fog;\n"
|
" Fog fog;\n"
|
||||||
"};\n"
|
"};\n"
|
||||||
"\n"
|
"\n"
|
||||||
|
@ -228,6 +228,7 @@ static const char* FS =
|
|||||||
" float4 kColor1;\n"
|
" float4 kColor1;\n"
|
||||||
" float4 kColor2;\n"
|
" float4 kColor2;\n"
|
||||||
" float4 kColor3;\n"
|
" float4 kColor3;\n"
|
||||||
|
" float4 addColor;\n"
|
||||||
" Fog fog;\n"
|
" Fog fog;\n"
|
||||||
"};\n"
|
"};\n"
|
||||||
"\n"
|
"\n"
|
||||||
@ -332,6 +333,7 @@ static const char* FSDoor =
|
|||||||
" float4 kColor1;\n"
|
" float4 kColor1;\n"
|
||||||
" float4 kColor2;\n"
|
" float4 kColor2;\n"
|
||||||
" float4 kColor3;\n"
|
" float4 kColor3;\n"
|
||||||
|
" float4 addColor;\n"
|
||||||
" Fog fog;\n"
|
" Fog fog;\n"
|
||||||
"};\n"
|
"};\n"
|
||||||
"struct VertToFrag\n"
|
"struct VertToFrag\n"
|
||||||
|
@ -212,6 +212,7 @@ static const char* FS =
|
|||||||
" float4 kColor1;\n"
|
" float4 kColor1;\n"
|
||||||
" float4 kColor2;\n"
|
" float4 kColor2;\n"
|
||||||
" float4 kColor3;\n"
|
" float4 kColor3;\n"
|
||||||
|
" float4 addColor;\n"
|
||||||
" Fog fog;\n"
|
" Fog fog;\n"
|
||||||
"};\n"
|
"};\n"
|
||||||
"\n"
|
"\n"
|
||||||
@ -322,6 +323,7 @@ static const char* FSDoor =
|
|||||||
" float4 kColor1;\n"
|
" float4 kColor1;\n"
|
||||||
" float4 kColor2;\n"
|
" float4 kColor2;\n"
|
||||||
" float4 kColor3;\n"
|
" float4 kColor3;\n"
|
||||||
|
" float4 addColor;\n"
|
||||||
" Fog fog;\n"
|
" Fog fog;\n"
|
||||||
"};\n"
|
"};\n"
|
||||||
"\n"
|
"\n"
|
||||||
|
2
hecl
2
hecl
@ -1 +1 @@
|
|||||||
Subproject commit c4e21d26fe456c6ed089840763b6d751a2a2bed8
|
Subproject commit 8357df410e1a0d7671e70f0446342dd8b9268d02
|
2
specter
2
specter
@ -1 +1 @@
|
|||||||
Subproject commit 87e1106c601e163a991f5b9290241a060e7df617
|
Subproject commit 7b0ccb0c953d84cdcfd16a6c97ae3800d83bcceb
|
Loading…
x
Reference in New Issue
Block a user