More CAutoMapper fixes

This commit is contained in:
Jack Andersen 2017-11-17 17:35:37 -10:00
parent d14763ca19
commit a2c79eb996
17 changed files with 68 additions and 57 deletions

View File

@ -1130,33 +1130,30 @@ void CAutoMapper::ProcessControllerInput(const CFinalInput& input, CStateManager
if (x300_textpane_instructions)
{
if (x84_)
if (x78_areaHintDesc.IsLoaded())
{
if (x78_areaHintDesc.IsLoaded())
{
x2fc_textpane_hint->TextSupport().SetText(x78_areaHintDesc->GetString(0));
x304_textpane_instructions1->TextSupport().SetText(u"");
x300_textpane_instructions->TextSupport().SetText(u"");
x308_textpane_instructions2->TextSupport().SetText(u"");
}
else
{
x2fc_textpane_hint->TextSupport().SetText(u"");
std::u16string str = hecl::UTF8ToChar16(
hecl::Format("&image=SI,0.6,1.0,%8.8X;", u32(g_tweakPlayerRes->x24_lStick[x2e4_lStickPos].Value())));
str += g_MainStringTable->GetString(46); // Rotate
x300_textpane_instructions->TextSupport().SetText(str);
str = hecl::UTF8ToChar16(
hecl::Format("&image=SI,0.6,1.0,%8.8X;", u32(g_tweakPlayerRes->x4c_cStick[x2e8_rStickPos].Value())));
str += g_MainStringTable->GetString(47); // Move
x304_textpane_instructions1->TextSupport().SetText(str);
str = hecl::UTF8ToChar16(
hecl::Format("&image=%8.8X;", u32(g_tweakPlayerRes->x74_lTrigger[x2ec_lTriggerPos].Value())));
str += g_MainStringTable->GetString(48); // Zoom
str += hecl::UTF8ToChar16(
hecl::Format("&image=%8.8X;", u32(g_tweakPlayerRes->x80_rTrigger[x2f0_rTriggerPos].Value())));
x308_textpane_instructions2->TextSupport().SetText(str);
}
x2fc_textpane_hint->TextSupport().SetText(x78_areaHintDesc->GetString(0));
x304_textpane_instructions1->TextSupport().SetText(u"");
x300_textpane_instructions->TextSupport().SetText(u"");
x308_textpane_instructions2->TextSupport().SetText(u"");
}
else
{
x2fc_textpane_hint->TextSupport().SetText(u"");
std::u16string str = hecl::UTF8ToChar16(
hecl::Format("&image=SI,0.6,1.0,%8.8X;", u32(g_tweakPlayerRes->x24_lStick[x2e4_lStickPos].Value())));
str += g_MainStringTable->GetString(46); // Rotate
x300_textpane_instructions->TextSupport().SetText(str);
str = hecl::UTF8ToChar16(
hecl::Format("&image=SI,0.6,1.0,%8.8X;", u32(g_tweakPlayerRes->x4c_cStick[x2e8_rStickPos].Value())));
str += g_MainStringTable->GetString(47); // Move
x304_textpane_instructions1->TextSupport().SetText(str);
str = hecl::UTF8ToChar16(
hecl::Format("&image=%8.8X;", u32(g_tweakPlayerRes->x74_lTrigger[x2ec_lTriggerPos].Value())));
str += g_MainStringTable->GetString(48); // Zoom
str += hecl::UTF8ToChar16(
hecl::Format("&image=%8.8X;", u32(g_tweakPlayerRes->x80_rTrigger[x2f0_rTriggerPos].Value())));
x308_textpane_instructions2->TextSupport().SetText(str);
}
}
@ -1233,13 +1230,15 @@ void CAutoMapper::Update(float dt, const CStateManager& mgr)
std::u16string string;
if (x1bc_state == EAutoMapperState::MapScreenUniverse ||
(x1bc_state == EAutoMapperState::MapScreen && HasCurrentMapUniverseWorld()))
string = hecl::UTF8ToChar16(hecl::Format("image=%8.8X", u32(g_tweakPlayerRes->x98_aButton[x2f4_aButtonPos].Value())));
string = hecl::UTF8ToChar16(hecl::Format("&image=%8.8X;", u32(g_tweakPlayerRes->x98_aButton[x2f4_aButtonPos].Value())));
right1->TextSupport().SetText(string);
CGuiTextPane* right = static_cast<CGuiTextPane*>(x28_frmeMapScreen->FindWidget("textpane_right"));
if (x1bc_state == EAutoMapperState::MapScreenUniverse)
string = g_MainStringTable->GetString(45);
else if (x1bc_state == EAutoMapperState::MapScreen)
else if (x1bc_state == EAutoMapperState::MapScreen && HasCurrentMapUniverseWorld())
string = g_MainStringTable->GetString(44);
else
string = std::u16string();
right->TextSupport().SetText(string);
}

