HUD bug fixes

This commit is contained in:
Jack Andersen 2017-12-20 17:19:54 -10:00
parent c00cc6cea9
commit 053ebd41c4
17 changed files with 154 additions and 84 deletions

View File

@ -215,6 +215,7 @@ void ViewManager::init(boo::IApplication* app)
m_renderTex = root->renderTex(); m_renderTex = root->renderTex();
m_mainWindow->setWaitCursor(false); m_mainWindow->setWaitCursor(false);
m_voiceEngine = boo::NewAudioVoiceEngine(); m_voiceEngine = boo::NewAudioVoiceEngine();
m_voiceEngine->setVolume(0.7f);
m_amuseAllocWrapper.emplace(*m_voiceEngine); m_amuseAllocWrapper.emplace(*m_voiceEngine);
for (const auto& arg : app->getArgs()) for (const auto& arg : app->getArgs())
@ -223,6 +224,8 @@ void ViewManager::init(boo::IApplication* app)
m_deferedProject = arg; m_deferedProject = arg;
if (arg == _S("--no-shader-warmup")) if (arg == _S("--no-shader-warmup"))
m_noShaderWarmup = true; m_noShaderWarmup = true;
else if (arg == _S("--no-sound"))
m_voiceEngine->setVolume(0.f);
} }
} }

View File

@ -26,6 +26,7 @@ struct CModelFlags
u8 x0_blendMode = 0; /* >6: additive, >4: blend, else opaque */ u8 x0_blendMode = 0; /* >6: additive, >4: blend, else opaque */
u8 x1_matSetIdx = 0; u8 x1_matSetIdx = 0;
EExtendedShader m_extendedShader = EExtendedShader::Flat; EExtendedShader m_extendedShader = EExtendedShader::Flat;
bool m_noCull = false;
u16 x2_flags = 0; /* Flags */ u16 x2_flags = 0; /* Flags */
zeus::CColor x4_color; /* Set into kcolor slot specified by material */ zeus::CColor x4_color; /* Set into kcolor slot specified by material */
zeus::CColor addColor = zeus::CColor::skClear; zeus::CColor addColor = zeus::CColor::skClear;
@ -33,14 +34,10 @@ struct CModelFlags
CModelFlags() = default; CModelFlags() = default;
CModelFlags(u8 blendMode, u8 shadIdx, u16 flags, const zeus::CColor& col) CModelFlags(u8 blendMode, u8 shadIdx, u16 flags, const zeus::CColor& col)
: x0_blendMode(blendMode), x1_matSetIdx(shadIdx), x2_flags(flags), x4_color(col) : x0_blendMode(blendMode), x1_matSetIdx(shadIdx), m_extendedShader(EExtendedShader::Lighting),
x2_flags(flags), x4_color(col)
{ {
if (blendMode > 6) /* Blend mode will override this if the surface's original material is opaque */
m_extendedShader = EExtendedShader::ForcedAdditive;
else if (blendMode > 4)
m_extendedShader = EExtendedShader::ForcedAlpha;
else
m_extendedShader = EExtendedShader::Lighting;
} }
/* Flags /* Flags

View File

@ -626,10 +626,40 @@ void CBooModel::DrawSurface(const CBooSurface& surf, const CModelFlags& flags) c
return; return;
const std::vector<boo::ObjToken<boo::IShaderDataBinding>>& extendeds = inst.m_shaderDataBindings[surf.selfIdx]; const std::vector<boo::ObjToken<boo::IShaderDataBinding>>& extendeds = inst.m_shaderDataBindings[surf.selfIdx];
boo::ObjToken<boo::IShaderDataBinding> binding = extendeds[0]; EExtendedShader extended = EExtendedShader::Flat;
if (flags.m_extendedShader < extendeds.size()) if (flags.m_extendedShader == EExtendedShader::Lighting)
binding = extendeds[flags.m_extendedShader]; {
if (data.heclIr.m_blendSrc == boo::BlendFactor::One && data.heclIr.m_blendDst == boo::BlendFactor::Zero)
{
/* Override shader if originally opaque */
if (flags.x0_blendMode > 6)
extended = flags.m_noCull ? EExtendedShader::ForcedAdditiveNoCull : EExtendedShader::ForcedAdditive;
else if (flags.x0_blendMode > 4)
extended = flags.m_noCull ? EExtendedShader::ForcedAlphaNoCull : EExtendedShader::ForcedAlpha;
else
extended = EExtendedShader::Lighting;
}
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)
extended = EExtendedShader::ForcedAdditiveNoCull;
else
extended = EExtendedShader::Lighting;
}
else
{
extended = EExtendedShader::Lighting;
}
}
else if (flags.m_extendedShader < extendeds.size())
{
extended = flags.m_extendedShader;
}
boo::ObjToken<boo::IShaderDataBinding> binding = extendeds[extended];
CGraphics::SetShaderDataBinding(binding); CGraphics::SetShaderDataBinding(binding);
CGraphics::DrawArrayIndexed(surf.m_data.idxStart, surf.m_data.idxCount); CGraphics::DrawArrayIndexed(surf.m_data.idxStart, surf.m_data.idxCount);
} }