View File

@ -151,7 +151,6 @@ private:
rstl::reserved_vector<TLockedToken<CTexture>, 5> x48_mapIcons;
CAssetId x74_areaHintDescId;
TLockedToken<CStringTable> x78_areaHintDesc;
u32 x84_ = 0;
CAssetId x88_mapAreaStringId;
TLockedToken<CStringTable> x8c_mapAreaString; // Used to be optional
u32 x9c_worldIdx = 0;

View File

@ -379,14 +379,21 @@ void CMapWorld::DrawAreas(const CMapWorld::CMapWorldDrawParms& parms, int selAre
const CMapArea::CMapAreaSurface& surf = mapa->GetSurface(info.GetLocalObjectIndex());
zeus::CColor color(std::max(0.f, (-parms.GetCameraTransform().basis[1]).dot(
areaPostXf.rotate(surf.GetNormal()))) * g_tweakAutoMapper->GetMapSurfaceNormColorLinear() +
g_tweakAutoMapper->GetMapSurfaceNormColorConstant());
g_tweakAutoMapper->GetMapSurfaceNormColorConstant());
color *= info.GetSurfaceColor();
if (lastAreaIdx != info.GetAreaIndex() || lastType != CMapObjectSortInfo::EObjectCode::Surface)
CGraphics::SetModelMatrix(parms.GetPlaneProjectionTransform() * areaPostXf);
surf.Draw(mapa->GetVertices(), color, info.GetOutlineColor(), parms.GetOutlineWidthScale());
lastAreaIdx = info.GetAreaIndex();
lastType = info.GetObjectCode();
}
else if (info.GetObjectCode() == CMapObjectSortInfo::EObjectCode::Door ||
info.GetObjectCode() == CMapObjectSortInfo::EObjectCode::Object)
}
for (const CMapObjectSortInfo& info : sortInfos)
{
const CMapArea* mapa = GetMapArea(info.GetAreaIndex());
if (info.GetObjectCode() == CMapObjectSortInfo::EObjectCode::Door ||
info.GetObjectCode() == CMapObjectSortInfo::EObjectCode::Object)
{
const CMappableObject& mapObj = mapa->GetMappableObject(info.GetLocalObjectIndex());
zeus::CTransform objXf =
@ -403,6 +410,7 @@ void CMapWorld::DrawAreas(const CMapWorld::CMapWorldDrawParms& parms, int selAre
zeus::CMatrix3f(parms.GetObjectScale())));
}
mapObj.Draw(selArea, mwInfo, parms.GetAlpha(), lastType != info.GetObjectCode());
lastType = info.GetObjectCode();
}
else if (info.GetObjectCode() == CMapObjectSortInfo::EObjectCode::DoorSurface)
{
@ -413,9 +421,8 @@ void CMapWorld::DrawAreas(const CMapWorld::CMapWorldDrawParms& parms, int selAre
CGraphics::SetModelMatrix(objXf);
mapObj.DrawDoorSurface(selArea, mwInfo, parms.GetAlpha(), info.GetLocalObjectIndex() % 6,
lastType != info.GetObjectCode());
lastType = info.GetObjectCode();
}
lastAreaIdx = info.GetAreaIndex();
lastType = info.GetObjectCode();
}
}