View File

@ -260,7 +260,7 @@ CModelShaders::GetShaderExtensionsGLSL(boo::IGraphicsDataFactory::Platform plat)
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,
hecl::Backend::BlendFactor::InvSrcAlpha, hecl::Backend::ZTest::Original, hecl::Backend::BlendFactor::InvSrcAlpha, hecl::Backend::ZTest::Original,
hecl::Backend::CullMode::None, false, false, true); hecl::Backend::CullMode::None, true, false, true);
/* Forced additive shading without culling */ /* Forced additive shading without culling */
ext.registerExtensionSlot({LightingGLSL, "LightingFunc"}, {MainPostGLSL, "MainPostFunc"}, ext.registerExtensionSlot({LightingGLSL, "LightingFunc"}, {MainPostGLSL, "MainPostFunc"},

View File

@ -243,7 +243,7 @@ CModelShaders::GetShaderExtensionsHLSL(boo::IGraphicsDataFactory::Platform plat)
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,
hecl::Backend::BlendFactor::InvSrcAlpha, hecl::Backend::ZTest::Original, hecl::Backend::BlendFactor::InvSrcAlpha, hecl::Backend::ZTest::Original,
hecl::Backend::CullMode::None, false, false, true); hecl::Backend::CullMode::None, true, false, true);
/* Forced additive shading without culling */ /* Forced additive shading without culling */
ext.registerExtensionSlot({LightingHLSL, "LightingFunc"}, {MainPostHLSL, "MainPostFunc"}, ext.registerExtensionSlot({LightingHLSL, "LightingFunc"}, {MainPostHLSL, "MainPostFunc"},

View File

@ -250,7 +250,7 @@ CModelShaders::GetShaderExtensionsMetal(boo::IGraphicsDataFactory::Platform plat
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,
hecl::Backend::BlendFactor::InvSrcAlpha, hecl::Backend::ZTest::Original, hecl::Backend::BlendFactor::InvSrcAlpha, hecl::Backend::ZTest::Original,
hecl::Backend::CullMode::None, false, false, true); hecl::Backend::CullMode::None, true, false, true);
/* Forced additive shading without culling */ /* Forced additive shading without culling */
ext.registerExtensionSlot({LightingMetal, "LightingFunc"}, {MainPostMetal, "MainPostFunc"}, ext.registerExtensionSlot({LightingMetal, "LightingFunc"}, {MainPostMetal, "MainPostFunc"},

View File

@ -3,7 +3,7 @@
namespace urde namespace urde
{ {
#define BLUR_SCALE (1.f / 32.f) #define BLUR_SCALE (1.f / 128.f)
void CPhazonSuitFilter::drawBlurPasses(float radius, const CTexture* indTex) void CPhazonSuitFilter::drawBlurPasses(float radius, const CTexture* indTex)
{ {

View File

@ -132,19 +132,30 @@ BOO_GLSL_BINDING_HEAD
" //this will be our alpha sum\n" " //this will be our alpha sum\n"
" float sum = 0.0;\n" " float sum = 0.0;\n"
"\n" "\n"
" //apply blurring, using a 9-tap filter with predefined gaussian weights\n" " //apply blurring, using a 23-tap filter with predefined gaussian weights\n"
"\n" " sum += texture(maskTex, vtf.uv + -11.0 * vtf.blurDir).a * 0.007249;\n"
" sum += texture(maskTex, vtf.uv - 4.0 * vtf.blurDir).a * 0.0162162162;\n" " sum += texture(maskTex, vtf.uv + -10.0 * vtf.blurDir).a * 0.011032;\n"
" sum += texture(maskTex, vtf.uv - 3.0 * vtf.blurDir).a * 0.0540540541;\n" " sum += texture(maskTex, vtf.uv + -9.0 * vtf.blurDir).a * 0.016133;\n"
" sum += texture(maskTex, vtf.uv - 2.0 * vtf.blurDir).a * 0.1216216216;\n" " sum += texture(maskTex, vtf.uv + -8.0 * vtf.blurDir).a * 0.022665;\n"
" sum += texture(maskTex, vtf.uv - 1.0 * vtf.blurDir).a * 0.1945945946;\n" " sum += texture(maskTex, vtf.uv + -7.0 * vtf.blurDir).a * 0.030595;\n"
"\n" " sum += texture(maskTex, vtf.uv + -6.0 * vtf.blurDir).a * 0.039680;\n"
" sum += texture(maskTex, vtf.uv).a * 0.2270270270;\n" " sum += texture(maskTex, vtf.uv + -5.0 * vtf.blurDir).a * 0.049444;\n"
"\n" " sum += texture(maskTex, vtf.uv + -4.0 * vtf.blurDir).a * 0.059195;\n"
" sum += texture(maskTex, vtf.uv + 1.0 * vtf.blurDir).a * 0.1945945946;\n" " sum += texture(maskTex, vtf.uv + -3.0 * vtf.blurDir).a * 0.068091;\n"
" sum += texture(maskTex, vtf.uv + 2.0 * vtf.blurDir).a * 0.1216216216;\n" " sum += texture(maskTex, vtf.uv + -2.0 * vtf.blurDir).a * 0.075252;\n"
" sum += texture(maskTex, vtf.uv + 3.0 * vtf.blurDir).a * 0.0540540541;\n" " sum += texture(maskTex, vtf.uv + -1.0 * vtf.blurDir).a * 0.079905;\n"
" sum += texture(maskTex, vtf.uv + 4.0 * vtf.blurDir).a * 0.0162162162;\n" " sum += texture(maskTex, vtf.uv + 0.0 * vtf.blurDir).a * 0.081519;\n"
" sum += texture(maskTex, vtf.uv + 1.0 * vtf.blurDir).a * 0.079905;\n"
" sum += texture(maskTex, vtf.uv + 2.0 * vtf.blurDir).a * 0.075252;\n"
" sum += texture(maskTex, vtf.uv + 3.0 * vtf.blurDir).a * 0.068091;\n"
" sum += texture(maskTex, vtf.uv + 4.0 * vtf.blurDir).a * 0.059195;\n"
" sum += texture(maskTex, vtf.uv + 5.0 * vtf.blurDir).a * 0.049444;\n"
" sum += texture(maskTex, vtf.uv + 6.0 * vtf.blurDir).a * 0.039680;\n"
" sum += texture(maskTex, vtf.uv + 7.0 * vtf.blurDir).a * 0.030595;\n"
" sum += texture(maskTex, vtf.uv + 8.0 * vtf.blurDir).a * 0.022665;\n"
" sum += texture(maskTex, vtf.uv + 9.0 * vtf.blurDir).a * 0.016133;\n"
" sum += texture(maskTex, vtf.uv + 10.0 * vtf.blurDir).a * 0.011032;\n"
" sum += texture(maskTex, vtf.uv + 11.0 * vtf.blurDir).a * 0.007249;\n"
"\n" "\n"
" colorOut = vec4(1.0, 1.0, 1.0, sum);\n" " colorOut = vec4(1.0, 1.0, 1.0, sum);\n"
"}\n"; "}\n";

View File

@ -131,19 +131,30 @@ static const char* BlurFS =
" //this will be our alpha sum\n" " //this will be our alpha sum\n"
" float sum = 0.0;\n" " float sum = 0.0;\n"
"\n" "\n"
" //apply blurring, using a 9-tap filter with predefined gaussian weights\n" " //apply blurring, using a 23-tap filter with predefined gaussian weights\n"
"\n" " sum += maskTex.Sample(samp, vtf.uv + -11.0 * vtf.blurDir).a * 0.007249;\n"
" sum += maskTex.Sample(samp, vtf.uv - 4.0 * vtf.blurDir).a * 0.0162162162;\n" " sum += maskTex.Sample(samp, vtf.uv + -10.0 * vtf.blurDir).a * 0.011032;\n"
" sum += maskTex.Sample(samp, vtf.uv - 3.0 * vtf.blurDir).a * 0.0540540541;\n" " sum += maskTex.Sample(samp, vtf.uv + -9.0 * vtf.blurDir).a * 0.016133;\n"
" sum += maskTex.Sample(samp, vtf.uv - 2.0 * vtf.blurDir).a * 0.1216216216;\n" " sum += maskTex.Sample(samp, vtf.uv + -8.0 * vtf.blurDir).a * 0.022665;\n"
" sum += maskTex.Sample(samp, vtf.uv - 1.0 * vtf.blurDir).a * 0.1945945946;\n" " sum += maskTex.Sample(samp, vtf.uv + -7.0 * vtf.blurDir).a * 0.030595;\n"
"\n" " sum += maskTex.Sample(samp, vtf.uv + -6.0 * vtf.blurDir).a * 0.039680;\n"
" sum += maskTex.Sample(samp, vtf.uv).a * 0.2270270270;\n" " sum += maskTex.Sample(samp, vtf.uv + -5.0 * vtf.blurDir).a * 0.049444;\n"
"\n" " sum += maskTex.Sample(samp, vtf.uv + -4.0 * vtf.blurDir).a * 0.059195;\n"
" sum += maskTex.Sample(samp, vtf.uv + 1.0 * vtf.blurDir).a * 0.1945945946;\n" " sum += maskTex.Sample(samp, vtf.uv + -3.0 * vtf.blurDir).a * 0.068091;\n"
" sum += maskTex.Sample(samp, vtf.uv + 2.0 * vtf.blurDir).a * 0.1216216216;\n" " sum += maskTex.Sample(samp, vtf.uv + -2.0 * vtf.blurDir).a * 0.075252;\n"
" sum += maskTex.Sample(samp, vtf.uv + 3.0 * vtf.blurDir).a * 0.0540540541;\n" " sum += maskTex.Sample(samp, vtf.uv + -1.0 * vtf.blurDir).a * 0.079905;\n"
" sum += maskTex.Sample(samp, vtf.uv + 4.0 * vtf.blurDir).a * 0.0162162162;\n" " sum += maskTex.Sample(samp, vtf.uv + 0.0 * vtf.blurDir).a * 0.081519;\n"
" sum += maskTex.Sample(samp, vtf.uv + 1.0 * vtf.blurDir).a * 0.079905;\n"
" sum += maskTex.Sample(samp, vtf.uv + 2.0 * vtf.blurDir).a * 0.075252;\n"
" sum += maskTex.Sample(samp, vtf.uv + 3.0 * vtf.blurDir).a * 0.068091;\n"
" sum += maskTex.Sample(samp, vtf.uv + 4.0 * vtf.blurDir).a * 0.059195;\n"
" sum += maskTex.Sample(samp, vtf.uv + 5.0 * vtf.blurDir).a * 0.049444;\n"
" sum += maskTex.Sample(samp, vtf.uv + 6.0 * vtf.blurDir).a * 0.039680;\n"
" sum += maskTex.Sample(samp, vtf.uv + 7.0 * vtf.blurDir).a * 0.030595;\n"
" sum += maskTex.Sample(samp, vtf.uv + 8.0 * vtf.blurDir).a * 0.022665;\n"
" sum += maskTex.Sample(samp, vtf.uv + 9.0 * vtf.blurDir).a * 0.016133;\n"
" sum += maskTex.Sample(samp, vtf.uv + 10.0 * vtf.blurDir).a * 0.011032;\n"
" sum += maskTex.Sample(samp, vtf.uv + 11.0 * vtf.blurDir).a * 0.007249;\n"
"\n" "\n"
" return float4(1.0, 1.0, 1.0, sum);\n" " return float4(1.0, 1.0, 1.0, sum);\n"
"}\n"; "}\n";
@ -230,10 +241,10 @@ CPhazonSuitFilter::Initialize(boo::ID3DDataFactory::Context& ctx)
{nullptr, nullptr, boo::VertexSemantic::UV4} {nullptr, nullptr, boo::VertexSemantic::UV4}
}; };
s_BlurVtxFmt = ctx.newVertexFormat(2, BlurVtxVmt); s_BlurVtxFmt = ctx.newVertexFormat(2, BlurVtxVmt);
s_IndPipeline = ctx.newShaderPipeline(VS, IndFS, nullptr, nullptr, nullptr, s_VtxFmt, boo::BlendFactor::One, s_IndPipeline = ctx.newShaderPipeline(VS, IndFS, nullptr, nullptr, nullptr, s_VtxFmt, boo::BlendFactor::SrcAlpha,
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips, boo::BlendFactor::One, boo::Primitive::TriStrips,
boo::ZTest::None, false, true, false, boo::CullMode::None); boo::ZTest::None, false, true, false, boo::CullMode::None);
s_Pipeline = ctx.newShaderPipeline(VS, FS, nullptr, nullptr, nullptr, s_VtxFmt, boo::BlendFactor::One, s_Pipeline = ctx.newShaderPipeline(VS, FS, nullptr, nullptr, nullptr, s_VtxFmt, boo::BlendFactor::SrcAlpha,
boo::BlendFactor::One, boo::Primitive::TriStrips, boo::BlendFactor::One, boo::Primitive::TriStrips,
boo::ZTest::None, false, true, false, boo::CullMode::None); boo::ZTest::None, false, true, false, boo::CullMode::None);
s_BlurPipeline = ctx.newShaderPipeline(BlurVS, BlurFS, nullptr, nullptr, nullptr, s_BlurVtxFmt, boo::BlendFactor::One, s_BlurPipeline = ctx.newShaderPipeline(BlurVS, BlurFS, nullptr, nullptr, nullptr, s_BlurVtxFmt, boo::BlendFactor::One,

View File

@ -142,19 +142,30 @@ static const char* BlurFS =
" //this will be our alpha sum\n" " //this will be our alpha sum\n"
" float sum = 0.0;\n" " float sum = 0.0;\n"
"\n" "\n"
" //apply blurring, using a 9-tap filter with predefined gaussian weights\n" " //apply blurring, using a 23-tap filter with predefined gaussian weights\n"
"\n" " sum += maskTex.sample(samp, vtf.uv + -11.0 * vtf.blurDir).a * 0.007249;\n"
" sum += maskTex.sample(samp, vtf.uv - 4.0 * vtf.blurDir).a * 0.0162162162;\n" " sum += maskTex.sample(samp, vtf.uv + -10.0 * vtf.blurDir).a * 0.011032;\n"
" sum += maskTex.sample(samp, vtf.uv - 3.0 * vtf.blurDir).a * 0.0540540541;\n" " sum += maskTex.sample(samp, vtf.uv + -9.0 * vtf.blurDir).a * 0.016133;\n"
" sum += maskTex.sample(samp, vtf.uv - 2.0 * vtf.blurDir).a * 0.1216216216;\n" " sum += maskTex.sample(samp, vtf.uv + -8.0 * vtf.blurDir).a * 0.022665;\n"
" sum += maskTex.sample(samp, vtf.uv - 1.0 * vtf.blurDir).a * 0.1945945946;\n" " sum += maskTex.sample(samp, vtf.uv + -7.0 * vtf.blurDir).a * 0.030595;\n"
"\n" " sum += maskTex.sample(samp, vtf.uv + -6.0 * vtf.blurDir).a * 0.039680;\n"
" sum += maskTex.sample(samp, vtf.uv).a * 0.2270270270;\n" " sum += maskTex.sample(samp, vtf.uv + -5.0 * vtf.blurDir).a * 0.049444;\n"
"\n" " sum += maskTex.sample(samp, vtf.uv + -4.0 * vtf.blurDir).a * 0.059195;\n"
" sum += maskTex.sample(samp, vtf.uv + 1.0 * vtf.blurDir).a * 0.1945945946;\n" " sum += maskTex.sample(samp, vtf.uv + -3.0 * vtf.blurDir).a * 0.068091;\n"
" sum += maskTex.sample(samp, vtf.uv + 2.0 * vtf.blurDir).a * 0.1216216216;\n" " sum += maskTex.sample(samp, vtf.uv + -2.0 * vtf.blurDir).a * 0.075252;\n"
" sum += maskTex.sample(samp, vtf.uv + 3.0 * vtf.blurDir).a * 0.0540540541;\n" " sum += maskTex.sample(samp, vtf.uv + -1.0 * vtf.blurDir).a * 0.079905;\n"
" sum += maskTex.sample(samp, vtf.uv + 4.0 * vtf.blurDir).a * 0.0162162162;\n" " sum += maskTex.sample(samp, vtf.uv).a * 0.081519;\n"
" sum += maskTex.sample(samp, vtf.uv + 1.0 * vtf.blurDir).a * 0.079905;\n"
" sum += maskTex.sample(samp, vtf.uv + 2.0 * vtf.blurDir).a * 0.075252;\n"
" sum += maskTex.sample(samp, vtf.uv + 3.0 * vtf.blurDir).a * 0.068091;\n"
" sum += maskTex.sample(samp, vtf.uv + 4.0 * vtf.blurDir).a * 0.059195;\n"
" sum += maskTex.sample(samp, vtf.uv + 5.0 * vtf.blurDir).a * 0.049444;\n"
" sum += maskTex.sample(samp, vtf.uv + 6.0 * vtf.blurDir).a * 0.039680;\n"
" sum += maskTex.sample(samp, vtf.uv + 7.0 * vtf.blurDir).a * 0.030595;\n"
" sum += maskTex.sample(samp, vtf.uv + 8.0 * vtf.blurDir).a * 0.022665;\n"
" sum += maskTex.sample(samp, vtf.uv + 9.0 * vtf.blurDir).a * 0.016133;\n"
" sum += maskTex.sample(samp, vtf.uv + 10.0 * vtf.blurDir).a * 0.011032;\n"
" sum += maskTex.sample(samp, vtf.uv + 11.0 * vtf.blurDir).a * 0.007249;\n"
"\n" "\n"
" return float4(1.0, 1.0, 1.0, sum);\n" " return float4(1.0, 1.0, 1.0, sum);\n"
"}\n"; "}\n";

View File

@ -9,25 +9,25 @@ namespace urde
{ {
CGuiModel::CGuiModel(const CGuiWidgetParms& parms, CSimplePool* sp, CAssetId modelId, u32 lightMask, bool flag) CGuiModel::CGuiModel(const CGuiWidgetParms& parms, CSimplePool* sp, CAssetId modelId, u32 lightMask, bool flag)
: CGuiWidget(parms), x108_modelId(modelId), x10c_lightMask(lightMask) : CGuiWidget(parms), xc8_modelId(modelId), xcc_lightMask(lightMask)
{ {
if (!flag || !modelId.IsValid() || if (!flag || !modelId.IsValid() ||
parms.x0_frame->GetGuiSys().GetUsageMode() == CGuiSys::EUsageMode::Two) parms.x0_frame->GetGuiSys().GetUsageMode() == CGuiSys::EUsageMode::Two)
return; return;
xf8_model = sp->GetObj({SBIG('CMDL'), modelId}); xb8_model = sp->GetObj({SBIG('CMDL'), modelId});
} }
std::vector<CAssetId> CGuiModel::GetModelAssets() const std::vector<CAssetId> CGuiModel::GetModelAssets() const
{ {
return {x108_modelId}; return {xc8_modelId};
} }
bool CGuiModel::GetIsFinishedLoadingWidgetSpecific() const bool CGuiModel::GetIsFinishedLoadingWidgetSpecific() const
{ {
if (!xf8_model) if (!xb8_model)
return true; return true;
const CModel* model = xf8_model.GetObj(); const CModel* model = xb8_model.GetObj();
if (!model) if (!model)
return false; return false;
model->GetInstance().Touch(0); model->GetInstance().Touch(0);
@ -36,7 +36,7 @@ bool CGuiModel::GetIsFinishedLoadingWidgetSpecific() const
void CGuiModel::Touch() const void CGuiModel::Touch() const
{ {
const CModel* model = xf8_model.GetObj(); const CModel* model = xb8_model.GetObj();
if (model) if (model)
model->GetInstance().Touch(0); model->GetInstance().Touch(0);
} }
@ -44,11 +44,11 @@ void CGuiModel::Touch() const
void CGuiModel::Draw(const CGuiWidgetDrawParms& parms) const void CGuiModel::Draw(const CGuiWidgetDrawParms& parms) const
{ {
CGraphics::SetModelMatrix(x34_worldXF); CGraphics::SetModelMatrix(x34_worldXF);
if (!xf8_model) if (!xb8_model)
return; return;
if (!GetIsFinishedLoading()) if (!GetIsFinishedLoading())
return; return;
const CModel* model = xf8_model.GetObj(); const CModel* model = xb8_model.GetObj();
if (!model) if (!model)
return; return;
@ -56,7 +56,7 @@ void CGuiModel::Draw(const CGuiWidgetDrawParms& parms) const
{ {
zeus::CColor moduCol = xa8_color2; zeus::CColor moduCol = xa8_color2;
moduCol.a *= parms.x0_alphaMod; moduCol.a *= parms.x0_alphaMod;
xb0_frame->EnableLights(x10c_lightMask, const_cast<CBooModel&>(model->GetInstance())); xb0_frame->EnableLights(xcc_lightMask, const_cast<CBooModel&>(model->GetInstance()));
//if (xb6_29_cullFaces) //if (xb6_29_cullFaces)
// CGraphics::SetCullMode(ERglCullMode::Front); // CGraphics::SetCullMode(ERglCullMode::Front);
@ -78,29 +78,29 @@ void CGuiModel::Draw(const CGuiWidgetDrawParms& parms) const
} }
case EGuiModelDrawFlags::Alpha: case EGuiModelDrawFlags::Alpha:
{ {
CModelFlags flags(4, 0, (u32(xb7_24_depthWrite) << 1) | u32(xb6_31_depthTest), moduCol); CModelFlags flags(5, 0, (u32(xb7_24_depthWrite) << 1) | u32(xb6_31_depthTest), moduCol);
flags.m_extendedShader = xb6_29_cullFaces ? EExtendedShader::ForcedAlpha : EExtendedShader::ForcedAlphaNoCull; flags.m_noCull = !xb6_29_cullFaces;
model->Draw(flags); model->Draw(flags);
break; break;
} }
case EGuiModelDrawFlags::Additive: case EGuiModelDrawFlags::Additive:
{ {
CModelFlags flags(3, 0, (u32(xb7_24_depthWrite) << 1) | u32(xb6_31_depthTest), moduCol); CModelFlags flags(7, 0, (u32(xb7_24_depthWrite) << 1) | u32(xb6_31_depthTest), moduCol);
flags.m_extendedShader = xb6_29_cullFaces ? EExtendedShader::ForcedAdditive : EExtendedShader::ForcedAdditiveNoCull; flags.m_noCull = !xb6_29_cullFaces;
model->Draw(flags); model->Draw(flags);
break; break;
} }
case EGuiModelDrawFlags::AlphaAdditiveOverdraw: case EGuiModelDrawFlags::AlphaAdditiveOverdraw:
{ {
CModelFlags flags(4, 0, xb6_31_depthTest, moduCol); CModelFlags flags(5, 0, xb6_31_depthTest, moduCol);
flags.m_extendedShader = xb6_29_cullFaces ? EExtendedShader::ForcedAlpha : EExtendedShader::ForcedAlphaNoCull; flags.m_noCull = !xb6_29_cullFaces;
model->Draw(flags); model->Draw(flags);
flags.x0_blendMode = 5; flags.x0_blendMode = 7;
flags.x1_matSetIdx = 0; flags.x1_matSetIdx = 0;
flags.x2_flags = (u32(xb7_24_depthWrite) << 1) | u32(xb6_31_depthTest); flags.x2_flags = (u32(xb7_24_depthWrite) << 1) | u32(xb6_31_depthTest);
flags.x4_color = moduCol; flags.x4_color = moduCol;
flags.m_extendedShader = xb6_29_cullFaces ? EExtendedShader::ForcedAdditive : EExtendedShader::ForcedAdditiveNoCull; flags.m_noCull = !xb6_29_cullFaces;
model->Draw(flags); model->Draw(flags);
break; break;
} }

View File

@ -11,9 +11,9 @@ class CSimplePool;
class CGuiModel : public CGuiWidget class CGuiModel : public CGuiWidget
{ {
TLockedToken<CModel> xf8_model; TLockedToken<CModel> xb8_model;
CAssetId x108_modelId; CAssetId xc8_modelId;
u32 x10c_lightMask; u32 xcc_lightMask;
public: public:
CGuiModel(const CGuiWidgetParms& parms, CSimplePool* sp, CAssetId modelId, u32 lightMask, bool flag); CGuiModel(const CGuiWidgetParms& parms, CSimplePool* sp, CAssetId modelId, u32 lightMask, bool flag);
FourCC GetWidgetTypeID() const { return FOURCC('MODL'); } FourCC GetWidgetTypeID() const { return FOURCC('MODL'); }

View File

@ -137,18 +137,22 @@ void CHudVisorBeamMenu::UpdateMenuWidgetTransform(int idx, CGuiWidget& w, float
w.SetO2WTransform(x18_basewidget_menu->GetWorldTransform() * w.SetO2WTransform(x18_basewidget_menu->GetWorldTransform() *
zeus::CTransform::Translate(0.f, 0.f, translate) * zeus::CTransform::Translate(0.f, 0.f, translate) *
zeus::CTransform::Scale(scale)); zeus::CTransform::Scale(scale));
break;
case 1: case 1:
w.SetO2WTransform(x18_basewidget_menu->GetWorldTransform() * w.SetO2WTransform(x18_basewidget_menu->GetWorldTransform() *
zeus::CTransform::Translate(translate, 0.f, 0.f) * zeus::CTransform::Translate(translate, 0.f, 0.f) *
zeus::CTransform::Scale(scale)); zeus::CTransform::Scale(scale));
break;
case 2: case 2:
w.SetO2WTransform(x18_basewidget_menu->GetWorldTransform() * w.SetO2WTransform(x18_basewidget_menu->GetWorldTransform() *
zeus::CTransform::Translate(0.f, 0.f, -translate) * zeus::CTransform::Translate(0.f, 0.f, -translate) *
zeus::CTransform::Scale(scale)); zeus::CTransform::Scale(scale));
break;
case 3: case 3:
w.SetO2WTransform(x18_basewidget_menu->GetWorldTransform() * w.SetO2WTransform(x18_basewidget_menu->GetWorldTransform() *
zeus::CTransform::Translate(-translate, 0.f, 0.f) * zeus::CTransform::Translate(-translate, 0.f, 0.f) *
zeus::CTransform::Scale(scale)); zeus::CTransform::Scale(scale));
break;
default: break; default: break;
} }
} }

View File

@ -250,6 +250,7 @@ int CTextExecuteBuffer::WrapOneLTR(const char16_t* str, int len)
void CTextExecuteBuffer::MoveWordLTR() void CTextExecuteBuffer::MoveWordLTR()
{ {
xa4_curLine->x8_curX -= (xb0_curX + xbc_spaceDistance);
xa4_curLine->xc_curY = std::min(xa4_curLine->xc_curY, xb8_curWordY); xa4_curLine->xc_curY = std::min(xa4_curLine->xc_curY, xb8_curWordY);
xbc_spaceDistance = 0; xbc_spaceDistance = 0;
--xa4_curLine->x4_wordCount; --xa4_curLine->x4_wordCount;
@ -258,7 +259,8 @@ void CTextExecuteBuffer::MoveWordLTR()
xa4_curLine = static_cast<CLineInstruction*>(x0_instList.emplace(xa8_curWordIt, xa4_curLine = static_cast<CLineInstruction*>(x0_instList.emplace(xa8_curWordIt,
std::make_shared<CLineInstruction>(x18_textState.x80_just, x18_textState.x84_vjust, xc0_imageBaseline))->get()); std::make_shared<CLineInstruction>(x18_textState.x80_just, x18_textState.x84_vjust, xc0_imageBaseline))->get());
x0_instList.emplace(xa8_curWordIt, std::make_shared<CWordInstruction>()); // Dunno what's up with this in the original; seems fine without
//x0_instList.emplace(xa8_curWordIt, std::make_shared<CWordInstruction>());
++xa0_curBlock->x34_lineCount; ++xa0_curBlock->x34_lineCount;
} }

View File

@ -344,6 +344,7 @@ void CTextParser::ParseText(CTextExecuteBuffer& out, const char16_t* str, int le
} }
if ((len == -1 || e+1 < len) && str[e+1] != u'&') if ((len == -1 || e+1 < len) && str[e+1] != u'&')
{ {
if (e > b)
out.AddString(str + b, e - b); out.AddString(str + b, e - b);
++e; ++e;
b = e; b = e;

View File

@ -199,10 +199,10 @@ void CTextRenderBuffer::Render(const zeus::CColor& col, float time) const
CTextSupportShader::Uniform{mat, col}; CTextSupportShader::Uniform{mat, col};
if (m_drawFlags == CGuiWidget::EGuiModelDrawFlags::AlphaAdditiveOverdraw) if (m_drawFlags == CGuiWidget::EGuiModelDrawFlags::AlphaAdditiveOverdraw)
{ {
zeus::CColor colSq = col * col; zeus::CColor colPremul = col * col.a;
colSq.a = col.a; colPremul.a = col.a;
const_cast<CTextRenderBuffer*>(this)->m_uniBuf2.access() = const_cast<CTextRenderBuffer*>(this)->m_uniBuf2.access() =
CTextSupportShader::Uniform{mat, colSq}; CTextSupportShader::Uniform{mat, colPremul};
} }
for (const BooFontCharacters& chs : m_fontCharacters) for (const BooFontCharacters& chs : m_fontCharacters)

View File

@ -75,9 +75,9 @@ CInventoryScreen::CInventoryScreen(const CStateManager& mgr, CGuiFrame& frame, c
: CPauseScreenBase(mgr, frame, pauseStrg) : CPauseScreenBase(mgr, frame, pauseStrg)
{ {
CPlayerState& playerState = *mgr.GetPlayerState(); CPlayerState& playerState = *mgr.GetPlayerState();
x19c_samusDoll = std::make_unique<CSamusDoll>(suitDgrp, ballDgrp, CPlayerState::EPlayerSuit::Phazon x19c_samusDoll = std::make_unique<CSamusDoll>(suitDgrp, ballDgrp,
/*CPlayerState::EPlayerSuit(int(playerState.GetCurrentSuit()) + CPlayerState::EPlayerSuit(int(playerState.GetCurrentSuit()) +
playerState.IsFusionEnabled() * 4)*/, playerState.IsFusionEnabled() * 4),
playerState.GetCurrentBeam(), playerState.GetCurrentBeam(),
playerState.HasPowerUp(CPlayerState::EItemType::SpiderBall), playerState.HasPowerUp(CPlayerState::EItemType::SpiderBall),
playerState.HasPowerUp(CPlayerState::EItemType::GrappleBeam)); playerState.HasPowerUp(CPlayerState::EItemType::GrappleBeam));