View File

@ -106,7 +106,7 @@ static zeus::CVector2f IntersectLines(const zeus::CVector2f& pa1, const zeus::CV
zeus::CVector2f pa1mpa2 = pa1 - pa2;
zeus::CVector2f pb1mpb2 = pb1 - pb2;
float denom = pa1mpa2.x * pb1mpb2.y - pa1mpa2.y * pb1mpb2.x;
if (denom < 0.0001f)
if (denom < 0.01f)
return pa2;
float numt1 = pa1.x * pa2.y - pa1.y * pa2.x;
float numt2 = pb1.x * pb2.y - pb1.y * pb2.x;

View File

@ -113,7 +113,7 @@ struct OGLLineDataBindingFactory : CLineRendererShaders::IDataBindingFactory
{vbufInfo.first.get(), nullptr, boo::VertexSemantic::Color},
{vbufInfo.first.get(), nullptr, boo::VertexSemantic::UV4}
};
vtxFmt = ctx.newVertexFormat(3, TexFmtTex);
vtxFmt = ctx.newVertexFormat(3, TexFmtTex, vbufInfo.second);
}
else
{
@ -123,7 +123,7 @@ struct OGLLineDataBindingFactory : CLineRendererShaders::IDataBindingFactory
{vbufInfo.first.get(), nullptr, boo::VertexSemantic::Position4},
{vbufInfo.first.get(), nullptr, boo::VertexSemantic::Color}
};
vtxFmt = ctx.newVertexFormat(2, TexFmtNoTex);
vtxFmt = ctx.newVertexFormat(2, TexFmtNoTex, vbufInfo.second);
}
boo::ObjToken<boo::IGraphicsBuffer> uniforms[] = {ubufInfo.first.get()};
@ -221,7 +221,7 @@ CLineRendererShaders::IDataBindingFactory* CLineRendererShaders::Initialize(boo:
m_texAlpha = ctx.newShaderPipeline(VS_GLSL_TEX, FS_GLSL_TEX, m_texVtxFmt,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, boo::ZTest::None,
true, true, false, boo::CullMode::None);
false, true, false, boo::CullMode::None);
m_texAdditive = ctx.newShaderPipeline(VS_GLSL_TEX, FS_GLSL_TEX, m_texVtxFmt,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
boo::Primitive::TriStrips, boo::ZTest::None,
@ -229,7 +229,7 @@ CLineRendererShaders::IDataBindingFactory* CLineRendererShaders::Initialize(boo:
m_noTexAlpha = ctx.newShaderPipeline(VS_GLSL_NOTEX, FS_GLSL_NOTEX, m_noTexVtxFmt,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, boo::ZTest::None,
true, true, false, boo::CullMode::None);
false, true, false, boo::CullMode::None);
m_noTexAdditive = ctx.newShaderPipeline(VS_GLSL_NOTEX, FS_GLSL_NOTEX, m_noTexVtxFmt,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
boo::Primitive::TriStrips, boo::ZTest::None,

View File

@ -144,7 +144,7 @@ CLineRendererShaders::IDataBindingFactory* CLineRendererShaders::Initialize(boo:
nullptr, m_texVtxFmt,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, boo::ZTest::None,
true, true, false, boo::CullMode::None);
false, true, false, boo::CullMode::None);
m_texAdditive = ctx.newShaderPipeline(VS_HLSL_TEX, FS_HLSL_TEX, nullptr, nullptr,
nullptr, m_texVtxFmt,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
@ -154,7 +154,7 @@ CLineRendererShaders::IDataBindingFactory* CLineRendererShaders::Initialize(boo:
nullptr, m_noTexVtxFmt,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, boo::ZTest::None,
true, true, false, boo::CullMode::None);
false, true, false, boo::CullMode::None);
m_noTexAdditive = ctx.newShaderPipeline(VS_HLSL_NOTEX, FS_HLSL_NOTEX, nullptr, nullptr,
nullptr, m_noTexVtxFmt,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,

View File

@ -159,19 +159,23 @@ CLineRendererShaders::IDataBindingFactory* CLineRendererShaders::Initialize(boo:
m_texAlpha = ctx.newShaderPipeline(VS_METAL_TEX, FS_METAL_TEX, nullptr, nullptr, m_texVtxFmt,
CGraphics::g_ViewportSamples,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, boo::ZTest::None, true, true, true, boo::CullMode::None);
boo::Primitive::TriStrips, boo::ZTest::None,
false, true, false, boo::CullMode::None);
m_texAdditive = ctx.newShaderPipeline(VS_METAL_TEX, FS_METAL_TEX, nullptr, nullptr, m_texVtxFmt,
CGraphics::g_ViewportSamples,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
boo::Primitive::TriStrips, boo::ZTest::None, false, true, true, boo::CullMode::None);
boo::Primitive::TriStrips, boo::ZTest::None,
false, true, false, boo::CullMode::None);
m_noTexAlpha = ctx.newShaderPipeline(VS_METAL_NOTEX, FS_METAL_NOTEX, nullptr, nullptr, m_noTexVtxFmt,
CGraphics::g_ViewportSamples,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, boo::ZTest::None, true, true, true, boo::CullMode::None);
boo::Primitive::TriStrips, boo::ZTest::None,
false, true, false, boo::CullMode::None);
m_noTexAdditive = ctx.newShaderPipeline(VS_METAL_NOTEX, FS_METAL_NOTEX, nullptr, nullptr, m_noTexVtxFmt,
CGraphics::g_ViewportSamples,
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
boo::Primitive::TriStrips, boo::ZTest::None, false, true, true, boo::CullMode::None);
boo::Primitive::TriStrips, boo::ZTest::None,
false, true, false, boo::CullMode::None);
return new struct MetalLineDataBindingFactory;
}

View File

@ -53,7 +53,7 @@ static const char* TextFS =
"};\n"
"\n"
"Texture2DArray tex : register(t0);\n"
"SamplerState samp : register(s0);\n"
"SamplerState samp : register(s2);\n"
"\n"
"float4 main(in VertToFrag vtf) : SV_Target0\n"
"{\n"
@ -100,7 +100,7 @@ static const char* ImgFS =
"};\n"
"\n"
"Texture2D tex : register(t0);\n"
"SamplerState samp : register(s0);\n"
"SamplerState samp : register(s2);\n"
"\n"
"float4 main(in VertToFrag vtf) : SV_Target0\n"
"{\n"

View File

@ -50,7 +50,7 @@ static const char* TextVS =
static const char* TextFS =
"#include <metal_stdlib>\n"
"using namespace metal;\n"
"constexpr sampler samp(address::repeat, filter::linear);\n"
"constexpr sampler samp(address::clamp_to_edge, filter::linear);\n"
"struct VertToFrag\n"
"{\n"
" float4 pos [[ position ]];\n"
@ -105,7 +105,7 @@ static const char* ImgVS =
static const char* ImgFS =
"#include <metal_stdlib>\n"
"using namespace metal;\n"
"constexpr sampler samp(address::repeat, filter::linear);\n"
"constexpr sampler samp(address::clamp_to_edge, filter::linear);\n"
"struct VertToFrag\n"
"{\n"
" float4 pos [[ position ]];\n"

View File

@ -84,7 +84,7 @@ void CGuiFrame::EnableLights(u32 lights, CBooModel& model) const
++reinterpret_cast<std::underlying_type_t<ERglLight>&>(lightId);
++idx;
}
if (m_indexedLights.empty())
if (lightsOut.empty())
{
//CGraphics::SetAmbientColor(zeus::CColor::skWhite);
lightsOut.push_back(CLight::BuildLocalAmbient(zeus::CVector3f::skZero, zeus::CColor::skWhite));

View File

@ -252,11 +252,11 @@ void CImageInstruction::Invoke(CFontRenderState& state, CTextRenderBuffer* buf)
zeus::CVector2i coords(state.xd4_curX, y);
buf->AddImage(coords, x4_image);
}
state.xd4_curX = state.xd4_curX + tex->GetWidth() * x4_image.x14_cropFactor.y;
state.xd4_curX = state.xd4_curX + tex->GetWidth() * x4_image.x14_cropFactor.x;
}
else
{
int scale = state.xdc_currentLineInst->x8_curX - tex->GetWidth() * x4_image.x14_cropFactor.y;
int scale = state.xdc_currentLineInst->x8_curX - tex->GetWidth() * x4_image.x14_cropFactor.x;
if (buf)
{
zeus::CVector2i coords(scale / 2 + state.xd4_curX, state.xd8_curY);

View File

@ -390,7 +390,8 @@ void CTextExecuteBuffer::AddImage(const CFontImageDef& image)
int width = tex->GetWidth() * image.x14_cropFactor.x;
int height = tex->GetHeight() * image.x14_cropFactor.y;
if (xa4_curLine->x8_curX + width > xa0_curBlock->xc_blockExtentX && xa4_curLine->x4_wordCount > 0)
if (x18_textState.x7c_enableWordWrap &&
xa4_curLine->x8_curX + width > xa0_curBlock->xc_blockExtentX && xa4_curLine->x4_wordCount > 1)
StartNewLine();
xa4_curLine->TestLargestImage(width, height, image.CalculateBaseline());

View File

@ -151,7 +151,7 @@ void CTextParser::ParseTag(CTextExecuteBuffer& out, const char16_t* str, int len
}
else if (BeginsWith(str, len, u"line-extra-space="))
{
out.AddLineSpacing(ParseInt(str + 17, len - 17, true));
out.AddLineExtraSpace(ParseInt(str + 17, len - 17, true));
}
else if (BeginsWith(str, len, u"just="))
{

View File

@ -128,6 +128,7 @@ void CTextRenderBuffer::CommitResources()
for (TToken<CTexture>& tex : img.m_imageDef.x4_texs)
{
boo::ObjToken<boo::ITexture> texs[] = {tex->GetBooTexture()};
texs[0]->setClampMode(boo::TextureClampMode::ClampToEdge);
img.m_dataBinding.push_back(ctx.newShaderDataBinding(CTextSupportShader::SelectImagePipeline(m_drawFlags),
vFmt, nullptr, iBufInfo.first.get(), nullptr,
1, uniforms, unistages, unioffs,

View File

@ -110,7 +110,7 @@ void CPauseScreenBlur::Draw(const CStateManager&) const
filterColor, t);
zeus::CColor scanLinesColor =
zeus::CColor::lerp(zeus::CColor::skWhite, zeus::CColor(0.75f, 1.f), t);
//const_cast<CScanLinesFilterEven&>(m_linesFilter).draw(scanLinesColor);
const_cast<CScanLinesFilterEven&>(m_linesFilter).draw(scanLinesColor);
}
if (x50_24_blurring /*&& x1c_camBlur.x2d_noPersistentCopy*/)

2
hecl

@ -1 +1 @@
Subproject commit 47e0feda0dffb476757d78cbb07c7500a16185e6
Subproject commit fd8b53d626cf1204c8d6dea80f64573afc8e784a

@ -1 +1 @@
Subproject commit 45c81ae955c52c9cf185c643879b3436595f5b06
Subproject commit 3e04e86ae9735d69de5ed5889471e8e45669e3ea